salix/e2e/paths/07-order/03_lines.spec.js

49 lines
1.6 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2020-01-28 10:59:36 +00:00
describe('Order lines', () => {
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');
await page.accessToSection('order.card.line');
});
afterAll(async() => {
await browser.close();
});
it('should check the order subtotal', async() => {
const result = await page
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
2020-07-02 12:03:01 +00:00
expect(result).toContain('112.30');
});
it('should delete the first line in the order', async() => {
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();
2020-10-30 16:09:11 +00:00
expect(message.text).toBe('Data saved!');
});
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');
const result = await page
.waitToGetProperty(selectors.orderLine.orderSubtotal, 'innerText');
2020-07-02 12:03:01 +00:00
expect(result).toContain('92.80');
});
it('should confirm the whole order and redirect to ticket index filtered by clientFk', async() => {
await page.waitToClick(selectors.orderLine.confirmOrder);
await page.expectURL('ticket/index');
await page.expectURL('clientFk');
});
});