diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 8bd4d0ce8..0bf363a0c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -631,6 +631,16 @@ export default { createButton: 'button[type=submit]', cancelButton: 'vn-button[href="#!/client/index"]' }, + orderSummary: { + header: 'vn-order-summary h5', + 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(3) 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', + }, orderCatalog: { plantRealmButton: 'vn-order-catalog > vn-side-menu vn-icon[icon="icon-plant"]', type: 'vn-autocomplete[data="$ctrl.itemTypes"]', diff --git a/e2e/paths/07-order/01_summary.spec.js b/e2e/paths/07-order/01_summary.spec.js new file mode 100644 index 000000000..cba56bf70 --- /dev/null +++ b/e2e/paths/07-order/01_summary.spec.js @@ -0,0 +1,65 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +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', async() => { + const url = await page.expectURL('#!/order/16/summary'); + + expect(url).toBe(true); + }); + + it('should check the summary contains the order id', async() => { + const result = await page.waitToGetProperty(selectors.orderSummary.id, 'innerText'); + + expect(result).toEqual('16'); + }); + + it('should check the summary contains the order alias', async() => { + const result = await page.waitToGetProperty(selectors.orderSummary.alias, 'innerText'); + + expect(result).toEqual('address 26'); + }); + + it('should check the summary contains the order consignee', async() => { + const result = await page.waitToGetProperty(selectors.orderSummary.consignee, 'innerText'); + + expect(result).toEqual('Many places - Silla (Province one)'); + }); + + it('should check the summary contains the order subtotal', async() => { + const result = await page.waitToGetProperty(selectors.orderSummary.subtotal, 'innerText'); + + expect(result.length).toBeGreaterThan(1); + }); + + it('should check the summary contains the order vat', async() => { + const result = await page.waitToGetProperty(selectors.orderSummary.vat, 'innerText'); + + expect(result.length).toBeGreaterThan(1); + }); + + it('should check the summary contains the order total', async() => { + const result = await page.waitToGetProperty(selectors.orderSummary.total, 'innerText'); + + expect(result.length).toBeGreaterThan(1); + }); + + it('should check the summary contains the order sales', async() => { + const result = await page.countElement(selectors.orderSummary.sale); + + expect(result).toBeGreaterThan(0); + }); +}); diff --git a/e2e/paths/07-order/01_edit_basic_data.spec.js b/e2e/paths/07-order/02_basic_data.spec.js similarity index 100% rename from e2e/paths/07-order/01_edit_basic_data.spec.js rename to e2e/paths/07-order/02_basic_data.spec.js diff --git a/e2e/paths/07-order/02_catalog.spec.js b/e2e/paths/07-order/04_catalog.spec.js similarity index 100% rename from e2e/paths/07-order/02_catalog.spec.js rename to e2e/paths/07-order/04_catalog.spec.js diff --git a/e2e/paths/10-travel/02_basic_data_and_log.spec.js b/e2e/paths/10-travel/02_basic_data_and_log.spec.js index 2b3395e85..a835df2a2 100644 --- a/e2e/paths/10-travel/02_basic_data_and_log.spec.js +++ b/e2e/paths/10-travel/02_basic_data_and_log.spec.js @@ -42,7 +42,7 @@ describe('Travel basic data path', () => { it('should now edit the whole form then save', async() => { await page.clearInput(selectors.travelBasicDada.reference); await page.write(selectors.travelBasicDada.reference, 'new reference!'); - await page.waitForContentLoaded(); // this test fails some times to autocomplete the agency underneath + await page.waitFor(2000); await page.autocompleteSearch(selectors.travelBasicDada.agency, 'Entanglement'); await page.autocompleteSearch(selectors.travelBasicDada.outputWarehouse, 'Warehouse Three'); await page.autocompleteSearch(selectors.travelBasicDada.inputWarehouse, 'Warehouse Four');