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'); expect(result).toEqual('administrative was here');
}); });
}); });
});
describe('as salesPerson second run', () => { describe('as salesPerson second run', () => {
beforeAll(() => { beforeAll(() => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.logOutButton) .waitToClick(selectors.globalItems.logOutButton)
.waitForLogin('salesPerson'); .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', () => { it('should again search for the user Petter Parker', () => {
return nightmare return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton) .wait(selectors.clientsIndex.searchResult)
.wait(selectors.globalItems.applicationsMenuVisible) .type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.waitToClick(selectors.globalItems.clientsButton) .click(selectors.clientsIndex.searchButton)
.wait(selectors.clientsIndex.createClientButton) .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.parsedUrl() .countSearchResults(selectors.clientsIndex.searchResult)
.then(url => { .then(result => {
expect(url.hash).toEqual('#!/clients'); expect(result).toEqual(1);
});
}); });
});
it('should again search for the user Petter Parker', () => { it(`should click on the search result to access to the client's fiscal data`, () => {
return nightmare return nightmare
.wait(selectors.clientsIndex.searchResult) .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker') .waitToClick(selectors.clientsIndex.searchResult)
.click(selectors.clientsIndex.searchButton) .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) .waitForURL('fiscal-data')
.countSearchResults(selectors.clientsIndex.searchResult) .parsedUrl()
.then(result => { .then(url => {
expect(result).toEqual(1); expect(url.hash).toContain('fiscal-data');
});
}); });
});
it(`should click on the search result to access to the client's fiscal data`, () => { it(`should click on the fiscal data button to start editing`, () => {
return nightmare return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitToClick(selectors.clientsIndex.searchResult) .waitForURL('fiscal-data')
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .parsedUrl()
.waitForURL('fiscal-data') .then(url => {
.parsedUrl() expect(url.hash).toContain('fiscal-data');
.then(url => {
expect(url.hash).toContain('fiscal-data');
});
}); });
});
it(`should click on the fiscal data button to start editing`, () => { it('should confirm verified data button is disabled once again for salesPerson', () => {
return nightmare return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton) .wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.waitForURL('fiscal-data') .evaluate(selector => {
.parsedUrl() return document.querySelector(selector).className;
.then(url => { }, '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')
expect(url.hash).toContain('fiscal-data'); .then(result => {
}); expect(result).toContain('is-disabled');
}); });
});
it('should confirm verified data button is disabled once again for salesPerson', () => { it('should confirm the form have been disabled for salesPerson', () => {
return nightmare return nightmare
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .wait(selectors.clientFiscalData.socialNameInput)
.evaluate(selector => { .evaluate(selector => {
return document.querySelector(selector).className; 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') }, 'vn-textfield[field="$ctrl.client.socialName"] > div')
.then(result => { .then(result => {
expect(result).toContain('is-disabled'); 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');
});
}); });
}); });
}); });