2019-02-11 13:51:42 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-23 15:01:29 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-02-11 13:51:42 +00:00
|
|
|
|
2020-01-28 10:59:36 +00:00
|
|
|
describe('Order lines', () => {
|
2020-01-23 15:01:29 +00:00
|
|
|
let browser;
|
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
|
|
|
await page.loginAndModule('employee', 'order');
|
2020-07-02 12:03:01 +00:00
|
|
|
await page.accessToSearchResult('8');
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.accessToSection('order.card.line');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
|
|
|
await browser.close();
|
2019-02-11 13:51:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the order subtotal', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2019-02-11 13:51:42 +00:00
|
|
|
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
|
|
|
|
2020-07-02 12:03:01 +00:00
|
|
|
expect(result).toContain('112.30');
|
2019-02-11 13:51:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should delete the first line in the order', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.orderLine.firstLineDeleteButton);
|
|
|
|
await page.waitToClick(selectors.orderLine.confirmButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-02-11 13:51:42 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2019-02-11 13:51:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the order subtotal has changed', async() => {
|
2020-07-02 12:03:01 +00:00
|
|
|
await page.waitForTextInElement(selectors.orderLine.orderSubtotal, '92.80');
|
2020-01-23 15:01:29 +00:00
|
|
|
const result = await page
|
2019-02-11 13:51:42 +00:00
|
|
|
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
|
|
|
|
|
2020-07-02 12:03:01 +00:00
|
|
|
expect(result).toContain('92.80');
|
2019-02-11 13:51:42 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => {
|
2020-01-23 15:01:29 +00:00
|
|
|
await page.waitToClick(selectors.orderLine.confirmOrder);
|
2019-02-11 13:51:42 +00:00
|
|
|
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.expectURL('ticket/index');
|
|
|
|
await page.expectURL('clientFk');
|
2019-02-11 13:51:42 +00:00
|
|
|
});
|
|
|
|
});
|