From f7f1a733c625aadbc46416ccbc8f1b59fd56e755 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 12 Feb 2018 13:19:54 +0100 Subject: [PATCH] e2e path for add adress notes files - pending to finish --- ...esses.spec.js => 05_add_address.spec.1.js} | 4 +- e2e/paths/06_add_address_notes.spec.js | 99 +++++++++++++++++++ ...ess.spec.js => 07_edit_web_access.spec.js} | 0 ...add_notes.spec.js => 08_add_notes.spec.js} | 0 ...d_credit.spec.js => 09_add_credit.spec.js} | 0 ...d_greuge.spec.js => 10_add_greuge.spec.js} | 0 ...{10_mandate.spec.js => 11_mandate.spec.js} | 0 7 files changed, 101 insertions(+), 2 deletions(-) rename e2e/paths/{05_edit_addresses.spec.js => 05_add_address.spec.1.js} (99%) create mode 100644 e2e/paths/06_add_address_notes.spec.js rename e2e/paths/{06_edit_web_access.spec.js => 07_edit_web_access.spec.js} (100%) rename e2e/paths/{07_add_notes.spec.js => 08_add_notes.spec.js} (100%) rename e2e/paths/{08_add_credit.spec.js => 09_add_credit.spec.js} (100%) rename e2e/paths/{09_add_greuge.spec.js => 10_add_greuge.spec.js} (100%) rename e2e/paths/{10_mandate.spec.js => 11_mandate.spec.js} (100%) diff --git a/e2e/paths/05_edit_addresses.spec.js b/e2e/paths/05_add_address.spec.1.js similarity index 99% rename from e2e/paths/05_edit_addresses.spec.js rename to e2e/paths/05_add_address.spec.1.js index eebd709a5..45a066932 100644 --- a/e2e/paths/05_edit_addresses.spec.js +++ b/e2e/paths/05_add_address.spec.1.js @@ -7,7 +7,7 @@ const moduleAccessViewHashURL = '#!/'; jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; -describe('Edit addresses path', () => { +describe('Add address path', () => { it('should log in', done => { nightmare .login() @@ -57,7 +57,7 @@ describe('Edit addresses path', () => { .catch(catchErrors(done)); }); - it(`should click on the search result to access to the client's pay method`, done => { + it(`should click on the search result to access to the client addresses`, done => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) diff --git a/e2e/paths/06_add_address_notes.spec.js b/e2e/paths/06_add_address_notes.spec.js new file mode 100644 index 000000000..3c3d34a35 --- /dev/null +++ b/e2e/paths/06_add_address_notes.spec.js @@ -0,0 +1,99 @@ +import config from '../helpers/config.js'; +import createNightmare from '../helpers/nightmare'; +import selectors from '../helpers/selectors.js'; +import {catchErrors} from '../../services/utils/jasmineHelpers'; +const nightmare = createNightmare(); +const moduleAccessViewHashURL = '#!/'; + +jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; + +describe('Add address notes path', () => { + it('should log in', done => { + nightmare + .login() + .waitForURL(moduleAccessViewHashURL) + .url() + .then(url => { + expect(url).toEqual(config.url + moduleAccessViewHashURL); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should make sure the language is English', done => { + nightmare + .changeLanguageToEnglish() + .then(() => { + done(); + }) + .catch(catchErrors(done)); + }); + + it('should click on the Clients button of the top bar menu', done => { + nightmare + .waitToClick(selectors.globalItems.applicationsMenuButton) + .wait(selectors.globalItems.applicationsMenuVisible) + .waitToClick(selectors.globalItems.clientsButton) + .wait(selectors.clientsIndex.createClientButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/clients'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should search for the user Bruce Banner', done => { + nightmare + .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); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the search result to access to the client addresses`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.addresses.addressesButton) + .waitForURL('addresses/list') + .url() + .then(url => { + expect(url).toContain('addresses/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the edit icon of the default address`, done => { + nightmare + .waitForTextInElement(selectors.addresses.defaultAddress, 'Somewhere in Thailand') + .waitToClick(selectors.addresses.firstEditButton) + .waitForURL('/edit') + .url() + .then(result => { + expect(result).toContain('/edit'); + done(); + }) + .catch(catchErrors(done)); + }); + + it('should add as many notes as observation types', done => { + nightmare + .waitToClick(selectors.addresses.defaultCheckboxInput) + // .waitToClick(selectors.fiscalData.saveButton) + // .wait(selectors.globalItems.snackbarIsActive) + // .getInnerText(selectors.globalItems.snackbarIsActive) + // .then(result => { + // expect(result).toContain('Some fields are invalid'); + // done(); + // }) + .catch(catchErrors(done)); + }); +}); diff --git a/e2e/paths/06_edit_web_access.spec.js b/e2e/paths/07_edit_web_access.spec.js similarity index 100% rename from e2e/paths/06_edit_web_access.spec.js rename to e2e/paths/07_edit_web_access.spec.js diff --git a/e2e/paths/07_add_notes.spec.js b/e2e/paths/08_add_notes.spec.js similarity index 100% rename from e2e/paths/07_add_notes.spec.js rename to e2e/paths/08_add_notes.spec.js diff --git a/e2e/paths/08_add_credit.spec.js b/e2e/paths/09_add_credit.spec.js similarity index 100% rename from e2e/paths/08_add_credit.spec.js rename to e2e/paths/09_add_credit.spec.js diff --git a/e2e/paths/09_add_greuge.spec.js b/e2e/paths/10_add_greuge.spec.js similarity index 100% rename from e2e/paths/09_add_greuge.spec.js rename to e2e/paths/10_add_greuge.spec.js diff --git a/e2e/paths/10_mandate.spec.js b/e2e/paths/11_mandate.spec.js similarity index 100% rename from e2e/paths/10_mandate.spec.js rename to e2e/paths/11_mandate.spec.js