From f7dc279489e0dffe5dd25ac33edfd383c3a78847 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez Ruiz Date: Thu, 13 Feb 2020 09:47:05 +0100 Subject: [PATCH] #2002 e2e client.summary --- e2e/helpers/selectors.js | 11 ++++ e2e/paths/02-client/19_summary.spec.js | 80 ++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 e2e/paths/02-client/19_summary.spec.js diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 564745752..63d40f9d5 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -27,6 +27,17 @@ export default { createClientButton: `vn-float-button`, othersButton: 'vn-left-menu li[name="Others"] > a' }, + clientSummary: { + header: 'vn-client-summary > vn-card > h5', + email: 'vn-client-summary vn-label-value[label="Email"]', + street: 'vn-client-summary vn-label-value[label="Street"]', + verifiedData: 'vn-client-summary > vn-card > vn-horizontal vn-check[ng-model="$ctrl.summary.isTaxDataChecked"]', + payMethod: 'vn-client-summary vn-label-value[label="Pay method"]', + defaultAdressName: 'vn-client-summary vn-label-value[label="Name"]', + userName: 'vn-client-summary vn-label-value[label="User"]', + rate: 'vn-client-summary vn-label-value[label="Rate"]', + credit: 'vn-client-summary vn-label-value[label="Credit"]', + }, createClientView: { name: 'vn-client-create vn-textfield[ng-model="$ctrl.client.name"]', taxNumber: 'vn-client-create vn-textfield[ng-model="$ctrl.client.fi"]', diff --git a/e2e/paths/02-client/19_summary.spec.js b/e2e/paths/02-client/19_summary.spec.js new file mode 100644 index 000000000..11b5a298e --- /dev/null +++ b/e2e/paths/02-client/19_summary.spec.js @@ -0,0 +1,80 @@ +import selectors from '../../helpers/selectors.js'; +import getBrowser from '../../helpers/puppeteer'; + +describe('Client summary path', () => { + let browser; + let page; + + beforeAll(async() => { + browser = await getBrowser(); + page = browser.page; + await page.loginAndModule('employee', 'client'); + await page.accessToSearchResult('Petter Parker'); + }); + + afterAll(async() => { + await browser.close(); + }); + + it('should reach the first route summary section', async() => { + let url = await page.expectURL('#!/client/102/summary'); + + expect(url).toBe(true); + }); + + it('should display details from the client on the header', async() => { + await page.waitForTextInElement(selectors.clientSummary.header, 'Petter Parker'); + const result = await page.waitToGetProperty(selectors.clientSummary.header, 'innerText'); + + expect(result).toContain('Petter Parker'); + }); + + it('should display some basic data', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.email, 'innerText'); + + expect(result).toContain('PetterParker@mydomain.com'); + }); + + it('should display fiscal address details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.street, 'innerText'); + + expect(result).toContain('20 Ingram Street'); + }); + + it('should display some fiscal data', async() => { + await page.waitForClassPresent(selectors.clientSummary.verifiedData, 'checked'); + const result = await page.waitToGetProperty(selectors.clientSummary.verifiedData, 'innerText'); + + expect(result).toContain('Verified data'); + }); + + it('should display pay method details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.payMethod, 'innerText'); + + expect(result).toContain('PayMethod five'); + }); + + it('should display default address details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.defaultAdressName, 'innerText'); + + expect(result).toContain('Petter Parker'); + }); + + it('should display web access details', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.userName, 'innerText'); + + expect(result).toContain('PetterParker'); + }); + + it('should display business data', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.rate, 'innerText'); + + expect(result).toContain('%'); + }); + + it('should display financial information', async() => { + const result = await page.waitToGetProperty(selectors.clientSummary.credit, 'innerText'); + + expect(result).toContain('€300.00'); + }); +});