2018-02-15 11:28:05 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-02-20 09:00:19 +00:00
|
|
|
import createNightmare from '../../helpers/helpers';
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2018-02-12 12:19:54 +00:00
|
|
|
describe('Add address notes path', () => {
|
2018-02-20 09:00:19 +00:00
|
|
|
const nightmare = createNightmare();
|
2017-12-15 09:07:52 +00:00
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should click on the Clients button of the top bar menu', () => {
|
|
|
|
return nightmare
|
2017-12-15 09:07:52 +00:00
|
|
|
.waitToClick(selectors.globalItems.applicationsMenuButton)
|
|
|
|
.wait(selectors.globalItems.applicationsMenuVisible)
|
|
|
|
.waitToClick(selectors.globalItems.clientsButton)
|
|
|
|
.wait(selectors.clientsIndex.createClientButton)
|
2018-02-20 21:35:54 +00:00
|
|
|
.parsedUrl()
|
2017-12-15 09:07:52 +00:00
|
|
|
.then(url => {
|
2018-02-20 09:00:19 +00:00
|
|
|
expect(url.hash).toEqual('#!/clients');
|
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it('should search for the user Bruce Banner', () => {
|
|
|
|
return nightmare
|
2017-12-15 09:07:52 +00:00
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
|
|
|
|
.click(selectors.clientsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
|
|
|
|
.countSearchResults(selectors.clientsIndex.searchResult)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toEqual(1);
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it(`should click on the search result to access to the client addresses`, () => {
|
|
|
|
return nightmare
|
2017-12-15 09:07:52 +00:00
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
|
|
|
.waitToClick(selectors.clientsIndex.searchResult)
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitToClick(selectors.clientAddresses.addressesButton)
|
2018-02-12 12:19:54 +00:00
|
|
|
.waitForURL('addresses/list')
|
2017-12-15 09:07:52 +00:00
|
|
|
.url()
|
|
|
|
.then(url => {
|
2018-02-12 12:19:54 +00:00
|
|
|
expect(url).toContain('addresses/list');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
it(`should click on the edit icon of the default address`, () => {
|
|
|
|
return nightmare
|
2018-02-15 11:28:05 +00:00
|
|
|
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
|
|
|
|
.waitToClick(selectors.clientAddresses.firstEditButton)
|
2018-02-12 12:19:54 +00:00
|
|
|
.waitForURL('/edit')
|
2017-12-15 11:51:06 +00:00
|
|
|
.url()
|
2017-12-15 09:07:52 +00:00
|
|
|
.then(result => {
|
2018-02-12 12:19:54 +00:00
|
|
|
expect(result).toContain('/edit');
|
2018-02-20 09:00:19 +00:00
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
|
|
|
|
2018-02-20 09:00:19 +00:00
|
|
|
// it('should add as many notes as observation types', () => {
|
|
|
|
// return nightmare
|
|
|
|
// .waitToClick(selectors.clientAddresses.defaultCheckboxInput)
|
2018-02-15 11:28:05 +00:00
|
|
|
// .waitToClick(selectors.clientFiscalData.saveButton)
|
2018-02-20 09:00:19 +00:00
|
|
|
// .waitForSnackbar()
|
2018-02-12 12:19:54 +00:00
|
|
|
// .then(result => {
|
|
|
|
// expect(result).toContain('Some fields are invalid');
|
|
|
|
// })
|
2018-02-15 09:03:49 +00:00
|
|
|
// });
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|