2019-01-22 12:18:20 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-01-22 12:18:20 +00:00
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
// #1528 e2e claim/detail
|
|
|
|
xdescribe('Claim detail', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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');
|
|
|
|
});
|
2019-01-22 12:18:20 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-01-22 12:18:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should add the first claimable item from ticket to the claim', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDetail.addItemButton);
|
|
|
|
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-01-22 12:18:20 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-01-22 12:18:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the claim contains now two items', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
2019-01-22 12:18:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual(2);
|
|
|
|
});
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
it('should edit de first item claimed quantity', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-01-22 12:18:20 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-01-22 12:18:20 +00:00
|
|
|
});
|
|
|
|
|
2019-07-02 12:44:36 +00:00
|
|
|
it('should confirm the first item quantity, and the claimed total were correctly edited', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const claimedQuantity = page
|
2020-01-16 12:40:51 +00:00
|
|
|
.waitToGetProperty(selectors.claimDetail.firstItemQuantityInput, 'value'); // selector deleted, find new upon fixes
|
2019-01-22 12:18:20 +00:00
|
|
|
|
2020-01-23 15:01:29 +00:00
|
|
|
const totalClaimed = page
|
2019-01-23 14:33:25 +00:00
|
|
|
.waitToGetProperty(selectors.claimDetail.totalClaimed, 'innerText');
|
2019-01-22 12:18:20 +00:00
|
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.loginAndModule('salesAssistant', 'claim');
|
|
|
|
await page.accessToSearchResult('1');
|
|
|
|
await page.accessToSection('claim.card.detail');
|
2020-03-24 15:49:36 +00:00
|
|
|
let url = await page.expectURL('/detail'); // replace with waitForState
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
|
2020-02-03 14:55:11 +00:00
|
|
|
await page.write(selectors.claimDetail.discount, '100');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.keyboard.press('Enter');
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-07-02 12:44:36 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-07-02 12:44:36 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the mana is the expected one', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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');
|
2019-01-22 12:18:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the second item from the claim', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDetail.secondItemDeleteButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-01-22 12:18:20 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-01-22 12:18:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the claim contains now one item', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page.countElement(selectors.claimDetail.claimDetailLine);
|
2019-01-22 12:18:20 +00:00
|
|
|
|
|
|
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDetail.addItemButton);
|
|
|
|
await page.waitToClick(selectors.claimDetail.firstClaimableSaleFromTicket);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-04-08 13:38:47 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-04-08 13:38:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should have been redirected to the next section in claims`, async() => {
|
2020-03-24 15:49:36 +00:00
|
|
|
let url = await page.expectURL('development'); // replace with waitForState
|
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() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
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);
|
|
|
|
});
|
2019-01-22 12:18:20 +00:00
|
|
|
});
|