salix/e2e/paths/06-claim-module/03_detail.spec.js

115 lines
4.3 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2019-07-02 12:44:36 +00:00
// #1528 e2e claim/detail
xdescribe('Claim detail', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesPerson', 'claim');
await page.accessToSearchResult('1');
await page.accessToSection('claim.card.detail');
});
afterAll(async() => {
await browser.close();
});
it('should add the first claimable item from ticket to the claim', async() => {
await page.waitToClick(selectors.claimDetail.addItemButton);
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the claim contains now two items', async() => {
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
expect(result).toEqual(2);
});
2019-07-02 12:44:36 +00:00
it('should edit de first item claimed quantity', async() => {
await page.clearInput(selectors.claimDetail.firstItemQuantityInput); // selector deleted, find new upon fixes
await page.write(selectors.claimDetail.firstItemQuantityInput, '4'); // selector deleted, find new upon fixes
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-07-02 12:44:36 +00:00
it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
const claimedQuantity = page
.waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value'); // selector deleted, find new upon fixes
const totalClaimed = page
2019-01-23 14:33:25 +00:00
.waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText');
2019-07-02 12:44:36 +00:00
expect(claimedQuantity).toEqual('4');
expect(totalClaimed).toContain('€47.62');
});
it('should login as salesAssistant and navigate to the claim.detail section', async() => {
await page.loginAndModule('salesAssistant', 'claim');
await page.accessToSearchResult('1');
await page.accessToSection('claim.card.detail');
2020-02-04 15:21:10 +00:00
let url = await page.expectURL('/detail');
2019-07-02 12:44:36 +00:00
2020-02-04 15:21:10 +00:00
expect(url).toBe(true);
2019-07-02 12:44:36 +00:00
});
it('should edit de second item claimed discount', async() => {
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
2020-02-03 14:55:11 +00:00
await page.write(selectors.claimDetail.discount, '100');
await page.keyboard.press('Enter');
const result = await page.waitForLastSnackbar();
2019-07-02 12:44:36 +00:00
expect(result).toEqual('Data saved!');
});
it('should check the mana is the expected one', async() => {
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
const result = await page.waitToGetProperty(selectors.claimDetail.discoutPopoverMana, 'innerText');
2019-07-02 12:44:36 +00:00
expect(result).toContain('MANÁ: €106');
});
it('should delete the second item from the claim', async() => {
await page.waitToClick(selectors.claimDetail.secondItemDeleteButton);
const result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it('should confirm the claim contains now one item', async() => {
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
expect(result).toEqual(1);
});
2019-04-08 13:38:47 +00:00
2019-07-02 12:44:36 +00:00
it('should add the deleted ticket from to the claim', async() => {
await page.waitToClick(selectors.claimDetail.addItemButton);
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
const result = await page.waitForLastSnackbar();
2019-04-08 13:38:47 +00:00
expect(result).toEqual('Data saved!');
});
it(`should have been redirected to the next section in claims`, async() => {
2020-02-04 15:21:10 +00:00
let url = await page.expectURL('development');
2019-04-08 13:38:47 +00:00
2020-02-04 15:21:10 +00:00
expect(url).toBe(true);
2019-04-08 13:38:47 +00:00
});
2019-07-02 12:44:36 +00:00
it('should navigate back to claim.detail to confirm the claim contains now two items', async() => {
await page.accessToSection('claim.card.detail');
await page.wait(selectors.claimDetail.claimDetailLine);
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
2019-07-02 12:44:36 +00:00
expect(result).toEqual(2);
});
});