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-03-02 11:15:17 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('developer');
|
|
|
|
});
|
|
|
|
|
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-26 15:06:49 +00:00
|
|
|
it('should search for the user Petter Parker', () => {
|
2018-02-20 09:00:19 +00:00
|
|
|
return nightmare
|
2017-12-15 09:07:52 +00:00
|
|
|
.wait(selectors.clientsIndex.searchResult)
|
2018-02-26 15:06:49 +00:00
|
|
|
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
|
2017-12-15 09:07:52 +00:00
|
|
|
.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
|
2018-02-26 15:06:49 +00:00
|
|
|
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
|
2017-12-15 09:07:52 +00:00
|
|
|
.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-26 15:06:49 +00:00
|
|
|
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
|
2018-02-15 11:28:05 +00:00
|
|
|
.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-26 15:06:49 +00:00
|
|
|
it('should not save a description without observation type', () => {
|
|
|
|
return nightmare
|
|
|
|
.wait(selectors.clientAddresses.firstObservationDescriptionInput)
|
|
|
|
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
|
|
|
.waitToClick(selectors.clientAddresses.saveButton)
|
|
|
|
.waitForSnackbar()
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('No changes to save');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should not save an observation type without description type', () => {
|
|
|
|
return nightmare
|
|
|
|
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
|
|
|
|
.waitToClick(selectors.clientAddresses.firstObservationTypeSelect)
|
|
|
|
.waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne)
|
|
|
|
.waitForTextInInput(selectors.clientAddresses.firstObservationTypeSelect, 'observation one')
|
|
|
|
.waitToClick(selectors.clientAddresses.saveButton)
|
|
|
|
.waitForSnackbar()
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('No changes to save');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should show an error if there are empty fields', () => {
|
|
|
|
return nightmare
|
|
|
|
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
|
|
|
|
.waitToClick(selectors.clientAddresses.addAddressNoteButton)
|
|
|
|
.wait(selectors.clientAddresses.secondObservationDescriptionInput)
|
|
|
|
.type(selectors.clientAddresses.secondObservationDescriptionInput, 'second description')
|
|
|
|
.waitToClick(selectors.clientAddresses.saveButton)
|
|
|
|
.waitForSnackbar()
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('No changes to save');
|
|
|
|
});
|
|
|
|
});
|
2017-12-15 09:07:52 +00:00
|
|
|
});
|
2018-02-26 15:06:49 +00:00
|
|
|
|