import getBrowser from '../../helpers/puppeteer'; 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', }; 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(); }); it('should reach the order summary section and check data', async() => { await page.waitForState('order.card.summary'); 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); }); });