salix/e2e/paths/07-order/01_summary.spec.js

47 lines
1.7 KiB
JavaScript
Raw Permalink Normal View History

2020-03-03 09:26:16 +00:00
import getBrowser from '../../helpers/puppeteer';
2023-05-08 10:03:27 +00:00
const $ = {
id: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(1) span',
alias: 'vn-order-summary vn-one:nth-child(1) > vn-label-value:nth-child(2) span',
consignee: 'vn-order-summary vn-one:nth-child(2) > vn-label-value:nth-child(6) span',
subtotal: 'vn-order-summary vn-one.taxes > p:nth-child(1)',
vat: 'vn-order-summary vn-one.taxes > p:nth-child(2)',
total: 'vn-order-summary vn-one.taxes > p:nth-child(3)',
sale: 'vn-order-summary vn-tbody > vn-tr',
};
2020-03-03 09:26:16 +00:00
describe('Order summary path', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('employee', 'order');
await page.accessToSearchResult('16');
});
afterAll(async() => {
await browser.close();
});
2023-05-08 10:03:27 +00:00
it('should reach the order summary section and check data', async() => {
await page.waitForState('order.card.summary');
2020-03-03 09:26:16 +00:00
2023-05-08 10:03:27 +00:00
const id = await page.innerText($.id);
const alias = await page.innerText($.alias);
const consignee = await page.innerText($.consignee);
const subtotal = await page.innerText($.subtotal);
const vat = await page.innerText($.vat);
const total = await page.innerText($.total);
const sale = await page.countElement($.sale);
expect(id).toEqual('16');
expect(alias).toEqual('Many places');
expect(consignee).toEqual('address 26 - Gotham (Province one)');
expect(subtotal.length).toBeGreaterThan(1);
expect(vat.length).toBeGreaterThan(1);
expect(total.length).toBeGreaterThan(1);
expect(sale).toBeGreaterThan(0);
2020-03-03 09:26:16 +00:00
});
});