From 1f978828f7223eca65cceb29724f1a24807edb75 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 5 Mar 2018 12:28:59 +0100 Subject: [PATCH] part of the task #145 corrected lock of verified data nested callbacks --- .../12_lock_of_verified_data.spec.js | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/e2e/paths/client-module/12_lock_of_verified_data.spec.js b/e2e/paths/client-module/12_lock_of_verified_data.spec.js index bcc960b4f..a3d8a3dae 100644 --- a/e2e/paths/client-module/12_lock_of_verified_data.spec.js +++ b/e2e/paths/client-module/12_lock_of_verified_data.spec.js @@ -203,80 +203,80 @@ describe('lock verified data path', () => { expect(result).toEqual('administrative was here'); }); }); + }); - describe('as salesPerson second run', () => { - beforeAll(() => { - return nightmare - .waitToClick(selectors.globalItems.logOutButton) - .waitForLogin('salesPerson'); + describe('as salesPerson second run', () => { + beforeAll(() => { + return nightmare + .waitToClick(selectors.globalItems.logOutButton) + .waitForLogin('salesPerson'); + }); + + it('should again 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 again 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 again 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 again 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's fiscal data`, () => { + return nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); }); + }); - it(`should click on the search result to access to the client's fiscal data`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); + it(`should click on the fiscal data button to start editing`, () => { + return nightmare + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .waitForURL('fiscal-data') + .parsedUrl() + .then(url => { + expect(url.hash).toContain('fiscal-data'); }); + }); - it(`should click on the fiscal data button to start editing`, () => { - return nightmare - .waitToClick(selectors.clientFiscalData.fiscalDataButton) - .waitForURL('fiscal-data') - .parsedUrl() - .then(url => { - expect(url.hash).toContain('fiscal-data'); - }); + it('should confirm verified data button is disabled once again for salesPerson', () => { + return nightmare + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') + .then(result => { + expect(result).toContain('is-disabled'); }); + }); - it('should confirm verified data button is disabled once again for salesPerson', () => { - return nightmare - .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > form > vn-card > div > vn-horizontal:nth-child(5) > vn-check:nth-child(3) > label') - .then(result => { - expect(result).toContain('is-disabled'); - }); - }); - - it('should confirm the form have been disabled for salesPerson', () => { - return nightmare - .wait(selectors.clientFiscalData.socialNameInput) - .evaluate(selector => { - return document.querySelector(selector).className; - }, 'vn-textfield[field="$ctrl.client.socialName"] > div') - .then(result => { - expect(result).toContain('is-disabled'); - }); + it('should confirm the form have been disabled for salesPerson', () => { + return nightmare + .wait(selectors.clientFiscalData.socialNameInput) + .evaluate(selector => { + return document.querySelector(selector).className; + }, 'vn-textfield[field="$ctrl.client.socialName"] > div') + .then(result => { + expect(result).toContain('is-disabled'); }); }); });