2018-03-02 13:45:22 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
|
2018-09-05 06:24:15 +00:00
|
|
|
describe('Client lock verified data path', () => {
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
describe('as salesPerson', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('salesPerson');
|
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should click on the Clients button of the top bar menu', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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('#!/client/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search for the user Petter Parker', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the client's fiscal data`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the fiscal data button to start editing`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.waitForURL('fiscal-data')
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
|
|
|
expect(url.hash).toContain('fiscal-data');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm verified data button is disabled for salesPerson', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
|
|
|
.then(result => {
|
2018-10-20 10:07:48 +00:00
|
|
|
expect(result).toBeTruthy();
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should edit the social name', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
|
|
|
|
.click(selectors.clientFiscalData.saveButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-05 06:24:15 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the social name have been edited', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('salesPerson was here');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as administrative', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.globalItems.logOutButton)
|
|
|
|
.waitForLogin('administrative');
|
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should navigate to clients index', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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('#!/client/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should search again for the user Petter Parker', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the Petter Parkers fiscal data`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the fiscal data button`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.waitForURL('fiscal-data')
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
|
|
|
expect(url.hash).toContain('fiscal-data');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm verified data button is enabled for administrative', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
|
|
|
.then(result => {
|
2018-10-20 10:07:48 +00:00
|
|
|
expect(result).not.toBeTruthy();
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should check the Verified data checkbox', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.waitToClick(selectors.clientFiscalData.saveButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-05 06:24:15 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm Verified data checkbox is checked', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).checked;
|
|
|
|
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.then(value => {
|
|
|
|
expect(value).toBeTruthy();
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should again edit the social name', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.type(selectors.clientFiscalData.socialNameInput, 'administrative was here')
|
|
|
|
.click(selectors.clientFiscalData.saveButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-05 06:24:15 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should again confirm the social name have been edited', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('administrative was here');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as salesPerson second run', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.globalItems.logOutButton)
|
|
|
|
.waitForLogin('salesPerson');
|
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should again click on the Clients button of the top bar menu', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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('#!/client/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should again search for the user Petter Parker', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the client's fiscal data`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the fiscal data button to start editing`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.waitForURL('fiscal-data')
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
|
|
|
expect(url.hash).toContain('fiscal-data');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm verified data button is disabled once again for salesPerson', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toBe(true);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-23 09:25:51 +00:00
|
|
|
it('should not be able to save change throwing a verified data error', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
2018-10-23 09:25:51 +00:00
|
|
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.type(selectors.clientFiscalData.socialNameInput, 'salesPerson was here')
|
|
|
|
.click(selectors.clientFiscalData.saveButton)
|
|
|
|
.waitForSnackbar()
|
2018-09-05 06:24:15 +00:00
|
|
|
.then(result => {
|
2018-10-23 09:25:51 +00:00
|
|
|
expect(result).toEqual(jasmine.arrayContaining([`You can't make changes on a client with verified data`]));
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as salesAssistant', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.globalItems.logOutButton)
|
|
|
|
.waitForLogin('salesAssistant');
|
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should now navigate to clients index', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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('#!/client/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should now search again for the user Petter Parker', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the Petter Parkers fiscal data`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the fiscal data button`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.waitForURL('fiscal-data')
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
|
|
|
expect(url.hash).toContain('fiscal-data');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-23 09:25:51 +00:00
|
|
|
it('should confirm verified data button is disabled for salesAssistant', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
|
|
|
.then(result => {
|
2018-10-23 09:25:51 +00:00
|
|
|
expect(result).toBeTruthy();
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should now edit the social name', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.clearInput(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.type(selectors.clientFiscalData.socialNameInput, 'salesAssistant was here')
|
|
|
|
.click(selectors.clientFiscalData.saveButton)
|
2018-09-17 08:50:15 +00:00
|
|
|
.waitForLastSnackbar()
|
2018-09-05 06:24:15 +00:00
|
|
|
.then(result => {
|
2018-09-17 08:50:15 +00:00
|
|
|
expect(result).toEqual('Data saved!');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should now confirm the social name have been edited once and for all', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientBasicData.basicDataButton)
|
|
|
|
.wait(selectors.clientBasicData.nameInput)
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual('salesAssistant was here');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('as salesPerson third run', () => {
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.globalItems.logOutButton)
|
|
|
|
.waitForLogin('salesPerson');
|
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should now click on the Clients button of the top bar menu', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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('#!/client/index');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should once again search for the user Petter Parker', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the search result to access to the client's fiscal data`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
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');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it(`should click on the fiscal data button to start editing`, done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
|
|
|
.waitForURL('fiscal-data')
|
|
|
|
.parsedUrl()
|
|
|
|
.then(url => {
|
|
|
|
expect(url.hash).toContain('fiscal-data');
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm verified data button is enabled once again', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, selectors.clientFiscalData.verifiedDataCheckbox)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toBe(true);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-09-05 06:24:15 +00:00
|
|
|
});
|
|
|
|
|
2018-10-22 15:12:41 +00:00
|
|
|
it('should confirm the form is enabled for salesPerson', done => {
|
2018-09-05 06:24:15 +00:00
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientFiscalData.socialNameInput)
|
|
|
|
.evaluate(selector => {
|
|
|
|
return document.querySelector(selector).disabled;
|
|
|
|
}, 'vn-textfield[field="$ctrl.client.socialName"] > div')
|
|
|
|
.then(result => {
|
|
|
|
expect(result).not.toBe(true);
|
2018-10-22 15:12:41 +00:00
|
|
|
done();
|
|
|
|
}).catch(done.fail);
|
2018-03-12 10:10:05 +00:00
|
|
|
});
|
|
|
|
});
|
2018-03-02 13:45:22 +00:00
|
|
|
});
|