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');
|
|
|
|
await page.accessToSearchResult('16');
|
|
|
|
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');
|
|
|
|
|
|
|
|
expect(result).toContain('135.60');
|
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-02-11 13:51:42 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should confirm the order subtotal has changed', 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');
|
|
|
|
|
|
|
|
expect(result).toContain('90.10');
|
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
await page.waitForURL('ticket/index');
|
|
|
|
const url = await page.parsedUrl();
|
2019-02-11 13:51:42 +00:00
|
|
|
|
|
|
|
expect(url.hash).toContain('ticket/index');
|
|
|
|
expect(url.hash).toContain('clientFk');
|
|
|
|
});
|
|
|
|
});
|