refactor e2e
This commit is contained in:
parent
20de81a3c8
commit
e03332bc5c
|
@ -10,92 +10,78 @@ describe('Client lock verified data path', () => {
|
||||||
.waitForLogin('salesPerson');
|
.waitForLogin('salesPerson');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should click on the Clients button of the top bar menu', done => {
|
it('should click on the Clients button of the top bar menu', async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
.waitToClick(selectors.globalItems.clientsButton)
|
.waitToClick(selectors.globalItems.clientsButton)
|
||||||
.wait(selectors.clientsIndex.createClientButton)
|
.wait(selectors.clientsIndex.createClientButton)
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toEqual('#!/client/index');
|
expect(url.hash).toEqual('#!/client/index');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search for the user Petter Parker', done => {
|
it('should search for the user Petter Parker', async () => {
|
||||||
return nightmare
|
const resultCount = await nightmare
|
||||||
.wait(selectors.clientsIndex.searchResult)
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
.click(selectors.clientsIndex.searchButton)
|
.click(selectors.clientsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||||
.countElement(selectors.clientsIndex.searchResult)
|
.countElement(selectors.clientsIndex.searchResult);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the client's fiscal data`, done => {
|
it(`should click on the search result to access to the client's fiscal data`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
.waitToClick(selectors.clientsIndex.searchResult)
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the fiscal data button to start editing`, done => {
|
it(`should click on the fiscal data button to start editing`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is disabled for salesPerson', done => {
|
it('should confirm verified data button is disabled for salesPerson', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
.evaluate(selector => {
|
.evaluate((selector) => {
|
||||||
return document.querySelector(selector).disabled;
|
return document.querySelector(selector).disabled;
|
||||||
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
}, selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.then(result => {
|
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should edit the social name', done => {
|
it('should edit the social name', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||||
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
|
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
|
||||||
.click(selectors.clientFiscalData.saveButton)
|
.click(selectors.clientFiscalData.saveButton)
|
||||||
.waitForLastSnackbar()
|
.waitForLastSnackbar();
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the social name have been edited', done => {
|
it('should confirm the social name have been edited', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||||
.wait(selectors.clientBasicData.nameInput)
|
.wait(selectors.clientBasicData.nameInput)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
.getInputValue(selectors.clientFiscalData.socialNameInput);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual('salesPerson was here');
|
expect(result).toEqual('salesPerson was here');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -106,118 +92,100 @@ describe('Client lock verified data path', () => {
|
||||||
.waitForLogin('administrative');
|
.waitForLogin('administrative');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should navigate to clients index', done => {
|
it('should navigate to clients index', async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
.waitToClick(selectors.globalItems.clientsButton)
|
.waitToClick(selectors.globalItems.clientsButton)
|
||||||
.wait(selectors.clientsIndex.createClientButton)
|
.wait(selectors.clientsIndex.createClientButton)
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toEqual('#!/client/index');
|
expect(url.hash).toEqual('#!/client/index');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should search again for the user Petter Parker', done => {
|
it('should search again for the user Petter Parker', async () => {
|
||||||
return nightmare
|
const resultCount = await nightmare
|
||||||
.wait(selectors.clientsIndex.searchResult)
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
.click(selectors.clientsIndex.searchButton)
|
.click(selectors.clientsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||||
.countElement(selectors.clientsIndex.searchResult)
|
.countElement(selectors.clientsIndex.searchResult);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the Petter Parkers fiscal data`, done => {
|
it(`should click on the search result to access to the Petter Parkers fiscal data`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
.waitToClick(selectors.clientsIndex.searchResult)
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the fiscal data button`, done => {
|
it(`should click on the fiscal data button`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is enabled for administrative', done => {
|
it('should confirm verified data button is enabled for administrative', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
.evaluate(selector => {
|
.evaluate((selector) => {
|
||||||
return document.querySelector(selector).disabled;
|
return document.querySelector(selector).disabled;
|
||||||
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
}, selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.then(result => {
|
|
||||||
expect(result).not.toBeTruthy();
|
expect(result).not.toBeTruthy();
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should check the Verified data checkbox', done => {
|
it('should check the Verified data checkbox', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
.waitToClick(selectors.clientFiscalData.saveButton)
|
.waitToClick(selectors.clientFiscalData.saveButton)
|
||||||
.waitForLastSnackbar()
|
.waitForLastSnackbar();
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm Verified data checkbox is checked', done => {
|
it('should confirm Verified data checkbox is checked', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||||
.wait(selectors.clientBasicData.nameInput)
|
.wait(selectors.clientBasicData.nameInput)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
.evaluate(selector => {
|
.evaluate((selector) => {
|
||||||
return document.querySelector(selector).checked;
|
return document.querySelector(selector).checked;
|
||||||
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
|
}, selectors.clientFiscalData.verifiedDataCheckboxInput);
|
||||||
.then(value => {
|
|
||||||
expect(value).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again edit the social name', done => {
|
it('should again edit the social name', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||||
.type(selectors.clientFiscalData.socialNameInput, 'administrative was here')
|
.type(selectors.clientFiscalData.socialNameInput, 'administrative was here')
|
||||||
.click(selectors.clientFiscalData.saveButton)
|
.click(selectors.clientFiscalData.saveButton)
|
||||||
.waitForLastSnackbar()
|
.waitForLastSnackbar();
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again confirm the social name have been edited', done => {
|
it('should again confirm the social name have been edited', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||||
.wait(selectors.clientBasicData.nameInput)
|
.wait(selectors.clientBasicData.nameInput)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
.getInputValue(selectors.clientFiscalData.socialNameInput);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual('administrative was here');
|
expect(result).toEqual('administrative was here');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -228,79 +196,67 @@ describe('Client lock verified data path', () => {
|
||||||
.waitForLogin('salesPerson');
|
.waitForLogin('salesPerson');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again click on the Clients button of the top bar menu', done => {
|
it('should again click on the Clients button of the top bar menu', async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
.waitToClick(selectors.globalItems.clientsButton)
|
.waitToClick(selectors.globalItems.clientsButton)
|
||||||
.wait(selectors.clientsIndex.createClientButton)
|
.wait(selectors.clientsIndex.createClientButton)
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toEqual('#!/client/index');
|
expect(url.hash).toEqual('#!/client/index');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should again search for the user Petter Parker', done => {
|
it('should again search for the user Petter Parker', async () => {
|
||||||
return nightmare
|
const resultCount = await nightmare
|
||||||
.wait(selectors.clientsIndex.searchResult)
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
.click(selectors.clientsIndex.searchButton)
|
.click(selectors.clientsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||||
.countElement(selectors.clientsIndex.searchResult)
|
.countElement(selectors.clientsIndex.searchResult);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the client's fiscal data`, done => {
|
it(`should click on the search result to access to the client's fiscal data`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
.waitToClick(selectors.clientsIndex.searchResult)
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the fiscal data button to start editing`, done => {
|
it(`should click on the fiscal data button to start editing`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is disabled once again for salesPerson', done => {
|
it('should confirm verified data button is disabled once again for salesPerson', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
.evaluate(selector => {
|
.evaluate((selector) => {
|
||||||
return document.querySelector(selector).disabled;
|
return document.querySelector(selector).disabled;
|
||||||
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
}, selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.then(result => {
|
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not be able to save change throwing a verified data error', done => {
|
it('should not be able to save change throwing a verified data error', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||||
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
|
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
|
||||||
.click(selectors.clientFiscalData.saveButton)
|
.click(selectors.clientFiscalData.saveButton)
|
||||||
.waitForSnackbar()
|
.waitForSnackbar();
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -311,92 +267,78 @@ describe('Client lock verified data path', () => {
|
||||||
.waitForLogin('salesAssistant');
|
.waitForLogin('salesAssistant');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now navigate to clients index', done => {
|
it('should now navigate to clients index', async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
.waitToClick(selectors.globalItems.clientsButton)
|
.waitToClick(selectors.globalItems.clientsButton)
|
||||||
.wait(selectors.clientsIndex.createClientButton)
|
.wait(selectors.clientsIndex.createClientButton)
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toEqual('#!/client/index');
|
expect(url.hash).toEqual('#!/client/index');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now search again for the user Petter Parker', done => {
|
it('should now search again for the user Petter Parker', async () => {
|
||||||
return nightmare
|
const resultCount = await nightmare
|
||||||
.wait(selectors.clientsIndex.searchResult)
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
.click(selectors.clientsIndex.searchButton)
|
.click(selectors.clientsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||||
.countElement(selectors.clientsIndex.searchResult)
|
.countElement(selectors.clientsIndex.searchResult);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the Petter Parkers fiscal data`, done => {
|
it(`should click on the search result to access to the Petter Parkers fiscal data`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
.waitToClick(selectors.clientsIndex.searchResult)
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the fiscal data button`, done => {
|
it(`should click on the fiscal data button`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is disabled for salesAssistant', done => {
|
it('should confirm verified data button is disabled for salesAssistant', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
.evaluate(selector => {
|
.evaluate((selector) => {
|
||||||
return document.querySelector(selector).disabled;
|
return document.querySelector(selector).disabled;
|
||||||
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
}, selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.then(result => {
|
|
||||||
expect(result).toBeTruthy();
|
expect(result).toBeTruthy();
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now edit the social name', done => {
|
it('should now edit the social name', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||||
.type(selectors.clientFiscalData.socialNameInput, 'salesAssistant was here')
|
.type(selectors.clientFiscalData.socialNameInput, 'salesAssistant was here')
|
||||||
.click(selectors.clientFiscalData.saveButton)
|
.click(selectors.clientFiscalData.saveButton)
|
||||||
.waitForLastSnackbar()
|
.waitForLastSnackbar();
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual('Data saved!');
|
expect(result).toEqual('Data saved!');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now confirm the social name have been edited once and for all', done => {
|
it('should now confirm the social name have been edited once and for all', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.waitToClick(selectors.clientBasicData.basicDataButton)
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
||||||
.wait(selectors.clientBasicData.nameInput)
|
.wait(selectors.clientBasicData.nameInput)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
.getInputValue(selectors.clientFiscalData.socialNameInput);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual('salesAssistant was here');
|
expect(result).toEqual('salesAssistant was here');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -407,78 +349,66 @@ describe('Client lock verified data path', () => {
|
||||||
.waitForLogin('salesPerson');
|
.waitForLogin('salesPerson');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should now click on the Clients button of the top bar menu', done => {
|
it('should now click on the Clients button of the top bar menu', async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
||||||
.wait(selectors.globalItems.applicationsMenuVisible)
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
||||||
.waitToClick(selectors.globalItems.clientsButton)
|
.waitToClick(selectors.globalItems.clientsButton)
|
||||||
.wait(selectors.clientsIndex.createClientButton)
|
.wait(selectors.clientsIndex.createClientButton)
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toEqual('#!/client/index');
|
expect(url.hash).toEqual('#!/client/index');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should once again search for the user Petter Parker', done => {
|
it('should once again search for the user Petter Parker', async () => {
|
||||||
return nightmare
|
const resultCount = await nightmare
|
||||||
.wait(selectors.clientsIndex.searchResult)
|
.wait(selectors.clientsIndex.searchResult)
|
||||||
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
||||||
.click(selectors.clientsIndex.searchButton)
|
.click(selectors.clientsIndex.searchButton)
|
||||||
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
||||||
.countElement(selectors.clientsIndex.searchResult)
|
.countElement(selectors.clientsIndex.searchResult);
|
||||||
.then(result => {
|
|
||||||
expect(result).toEqual(1);
|
expect(resultCount).toEqual(1);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the search result to access to the client's fiscal data`, done => {
|
it(`should click on the search result to access to the client's fiscal data`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
||||||
.waitToClick(selectors.clientsIndex.searchResult)
|
.waitToClick(selectors.clientsIndex.searchResult)
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it(`should click on the fiscal data button to start editing`, done => {
|
it(`should click on the fiscal data button to start editing`, async () => {
|
||||||
return nightmare
|
const url = await nightmare
|
||||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||||
.waitForURL('fiscal-data')
|
.waitForURL('fiscal-data')
|
||||||
.parsedUrl()
|
.parsedUrl();
|
||||||
.then(url => {
|
|
||||||
expect(url.hash).toContain('fiscal-data');
|
expect(url.hash).toContain('fiscal-data');
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm verified data button is enabled once again', done => {
|
it('should confirm verified data button is enabled once again', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||||
.evaluate(selector => {
|
.evaluate((selector) => {
|
||||||
return document.querySelector(selector).disabled;
|
return document.querySelector(selector).disabled;
|
||||||
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
}, selectors.clientFiscalData.verifiedDataCheckbox);
|
||||||
.then(result => {
|
|
||||||
expect(result).toBe(true);
|
expect(result).toBe(true);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the form is enabled for salesPerson', done => {
|
it('should confirm the form is enabled for salesPerson', async () => {
|
||||||
return nightmare
|
const result = await nightmare
|
||||||
.wait(selectors.clientFiscalData.socialNameInput)
|
.wait(selectors.clientFiscalData.socialNameInput)
|
||||||
.evaluate(selector => {
|
.evaluate((selector) => {
|
||||||
return document.querySelector(selector).disabled;
|
return document.querySelector(selector).disabled;
|
||||||
}, 'vn-textfield[field="$ctrl.client.socialName"] > div')
|
}, 'vn-textfield[field="$ctrl.client.socialName"] > div');
|
||||||
.then(result => {
|
|
||||||
expect(result).not.toBe(true);
|
expect(result).not.toBe(true);
|
||||||
done();
|
|
||||||
}).catch(done.fail);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue