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);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-01-22 12:18:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
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');
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-01-22 12:18:20 +00:00
|
|
|
|
|
|
|
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() => {
|
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');
|
|
|
|
await page.waitForURL('/detail');
|
|
|
|
const url = await page.parsedUrl();
|
2019-07-02 12:44:36 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('/detail');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should edit de second item claimed discount', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.claimDetail.secondItemDiscount);
|
|
|
|
await page.write(selectors.claimDetail.discountInput, '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() => {
|
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);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-01-22 12:18:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
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-01-23 15:01:29 +00:00
|
|
|
await page.waitForURL('/development');
|
|
|
|
const url = await page.parsedUrl();
|
2019-04-08 13:38:47 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('development');
|
|
|
|
});
|
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
|
|
|
});
|