From 0a554afdb29a76256f8f50f53efeee807e1231f8 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Fri, 7 Feb 2020 15:42:11 +0100 Subject: [PATCH] 2007 e2e invoiceOut summary --- e2e/helpers/selectors.js | 7 ++- .../04_edit_billing_data.spec.js | 2 +- .../09-invoice-out-module/01_summary.spec.js | 49 +++++++++++++++++++ ...scriptor.spec.js => 02_descriptor.spec.js} | 0 modules/invoiceOut/front/summary/index.html | 2 +- .../invoiceOut/front/summary/locale/es.yml | 3 +- 6 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 e2e/paths/09-invoice-out-module/01_summary.spec.js rename e2e/paths/09-invoice-out-module/{01_descriptor.spec.js => 02_descriptor.spec.js} (100%) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d7e20018b..9f46384fd 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -735,6 +735,11 @@ export default { acceptBookingButton: '.vn-confirm.shown button[response="accept"]' }, invoiceOutSummary: { - bookedLabel: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-one > vn-label-value:nth-child(4) > section > span' + bookedLabel: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-one > vn-label-value:nth-child(4) > section > span', + company: 'vn-invoice-out-summary vn-label-value[label="Company"]', + taxOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-two > vn-table > div > vn-tbody > vn-tr:nth-child(1)', + taxTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-two > vn-table > div > vn-tbody > vn-tr:nth-child(2)', + ticketOne: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(1)', + ticketTwo: 'vn-invoice-out-summary > vn-card > vn-horizontal > vn-auto > vn-table > div > vn-tbody > vn-tr:nth-child(2)' } }; diff --git a/e2e/paths/02-client-module/04_edit_billing_data.spec.js b/e2e/paths/02-client-module/04_edit_billing_data.spec.js index 7e8df8aa8..b757940be 100644 --- a/e2e/paths/02-client-module/04_edit_billing_data.spec.js +++ b/e2e/paths/02-client-module/04_edit_billing_data.spec.js @@ -60,7 +60,7 @@ describe('Client Edit billing data path', () => { }); it(`should save the form with all its new data`, async() => { - await page.waitFor(2000); + await page.waitFor(3000); await page.waitForWatcherData(selectors.clientBillingData.watcher); await page.waitToClick(selectors.clientBillingData.saveButton); let snackbarMessage = await page.waitForLastSnackbar(); diff --git a/e2e/paths/09-invoice-out-module/01_summary.spec.js b/e2e/paths/09-invoice-out-module/01_summary.spec.js new file mode 100644 index 000000000..c67fc547e --- /dev/null +++ b/e2e/paths/09-invoice-out-module/01_summary.spec.js @@ -0,0 +1,49 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('InvoiceOut summary path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'invoiceOut'); + await page.accessToSearchResult('T1111111'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the summary section', async() => { + const result = await page.expectURL('/summary'); + + expect(result).toBe(true); + }); + + it('should contain the company from which the invoice is emited', async() => { + await page.waitForContentLoaded(); + const result = await page.waitToGetProperty(selectors.invoiceOutSummary.company, 'innerText'); + + expect(result).toEqual('Company VNL'); + }); + + it('should contain the tax breakdown', async() => { + const firstTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxOne, 'innerText'); + + const secondTax = await page.waitToGetProperty(selectors.invoiceOutSummary.taxTwo, 'innerText'); + + expect(firstTax).toContain('10%'); + expect(secondTax).toContain('21%'); + }); + + it('should contain the tickets info', async() => { + const firstTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketOne, 'innerText'); + + const secondTicket = await page.waitToGetProperty(selectors.invoiceOutSummary.ticketTwo, 'innerText'); + + expect(firstTicket).toContain('Bat cave'); + expect(secondTicket).toContain('Stark tower'); + }); +}); diff --git a/e2e/paths/09-invoice-out-module/01_descriptor.spec.js b/e2e/paths/09-invoice-out-module/02_descriptor.spec.js similarity index 100% rename from e2e/paths/09-invoice-out-module/01_descriptor.spec.js rename to e2e/paths/09-invoice-out-module/02_descriptor.spec.js diff --git a/modules/invoiceOut/front/summary/index.html b/modules/invoiceOut/front/summary/index.html index 990957079..19ceeb3ab 100644 --- a/modules/invoiceOut/front/summary/index.html +++ b/modules/invoiceOut/front/summary/index.html @@ -19,7 +19,7 @@ -

Desglose impositivo

+

Tax breakdown

diff --git a/modules/invoiceOut/front/summary/locale/es.yml b/modules/invoiceOut/front/summary/locale/es.yml index d1b4a2406..f79a23093 100644 --- a/modules/invoiceOut/front/summary/locale/es.yml +++ b/modules/invoiceOut/front/summary/locale/es.yml @@ -8,4 +8,5 @@ Shipped: F. envĂ­o Type: Tipo Rate: Tasa Fee: Cuota -Taxable base: Base imp. \ No newline at end of file +Taxable base: Base imp. +Tax breakdown: Desglose impositivo \ No newline at end of file