From 6f0d9c31bbf41ef4be8e0f01d3498c79c6c30a4d Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Fri, 2 Mar 2018 14:45:54 +0100 Subject: [PATCH] e2e path for client invoices #111 --- e2e/paths/client-module/13_invoices.spec.js | 58 +++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 e2e/paths/client-module/13_invoices.spec.js diff --git a/e2e/paths/client-module/13_invoices.spec.js b/e2e/paths/client-module/13_invoices.spec.js new file mode 100644 index 0000000000..2c5f60bee4 --- /dev/null +++ b/e2e/paths/client-module/13_invoices.spec.js @@ -0,0 +1,58 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/helpers'; + +describe('mandate path', () => { + const nightmare = createNightmare(); + + beforeAll(() => { + return nightmare + .waitForLogin('developer'); + }); + + it('should click on the Clients button of the top bar menu', () => { + return nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/clients'); + }); + }); + + it('should search for the user Petter Parker', () => { + return nightmare + .wait(selectors.clientsIndex.searchResult) + .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') + .click(selectors.clientsIndex.searchButton) + .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) + .countSearchResults(selectors.clientsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the client invoices`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientInvoices.invoicesButton) + .waitForURL('invoices') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('invoices'); + }); + }); + + it('should confirm the client has an invoice', () => { + return nightmare + .wait(selectors.clientInvoices.firstInvoiceText) + .getInnerText(selectors.clientInvoices.firstInvoiceText) + .then(value => { + expect(value).toContain('V1800001'); + expect(value).toContain('02/03/2018'); + expect(value).toContain('350.50'); + }); + }); +});