part of the task #145 corrected lock of verified data nested callbacks

This commit is contained in:
Carlos Jimenez 2018-03-05 12:28:59 +01:00
parent c2017f85e8
commit 1f978828f7
1 changed files with 63 additions and 63 deletions

View File

@ -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');
});
});
});