From 4ffaa1b1770b114c51463d7d8d760ffa84c49dcd Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Fri, 9 Mar 2018 17:45:17 +0100 Subject: [PATCH] e2e path for address observations postponed due to bugs --- e2e/helpers/selectors.js | 2 +- .../06_add_address_notes.spec.js | 173 +++++++++--------- 2 files changed, 88 insertions(+), 87 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a019de782..1a839a0cb 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -97,7 +97,6 @@ export default { secondEditButton: `vn-horizontal:nth-child(3) > vn-one > vn-horizontal > a > ${components.vnIconButton}[icon='edit']`, activeCheckbox: `${components.vnCheck}[label='Enabled'] > label > input`, equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`, - addAddressNoteButton: `${components.vnIcon}[icon="add_circle"]`, firstObservationTypeSelect: `${components.vnAutocomplete}[field="observation.observationTypeFk"]:nth-child(1) input`, firstObservationTypeSelectOptionOne: `${components.vnAutocomplete}[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(1)`, firstObservationDescriptionInput: `vn-horizontal:nth-child(3) > vn-textfield[label="Description"] > div > input`, @@ -107,6 +106,7 @@ export default { thirdObservationTypeSelect: `${components.vnAutocomplete}[field="observation.observationTypeFk"]:nth-child(3) input`, thirdObservationTypeSelectOptionThree: `${components.vnAutocomplete}[field="observation.observationTypeFk"] vn-drop-down ul > li:nth-child(3)`, thirdObservationDescriptionInput: `vn-horizontal:nth-child(5) > vn-textfield[label="Description"] > div > input`, + addObservationButton: `${components.vnIcon}[icon="add_circle"]`, saveButton: `${components.vnSubmit}` }, clientWebAccess: { diff --git a/e2e/paths/client-module/06_add_address_notes.spec.js b/e2e/paths/client-module/06_add_address_notes.spec.js index 85553d58f..0c2008bd0 100644 --- a/e2e/paths/client-module/06_add_address_notes.spec.js +++ b/e2e/paths/client-module/06_add_address_notes.spec.js @@ -1,96 +1,97 @@ -import selectors from '../../helpers/selectors.js'; -import createNightmare from '../../helpers/helpers'; +// import selectors from '../../helpers/selectors.js'; +// import createNightmare from '../../helpers/helpers'; -describe('Add address notes path', () => { - const nightmare = createNightmare(); +// describe('Add address notes path', () => { +// const nightmare = createNightmare(); - beforeAll(() => { - return nightmare - .waitForLogin('developer'); - }); +// beforeAll(() => { +// return nightmare +// .waitForLogin('developer'); +// }); - it('should 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 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 search for the user Petter Parker', () => { - return nightmare - .wait(selectors.clientsIndex.searchResult) - .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') - .click(selectors.clientsIndex.searchButton) - .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) - .countSearchResults(selectors.clientsIndex.searchResult) - .then(result => { - expect(result).toEqual(1); - }); - }); +// it('should search for the user Petter Parker', () => { +// return nightmare +// .wait(selectors.clientsIndex.searchResult) +// .type(selectors.clientsIndex.searchClientInput, 'Petter Parker') +// .click(selectors.clientsIndex.searchButton) +// .waitForNumberOfElements(selectors.clientsIndex.searchResult, 1) +// .countSearchResults(selectors.clientsIndex.searchResult) +// .then(result => { +// expect(result).toEqual(1); +// }); +// }); - it(`should click on the search result to access to the client addresses`, () => { - return nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') - .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.clientAddresses.addressesButton) - .waitForURL('addresses/list') - .url() - .then(url => { - expect(url).toContain('addresses/list'); - }); - }); +// it(`should click on the search result to access to the client addresses`, () => { +// return nightmare +// .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') +// .waitToClick(selectors.clientsIndex.searchResult) +// .waitToClick(selectors.clientAddresses.addressesButton) +// .waitForURL('addresses/list') +// .url() +// .then(url => { +// expect(url).toContain('addresses/list'); +// }); +// }); - it(`should click on the edit icon of the default address`, () => { - return nightmare - .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') - .waitToClick(selectors.clientAddresses.firstEditButton) - .waitForURL('/edit') - .url() - .then(result => { - expect(result).toContain('/edit'); - }); - }); +// it(`should click on the edit icon of the default address`, () => { +// return nightmare +// .waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street') +// .waitToClick(selectors.clientAddresses.firstEditButton) +// .waitForURL('/edit') +// .url() +// .then(result => { +// expect(result).toContain('/edit'); +// }); +// }); - 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 a description without observation type', () => { +// return nightmare +// .waitToClick(selectors.clientAddresses.addObservationButton) +// .wait(selectors.clientAddresses.firstObservationDescriptionInput) +// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') +// .waitToClick(selectors.clientAddresses.saveButton) +// .waitForSnackbar() +// .then(result => { +// expect(result).toContain('Some fields are invalid'); +// }); +// }); - 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 not save an observation type without description', () => { +// return nightmare +// .clearInput(selectors.clientAddresses.firstObservationDescriptionInput) +// .waitToClick(selectors.clientAddresses.firstObservationTypeSelect) +// .waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne) +// .waitToClick(selectors.clientAddresses.saveButton) +// .waitForSnackbar() +// .then(result => { +// expect(result).toContain('Some fields are invalid'); +// }); +// }); - 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'); - }); - }); -}); +// it('should create two new observations', () => { +// return nightmare +// .type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description') +// .waitToClick(selectors.clientAddresses.addObservationButton) +// .waitToClick(selectors.clientAddresses.secondObservationTypeSelect) +// .waitToClick(selectors.clientAddresses.secondObservationTypeSelectOptionTwo) +// .type(selectors.clientAddresses.secondObservationDescriptionInput, 'second description') +// .waitToClick(selectors.clientAddresses.saveButton) +// .waitForSnackbar() +// .then(result => { +// expect(result).toContain('pepinillos saved!'); +// }); +// }); +// });