diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index f7a568d82..d8e315157 100644 --- a/e2e/helpers/extensions.js +++ b/e2e/helpers/extensions.js @@ -121,8 +121,15 @@ Nightmare.action('waitForNumberOfElements', function(selector, count, done) { }); Nightmare.action('waitForTextInElement', function(selector, name, done) { - this.wait((resultSelector, expectedName) => { - return document.querySelector(resultSelector).innerText.toLowerCase().includes(expectedName.toLowerCase()); + this.wait((resultSelector, expectedText) => { + return document.querySelector(resultSelector).innerText.toLowerCase().includes(expectedText.toLowerCase()); + }, selector, name) + .then(done); +}); + +Nightmare.action('waitForTextInInput', function(selector, name, done) { + this.wait((resultSelector, expectedText) => { + return document.querySelector(resultSelector).value.toLowerCase().includes(expectedText.toLowerCase()); }, selector, name) .then(done); }); diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 06fc42a0e..17c319bcc 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -16,7 +16,8 @@ export default { clientsButton: `${components.vnMainMenu} > div > ul > li:nth-child(1)` }, moduleAccessView: { - clientsSectionButton: `${components.vnModuleContainer}[ui-sref="clients"]` + clientsSectionButton: `${components.vnModuleContainer}[ui-sref="clients"]`, + itemsSectionButton: `${components.vnModuleContainer}[ui-sref="item.index"]` }, clientsIndex: { searchClientInput: `${components.vnTextfield}`, @@ -34,7 +35,7 @@ export default { salesBruceBannerOption: `${components.vnAutocomplete}[field="$ctrl.client.salesPersonFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`, createButton: `${components.vnSubmit}` }, - basicData: { + clientBasicData: { basicDataButton: `${components.vnMenuItem}[ui-sref="clientCard.basicData"]`, nameInput: `${components.vnTextfield}[name="name"]`, contactInput: `${components.vnTextfield}[name="contact"]`, @@ -48,7 +49,7 @@ export default { channelMetropolisOption: `${components.vnAutocomplete}[field="$ctrl.client.contactChannelFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(3)`, saveButton: `${components.vnSubmit}` }, - fiscalData: { + clientFiscalData: { fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`, socialNameInput: `${components.vnTextfield}[name="socialName"]`, fiscalIdInput: `${components.vnTextfield}[name="fi"]`, @@ -69,7 +70,7 @@ export default { viesCheckboxInput: `${components.vnCheck}[label='Vies'] > label > input`, saveButton: `${components.vnSubmit}` }, - payMethod: { + clientPayMethod: { payMethodButton: `${components.vnMenuItem}[ui-sref="clientCard.billingData"]`, payMethodInput: `${components.vnAutocomplete}[field="$ctrl.client.payMethodFk"] > vn-vertical > ${components.vnTextfield}`, payMethodIBANOption: `${components.vnAutocomplete}[field="$ctrl.client.payMethodFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(5)`, @@ -82,7 +83,7 @@ export default { receivedB2BVNLCheckbox: `${components.vnCheck}[label='Received B2B VNL'] > label > input`, saveButton: `${components.vnSubmit}` }, - addresses: { + clientAddresses: { addressesButton: `${components.vnMenuItem}[ui-sref="clientCard.addresses.list"]`, createAddress: `${components.vnFloatButton}`, defaultCheckboxInput: `${components.vnCheck}[label='Default'] > label > input`, @@ -104,27 +105,27 @@ export default { equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`, saveButton: `${components.vnSubmit}` }, - webAccess: { + clientWebAccess: { webAccessButton: `${components.vnMenuItem}[ui-sref="clientCard.webAccess"]`, enableWebAccessCheckbox: `${components.vnCheck}[label='Enable web access'] > label > input`, userNameInput: `${components.vnTextfield}[name="name"]`, saveButton: `${components.vnSubmit}` }, - notes: { + clientNotes: { notesButton: `${components.vnMenuItem}[ui-sref="clientCard.notes.list"]`, addNoteFloatButton: `${components.vnFloatButton}`, noteInput: `${components.vnTextarea}[label="Note"]`, saveButton: `${components.vnSubmit}`, firstNoteText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-notes > vn-card > div > vn-vertical > vn-one:nth-child(2) > vn-horizontal.ng-binding' }, - credit: { + clientCredit: { creditButton: `${components.vnMenuItem}[ui-sref="clientCard.credit.list"]`, addCreditFloatButton: `${components.vnFloatButton}`, creditInput: `${components.vnTextfield}[name="credit"]`, saveButton: `${components.vnSubmit}`, firstCreditText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-credit-list > vn-card > div > vn-vertical > vn-one > vn-horizontal:nth-child(1) > vn-one' }, - greuge: { + clientGreuge: { greugeButton: `${components.vnMenuItem}[ui-sref="clientCard.greuge.list"]`, addGreugeFloatButton: `${components.vnFloatButton}`, amountInput: `${components.vnTextfield}[name="amount"]`, @@ -134,8 +135,11 @@ export default { saveButton: `${components.vnSubmit}`, firstGreugeText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-greuge-list > vn-card > div > vn-vertical > vn-one > vn-horizontal' }, - mandate: { + clientMandate: { mandateButton: `${components.vnMenuItem}[ui-sref="clientCard.mandate"]`, firstMandateText: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-mandate > vn-card > div > vn-vertical > vn-one > vn-horizontal' + }, + itemsIndex: { + createItemButton: `${components.vnFloatButton}` } }; diff --git a/e2e/paths/01_create_client_path.spec.js b/e2e/paths/client-module/01_create_client.spec.js similarity index 97% rename from e2e/paths/01_create_client_path.spec.js rename to e2e/paths/client-module/01_create_client.spec.js index 48dd08a77..f8a32a1fa 100644 --- a/e2e/paths/01_create_client_path.spec.js +++ b/e2e/paths/client-module/01_create_client.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; diff --git a/e2e/paths/02_edit_basic_data.spec.js b/e2e/paths/client-module/02_edit_basic_data.spec.js similarity index 63% rename from e2e/paths/02_edit_basic_data.spec.js rename to e2e/paths/client-module/02_edit_basic_data.spec.js index ef8a6b388..1a9649844 100644 --- a/e2e/paths/02_edit_basic_data.spec.js +++ b/e2e/paths/client-module/02_edit_basic_data.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -72,10 +72,10 @@ describe('Edit basicData path', () => { it('should edit the name', done => { nightmare - .wait(selectors.basicData.nameInput) - .clearInput(selectors.basicData.nameInput) - .type(selectors.basicData.nameInput, 'Ororo Munroe') - .click(selectors.basicData.saveButton) + .wait(selectors.clientBasicData.nameInput) + .clearInput(selectors.clientBasicData.nameInput) + .type(selectors.clientBasicData.nameInput, 'Ororo Munroe') + .click(selectors.clientBasicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -88,11 +88,11 @@ describe('Edit basicData path', () => { it('should confirm the name have been edited', done => { nightmare .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .getInputValue(selectors.basicData.nameInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .getInputValue(selectors.clientBasicData.nameInput) .then(result => { expect(result).toEqual('Ororo Munroe'); done(); @@ -102,10 +102,10 @@ describe('Edit basicData path', () => { it('should edit the contact name', done => { nightmare - .wait(selectors.basicData.contactInput) - .clearInput(selectors.basicData.contactInput) - .type(selectors.basicData.contactInput, 'Black Panther') - .click(selectors.basicData.saveButton) + .wait(selectors.clientBasicData.contactInput) + .clearInput(selectors.clientBasicData.contactInput) + .type(selectors.clientBasicData.contactInput, 'Black Panther') + .click(selectors.clientBasicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -118,11 +118,11 @@ describe('Edit basicData path', () => { it('should confirm the contact name have been edited', done => { nightmare .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.contactInput) - .getInputValue(selectors.basicData.contactInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.contactInput) + .getInputValue(selectors.clientBasicData.contactInput) .then(result => { expect(result).toEqual('Black Panther'); done(); @@ -132,10 +132,10 @@ describe('Edit basicData path', () => { it('should add the landline phone number', done => { nightmare - .wait(selectors.basicData.phoneInput) - .clearInput(selectors.basicData.phoneInput) - .type(selectors.basicData.phoneInput, '123456789') - .click(selectors.basicData.saveButton) + .wait(selectors.clientBasicData.phoneInput) + .clearInput(selectors.clientBasicData.phoneInput) + .type(selectors.clientBasicData.phoneInput, '123456789') + .click(selectors.clientBasicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -148,11 +148,11 @@ describe('Edit basicData path', () => { it('should confirm the landline phone number have been added', done => { nightmare .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.phoneInput) - .getInputValue(selectors.basicData.phoneInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.phoneInput) + .getInputValue(selectors.clientBasicData.phoneInput) .then(result => { expect(result).toEqual('123456789'); done(); @@ -162,10 +162,10 @@ describe('Edit basicData path', () => { it('should add the mobile phone number', done => { nightmare - .wait(selectors.basicData.mobileInput) - .clearInput(selectors.basicData.mobileInput) - .type(selectors.basicData.mobileInput, '987654321') - .click(selectors.basicData.saveButton) + .wait(selectors.clientBasicData.mobileInput) + .clearInput(selectors.clientBasicData.mobileInput) + .type(selectors.clientBasicData.mobileInput, '987654321') + .click(selectors.clientBasicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -178,11 +178,11 @@ describe('Edit basicData path', () => { it('should confirm the mobile phone number have been added', done => { nightmare .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.mobileInput) - .getInputValue(selectors.basicData.mobileInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.mobileInput) + .getInputValue(selectors.clientBasicData.mobileInput) .then(result => { expect(result).toEqual('987654321'); done(); @@ -192,10 +192,10 @@ describe('Edit basicData path', () => { it('should edit the email', done => { nightmare - .wait(selectors.basicData.emailInput) - .clearInput(selectors.basicData.emailInput) - .type(selectors.basicData.emailInput, 'Storm@verdnatura.es') - .click(selectors.basicData.saveButton) + .wait(selectors.clientBasicData.emailInput) + .clearInput(selectors.clientBasicData.emailInput) + .type(selectors.clientBasicData.emailInput, 'Storm@verdnatura.es') + .click(selectors.clientBasicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -208,11 +208,11 @@ describe('Edit basicData path', () => { it('should confirm the email have been edited', done => { nightmare .waitForSnackbarReset() - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.emailInput) - .getInputValue(selectors.basicData.emailInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.emailInput) + .getInputValue(selectors.clientBasicData.emailInput) .then(result => { expect(result).toEqual('Storm@verdnatura.es'); done(); @@ -222,10 +222,10 @@ describe('Edit basicData path', () => { it('should select the sales person', done => { nightmare - .waitToClick(selectors.basicData.salesPersonInput) - .waitToClick(selectors.basicData.salesBruceBannerOption) + .waitToClick(selectors.clientBasicData.salesPersonInput) + .waitToClick(selectors.clientBasicData.salesBruceBannerOption) .wait(200) - .waitToClick(selectors.basicData.saveButton) + .waitToClick(selectors.clientBasicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -238,11 +238,11 @@ describe('Edit basicData path', () => { it('should confirm the sales person have been selected', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .waitToClick(selectors.basicData.basicDataButton) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .waitToClick(selectors.clientBasicData.basicDataButton) .wait(200) - .getInputValue(selectors.basicData.salesPersonInput) + .getInputValue(selectors.clientBasicData.salesPersonInput) .then(result => { expect(result).toEqual('Bruce Banner'); done(); @@ -252,10 +252,10 @@ describe('Edit basicData path', () => { it('should select the channel', done => { nightmare - .waitToClick(selectors.basicData.channelInput) - .waitToClick(selectors.basicData.channelMetropolisOption) + .waitToClick(selectors.clientBasicData.channelInput) + .waitToClick(selectors.clientBasicData.channelMetropolisOption) .wait(400) - .waitToClick(selectors.basicData.saveButton) + .waitToClick(selectors.clientBasicData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -268,11 +268,11 @@ describe('Edit basicData path', () => { it('should confirm the channel have been selected', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .waitToClick(selectors.basicData.basicDataButton) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .waitToClick(selectors.clientBasicData.basicDataButton) .wait(400) - .getInputValue(selectors.basicData.channelInput) + .getInputValue(selectors.clientBasicData.channelInput) .then(result => { expect(result).toEqual('Metropolis newspaper'); done(); diff --git a/e2e/paths/03_edit_fiscal_data.spec.js b/e2e/paths/client-module/03_edit_fiscal_data.spec.js similarity index 63% rename from e2e/paths/03_edit_fiscal_data.spec.js rename to e2e/paths/client-module/03_edit_fiscal_data.spec.js index 495f3c42a..b3b4d416e 100644 --- a/e2e/paths/03_edit_fiscal_data.spec.js +++ b/e2e/paths/client-module/03_edit_fiscal_data.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -62,7 +62,7 @@ describe('Edit fiscalData path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.addresses.addressesButton) + .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('/addresses/list') .url() .then(url => { @@ -74,12 +74,12 @@ describe('Edit fiscalData path', () => { it(`should click on the 1st edit icon to check EQtax is checked`, done => { nightmare - .waitToClick(selectors.addresses.firstEditButton) - .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientAddresses.firstEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(200) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.addresses.equalizationTaxCheckboxLabel) + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) .then(value => { expect(value).toBeFalsy(); done(); @@ -89,13 +89,13 @@ describe('Edit fiscalData path', () => { it(`should go back to addresses then select the second one and confirm the EQtax is checked`, done => { nightmare - .waitToClick(selectors.addresses.addressesButton) - .waitToClick(selectors.addresses.secondEditButton) - .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientAddresses.addressesButton) + .waitToClick(selectors.clientAddresses.secondEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(200) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.addresses.equalizationTaxCheckboxLabel) + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) .then(value => { expect(value).toBeFalsy(); done(); @@ -106,7 +106,7 @@ describe('Edit fiscalData path', () => { it(`should click on the fiscal data button to start editing`, done => { nightmare - .waitToClick(selectors.fiscalData.fiscalDataButton) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) .waitForURL('fiscal-data') .url() .then(url => { @@ -118,10 +118,10 @@ describe('Edit fiscalData path', () => { it('should edit the social name', done => { nightmare - .wait(selectors.fiscalData.socialNameInput) - .clearInput(selectors.fiscalData.socialNameInput) - .type(selectors.fiscalData.socialNameInput, 'Hulk edited') - .click(selectors.fiscalData.saveButton) + .wait(selectors.clientFiscalData.socialNameInput) + .clearInput(selectors.clientFiscalData.socialNameInput) + .type(selectors.clientFiscalData.socialNameInput, 'Hulk edited') + .click(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -134,11 +134,11 @@ describe('Edit fiscalData path', () => { it('should confirm the social name have been edited', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.socialNameInput) - .getInputValue(selectors.fiscalData.socialNameInput) + .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('Hulk edited'); done(); @@ -148,10 +148,10 @@ describe('Edit fiscalData path', () => { it('should edit the fiscal id', done => { nightmare - .wait(selectors.fiscalData.fiscalIdInput) - .clearInput(selectors.fiscalData.fiscalIdInput) - .type(selectors.fiscalData.fiscalIdInput, '94980061C') - .click(selectors.fiscalData.saveButton) + .wait(selectors.clientFiscalData.fiscalIdInput) + .clearInput(selectors.clientFiscalData.fiscalIdInput) + .type(selectors.clientFiscalData.fiscalIdInput, '94980061C') + .click(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -164,11 +164,11 @@ describe('Edit fiscalData path', () => { it('should confirm the fiscal id have been edited', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.fiscalIdInput) - .getInputValue(selectors.fiscalData.fiscalIdInput) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.fiscalIdInput) + .getInputValue(selectors.clientFiscalData.fiscalIdInput) .then(result => { expect(result).toEqual('94980061C'); done(); @@ -178,8 +178,8 @@ describe('Edit fiscalData path', () => { it('should check the Equalization tax checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.equalizationTaxCheckboxLabel) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -191,7 +191,7 @@ describe('Edit fiscalData path', () => { it('should propagate the Equalization tax', done => { nightmare - .waitToClick(selectors.fiscalData.acceptPropagationButton) + .waitToClick(selectors.clientFiscalData.acceptPropagationButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -204,13 +204,13 @@ describe('Edit fiscalData path', () => { it('should confirm Equalization tax checkbox is checked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.equalizationTaxCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.equalizationTaxCheckboxLabel) + }, selectors.clientFiscalData.equalizationTaxCheckboxLabel) .then(value => { expect(value).toBeTruthy(); done(); @@ -221,7 +221,7 @@ describe('Edit fiscalData path', () => { describe('Confirm all addresses have now EQtax checked', () => { it(`should click on the addresses button to access to the client's addresses`, done => { nightmare - .waitToClick(selectors.addresses.addressesButton) + .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('/addresses/list') .url() .then(url => { @@ -233,12 +233,12 @@ describe('Edit fiscalData path', () => { it(`should click on the 1st edit icon to confirm EQtax is checked`, done => { nightmare - .waitToClick(selectors.addresses.firstEditButton) - .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientAddresses.firstEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(200) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.addresses.equalizationTaxCheckboxLabel) + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) .then(value => { expect(value).toBeTruthy(); done(); @@ -248,13 +248,13 @@ describe('Edit fiscalData path', () => { it(`should go back to addresses then select the second one and confirm the EQtax is checked`, done => { nightmare - .waitToClick(selectors.addresses.addressesButton) - .waitToClick(selectors.addresses.secondEditButton) - .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .waitToClick(selectors.clientAddresses.addressesButton) + .waitToClick(selectors.clientAddresses.secondEditButton) + .wait(selectors.clientAddresses.equalizationTaxCheckboxLabel) .wait(200) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.addresses.equalizationTaxCheckboxLabel) + }, selectors.clientAddresses.equalizationTaxCheckboxLabel) .then(value => { expect(value).toBeTruthy(); done(); @@ -265,11 +265,11 @@ describe('Edit fiscalData path', () => { it('should go to fiscal data then edit the address', done => { nightmare - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .clearInput(selectors.fiscalData.addressInput) - .type(selectors.fiscalData.addressInput, 'Somewhere edited') - .click(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .clearInput(selectors.clientFiscalData.addressInput) + .type(selectors.clientFiscalData.addressInput, 'Somewhere edited') + .click(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -282,11 +282,11 @@ describe('Edit fiscalData path', () => { it('should confirm the address have been edited', done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.addressInput) - .getInputValue(selectors.fiscalData.addressInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.addressInput) + .getInputValue(selectors.clientFiscalData.addressInput) .then(result => { expect(result).toEqual('Somewhere edited'); done(); @@ -296,10 +296,10 @@ describe('Edit fiscalData path', () => { it('should edit the city', done => { nightmare - .wait(selectors.fiscalData.cityInput) - .clearInput(selectors.fiscalData.cityInput) - .type(selectors.fiscalData.cityInput, 'N/A') - .click(selectors.fiscalData.saveButton) + .wait(selectors.clientFiscalData.cityInput) + .clearInput(selectors.clientFiscalData.cityInput) + .type(selectors.clientFiscalData.cityInput, 'N/A') + .click(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -312,11 +312,11 @@ describe('Edit fiscalData path', () => { it('should confirm the city have been edited', done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.cityInput) - .getInputValue(selectors.fiscalData.cityInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.cityInput) + .getInputValue(selectors.clientFiscalData.cityInput) .then(result => { expect(result).toEqual('N/A'); done(); @@ -326,10 +326,10 @@ describe('Edit fiscalData path', () => { it('should edit the postcode', done => { nightmare - .wait(selectors.fiscalData.postcodeInput) - .clearInput(selectors.fiscalData.postcodeInput) - .type(selectors.fiscalData.postcodeInput, '12345') - .click(selectors.fiscalData.saveButton) + .wait(selectors.clientFiscalData.postcodeInput) + .clearInput(selectors.clientFiscalData.postcodeInput) + .type(selectors.clientFiscalData.postcodeInput, '12345') + .click(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -342,11 +342,11 @@ describe('Edit fiscalData path', () => { it('should confirm the postcode have been edited', done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.postcodeInput) - .getInputValue(selectors.fiscalData.postcodeInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .click(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.postcodeInput) + .getInputValue(selectors.clientFiscalData.postcodeInput) .then(result => { expect(result).toEqual('12345'); done(); @@ -356,10 +356,10 @@ describe('Edit fiscalData path', () => { it(`should edit the province`, done => { nightmare - .waitToClick(selectors.fiscalData.provinceInput) - .waitToClick(selectors.fiscalData.provinceFifthOption) + .waitToClick(selectors.clientFiscalData.provinceInput) + .waitToClick(selectors.clientFiscalData.provinceFifthOption) .wait(200) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -372,11 +372,11 @@ describe('Edit fiscalData path', () => { it(`should confirm the province have been selected`, done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .click(selectors.clientFiscalData.fiscalDataButton) .wait(200) - .getInputValue(selectors.fiscalData.provinceInput) + .getInputValue(selectors.clientFiscalData.provinceInput) .then(result => { expect(result).toEqual('Province two'); done(); @@ -386,8 +386,8 @@ describe('Edit fiscalData path', () => { it('should uncheck the active checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.activeCheckboxLabel) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.activeCheckboxLabel) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -400,13 +400,13 @@ describe('Edit fiscalData path', () => { it('should confirm active checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.activeCheckboxLabel) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.activeCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.activeCheckboxLabel) + }, selectors.clientFiscalData.activeCheckboxLabel) .then(value => { expect(value).toBeFalsy(); done(); @@ -416,8 +416,8 @@ describe('Edit fiscalData path', () => { it('should uncheck the invoice by address checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.invoiceByAddressCheckboxInput) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -430,13 +430,13 @@ describe('Edit fiscalData path', () => { it('should confirm invoice by address checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.invoiceByAddressCheckboxInput) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.invoiceByAddressCheckboxInput) + }, selectors.clientFiscalData.invoiceByAddressCheckboxInput) .then(value => { expect(value).toBeFalsy(); done(); @@ -446,8 +446,8 @@ describe('Edit fiscalData path', () => { it('should check the Verified data checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.verifiedDataCheckboxInput) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -460,13 +460,13 @@ describe('Edit fiscalData path', () => { it('should confirm Verified data checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.verifiedDataCheckboxInput) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.verifiedDataCheckboxInput) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.verifiedDataCheckboxInput) + }, selectors.clientFiscalData.verifiedDataCheckboxInput) .then(value => { expect(value).toBeFalsy(); done(); @@ -476,8 +476,8 @@ describe('Edit fiscalData path', () => { it('should uncheck the Has to invoice checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.hasToInvoiceCheckboxLabel) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -490,13 +490,13 @@ describe('Edit fiscalData path', () => { it('should confirm Has to invoice checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.hasToInvoiceCheckboxLabel) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.hasToInvoiceCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.hasToInvoiceCheckboxLabel) + }, selectors.clientFiscalData.hasToInvoiceCheckboxLabel) .then(value => { expect(value).toBeFalsy(); done(); @@ -506,8 +506,8 @@ describe('Edit fiscalData path', () => { it('should uncheck the Invoice by mail checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -520,13 +520,13 @@ describe('Edit fiscalData path', () => { it('should confirm Invoice by mail checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.invoiceByMailCheckboxLabel) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.invoiceByMailCheckboxLabel) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.invoiceByMailCheckboxLabel) + }, selectors.clientFiscalData.invoiceByMailCheckboxLabel) .then(value => { expect(value).toBeFalsy(); done(); @@ -536,8 +536,8 @@ describe('Edit fiscalData path', () => { it('should check the Vies checkbox', done => { nightmare - .waitToClick(selectors.fiscalData.viesCheckboxInput) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientFiscalData.viesCheckboxInput) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -550,13 +550,13 @@ describe('Edit fiscalData path', () => { it('should confirm Vies checkbox is checked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.fiscalData.fiscalDataButton) - .wait(selectors.fiscalData.viesCheckboxInput) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientFiscalData.fiscalDataButton) + .wait(selectors.clientFiscalData.viesCheckboxInput) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.fiscalData.viesCheckboxInput) + }, selectors.clientFiscalData.viesCheckboxInput) .then(value => { expect(value).toBeTruthy(); done(); diff --git a/e2e/paths/04_edit_pay_method.spec.js b/e2e/paths/client-module/04_edit_pay_method.spec.js similarity index 65% rename from e2e/paths/04_edit_pay_method.spec.js rename to e2e/paths/client-module/04_edit_pay_method.spec.js index 2ea65e936..c03934e87 100644 --- a/e2e/paths/04_edit_pay_method.spec.js +++ b/e2e/paths/client-module/04_edit_pay_method.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('Edit pay method path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.payMethod.payMethodButton) + .waitToClick(selectors.clientPayMethod.payMethodButton) .waitForURL('billing-data') .url() .then(url => { @@ -73,11 +73,11 @@ describe('Edit pay method path', () => { it(`should edit the Pay method to any without IBAN`, done => { nightmare - .waitToClick(selectors.payMethod.payMethodInput) - .waitToClick(selectors.payMethod.payMethodOptionOne) + .waitToClick(selectors.clientPayMethod.payMethodInput) + .waitToClick(selectors.clientPayMethod.payMethodOptionOne) .wait(200) - .waitToClick(selectors.payMethod.saveButton) - .waitToClick(selectors.payMethod.cancelNotificationButton) + .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientPayMethod.cancelNotificationButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -90,11 +90,11 @@ describe('Edit pay method path', () => { it(`should confirm the Pay method have been selected`, done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.payMethod.payMethodButton) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .click(selectors.clientPayMethod.payMethodButton) .wait(200) - .getInputValue(selectors.payMethod.payMethodInput) + .getInputValue(selectors.clientPayMethod.payMethodInput) .then(result => { expect(result).toEqual('PayMethod one'); done(); @@ -104,11 +104,11 @@ describe('Edit pay method path', () => { it(`should receive an error when changing payMethod to IBAN without an IBAN entered`, done => { nightmare - .waitToClick(selectors.payMethod.payMethodInput) - .waitToClick(selectors.payMethod.payMethodIBANOption) + .waitToClick(selectors.clientPayMethod.payMethodInput) + .waitToClick(selectors.clientPayMethod.payMethodIBANOption) .wait(200) - .waitToClick(selectors.payMethod.saveButton) - .waitToClick(selectors.payMethod.cancelNotificationButton) + .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientPayMethod.cancelNotificationButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -120,10 +120,10 @@ describe('Edit pay method path', () => { it(`should add the IBAN`, done => { nightmare - .clearInput(selectors.payMethod.IBANInput) - .type(selectors.payMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') - .waitToClick(selectors.payMethod.saveButton) - .waitToClick(selectors.payMethod.cancelNotificationButton) + .clearInput(selectors.clientPayMethod.IBANInput) + .type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332') + .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientPayMethod.cancelNotificationButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -136,11 +136,11 @@ describe('Edit pay method path', () => { it(`should confirm the IBAN pay method is sucessfully saved`, done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.payMethod.payMethodButton) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .click(selectors.clientPayMethod.payMethodButton) .wait(200) - .getInputValue(selectors.payMethod.payMethodInput) + .getInputValue(selectors.clientPayMethod.payMethodInput) .then(result => { expect(result).toEqual('PayMethod with IBAN'); done(); @@ -150,10 +150,10 @@ describe('Edit pay method path', () => { it(`should edit the due day`, done => { nightmare - .clearInput(selectors.payMethod.dueDayInput) - .type(selectors.payMethod.dueDayInput, '60') - .waitToClick(selectors.payMethod.saveButton) - .waitToClick(selectors.payMethod.cancelNotificationButton) + .clearInput(selectors.clientPayMethod.dueDayInput) + .type(selectors.clientPayMethod.dueDayInput, '60') + .waitToClick(selectors.clientPayMethod.saveButton) + .waitToClick(selectors.clientPayMethod.cancelNotificationButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -166,11 +166,11 @@ describe('Edit pay method path', () => { it('should confirm the due day have been edited', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.payMethod.payMethodButton) - .wait(selectors.payMethod.dueDayInput) - .getInputValue(selectors.payMethod.dueDayInput) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientPayMethod.payMethodButton) + .wait(selectors.clientPayMethod.dueDayInput) + .getInputValue(selectors.clientPayMethod.dueDayInput) .then(result => { expect(result).toEqual('60'); done(); @@ -180,8 +180,8 @@ describe('Edit pay method path', () => { it('should uncheck the Received core VNH checkbox', done => { nightmare - .waitToClick(selectors.payMethod.receivedCoreVNHCheckbox) - .waitToClick(selectors.payMethod.saveButton) + .waitToClick(selectors.clientPayMethod.receivedCoreVNHCheckbox) + .waitToClick(selectors.clientPayMethod.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -194,13 +194,13 @@ describe('Edit pay method path', () => { it('should confirm Received core VNH checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.payMethod.payMethodButton) - .wait(selectors.payMethod.receivedCoreVNHCheckbox) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientPayMethod.payMethodButton) + .wait(selectors.clientPayMethod.receivedCoreVNHCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.payMethod.receivedCoreVNHCheckbox) + }, selectors.clientPayMethod.receivedCoreVNHCheckbox) .then(value => { expect(value).toBeFalsy(); done(); @@ -210,8 +210,8 @@ describe('Edit pay method path', () => { it('should uncheck the Received core VNL checkbox', done => { nightmare - .waitToClick(selectors.payMethod.receivedCoreVNLCheckbox) - .waitToClick(selectors.payMethod.saveButton) + .waitToClick(selectors.clientPayMethod.receivedCoreVNLCheckbox) + .waitToClick(selectors.clientPayMethod.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -224,13 +224,13 @@ describe('Edit pay method path', () => { it('should confirm Received core VNL checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.payMethod.payMethodButton) - .wait(selectors.payMethod.receivedCoreVNLCheckbox) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientPayMethod.payMethodButton) + .wait(selectors.clientPayMethod.receivedCoreVNLCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.payMethod.receivedCoreVNLCheckbox) + }, selectors.clientPayMethod.receivedCoreVNLCheckbox) .then(value => { expect(value).toBeFalsy(); done(); @@ -240,8 +240,8 @@ describe('Edit pay method path', () => { it('should uncheck the Received B2B VNL checkbox', done => { nightmare - .waitToClick(selectors.payMethod.receivedB2BVNLCheckbox) - .waitToClick(selectors.payMethod.saveButton) + .waitToClick(selectors.clientPayMethod.receivedB2BVNLCheckbox) + .waitToClick(selectors.clientPayMethod.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -254,13 +254,13 @@ describe('Edit pay method path', () => { it('should confirm Received B2B VNL checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.payMethod.payMethodButton) - .wait(selectors.payMethod.receivedB2BVNLCheckbox) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientPayMethod.payMethodButton) + .wait(selectors.clientPayMethod.receivedB2BVNLCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.payMethod.receivedB2BVNLCheckbox) + }, selectors.clientPayMethod.receivedB2BVNLCheckbox) .then(value => { expect(value).toBeFalsy(); done(); diff --git a/e2e/paths/05_add_address.spec.js b/e2e/paths/client-module/05_add_address.spec.js similarity index 77% rename from e2e/paths/05_add_address.spec.js rename to e2e/paths/client-module/05_add_address.spec.js index 45a066932..d90f7d775 100644 --- a/e2e/paths/05_add_address.spec.js +++ b/e2e/paths/client-module/05_add_address.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('Add address path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.addresses.addressesButton) + .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('addresses/list') .url() .then(url => { @@ -73,7 +73,7 @@ describe('Add address path', () => { it(`should click on the add new address button to access to the new address form`, done => { nightmare - .waitToClick(selectors.addresses.createAddress) + .waitToClick(selectors.clientAddresses.createAddress) .waitForURL('addresses/create') .url() .then(url => { @@ -85,8 +85,8 @@ describe('Add address path', () => { it('should check the default checkbox then receive an error after clicking save button as the form is empty', done => { nightmare - .waitToClick(selectors.addresses.defaultCheckboxInput) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientAddresses.defaultCheckboxInput) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -99,7 +99,7 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but consignee', done => { nightmare .waitForSnackbarReset() - .type(selectors.addresses.consigneeInput, 'Bruce Bunner') + .type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner') .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -113,8 +113,8 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but Street', done => { nightmare .waitForSnackbarReset() - .clearInput(selectors.addresses.consigneeInput) - .type(selectors.addresses.streetAddressInput, '320 Park Avenue New York') + .clearInput(selectors.clientAddresses.consigneeInput) + .type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York') .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -128,8 +128,8 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but postcode', done => { nightmare .waitForSnackbarReset() - .clearInput(selectors.addresses.streetAddressInput) - .type(selectors.addresses.postcodeInput, '10022') + .clearInput(selectors.clientAddresses.streetAddressInput) + .type(selectors.clientAddresses.postcodeInput, '10022') .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -143,8 +143,8 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but city', done => { nightmare .waitForSnackbarReset() - .clearInput(selectors.addresses.postcodeInput) - .type(selectors.addresses.cityInput, 'New York') + .clearInput(selectors.clientAddresses.postcodeInput) + .type(selectors.clientAddresses.cityInput, 'New York') .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -158,9 +158,9 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but province', done => { nightmare .waitForSnackbarReset() - .clearInput(selectors.addresses.cityInput) - .waitToClick(selectors.addresses.provinceInput) - .waitToClick(selectors.addresses.provinceSecondOption) + .clearInput(selectors.clientAddresses.cityInput) + .waitToClick(selectors.clientAddresses.provinceInput) + .waitToClick(selectors.clientAddresses.provinceSecondOption) .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -174,8 +174,8 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but province and agency', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.addresses.agencyInput) - .waitToClick(selectors.addresses.agenctySecondOption) + .waitToClick(selectors.clientAddresses.agencyInput) + .waitToClick(selectors.clientAddresses.agenctySecondOption) .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -189,7 +189,7 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but province, agency and phone', done => { nightmare .waitForSnackbarReset() - .type(selectors.addresses.phoneInput, '999887744') + .type(selectors.clientAddresses.phoneInput, '999887744') .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -203,8 +203,8 @@ describe('Add address path', () => { it('should receive an error when clicking the save button having all the form fields empty but province, agency and mobile', done => { nightmare .waitForSnackbarReset() - .clearInput(selectors.addresses.phoneInput) - .type(selectors.addresses.mobileInput, '999887744') + .clearInput(selectors.clientAddresses.phoneInput) + .type(selectors.clientAddresses.mobileInput, '999887744') .click(selectors.createClientView.createButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -218,12 +218,12 @@ describe('Add address path', () => { it(`should create a new address with all it's data`, done => { nightmare .waitForSnackbarReset() - .type(selectors.addresses.consigneeInput, 'Bruce Bunner') - .type(selectors.addresses.streetAddressInput, '320 Park Avenue New York') - .type(selectors.addresses.postcodeInput, '10022') - .type(selectors.addresses.cityInput, 'New York') - .type(selectors.addresses.phoneInput, '999887744') - .click(selectors.addresses.saveButton) + .type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner') + .type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York') + .type(selectors.clientAddresses.postcodeInput, '10022') + .type(selectors.clientAddresses.cityInput, 'New York') + .type(selectors.clientAddresses.phoneInput, '999887744') + .click(selectors.clientAddresses.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -236,9 +236,9 @@ describe('Add address path', () => { it(`should click on the addresses button confirm the new address exists and it's the default one`, done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.addresses.addressesButton) - .wait(selectors.addresses.defaultAddress) - .getInnerText(selectors.addresses.defaultAddress) + .waitToClick(selectors.clientAddresses.addressesButton) + .wait(selectors.clientAddresses.defaultAddress) + .getInnerText(selectors.clientAddresses.defaultAddress) .then(result => { expect(result).toContain('320 Park Avenue New York'); done(); @@ -249,9 +249,9 @@ describe('Add address path', () => { it(`should click on the make default icon of the second address then confirm it is the default one now`, done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.addresses.secondMakeDefaultStar) - .waitForTextInElement(selectors.addresses.defaultAddress, 'Somewhere in Thailand') - .getInnerText(selectors.addresses.defaultAddress) + .waitToClick(selectors.clientAddresses.secondMakeDefaultStar) + .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') + .getInnerText(selectors.clientAddresses.defaultAddress) .then(result => { expect(result).toContain('Somewhere in Thailand'); done(); @@ -261,8 +261,8 @@ describe('Add address path', () => { it(`should click on the edit icon of the default address`, done => { nightmare - .waitForTextInElement(selectors.addresses.defaultAddress, 'Somewhere in Thailand') - .waitToClick(selectors.addresses.firstEditButton) + .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') + .waitToClick(selectors.clientAddresses.firstEditButton) .waitForURL('/edit') .url() .then(result => { @@ -275,8 +275,8 @@ describe('Add address path', () => { it(`should click on the active checkbox and receive an error to save it becouse it is the default address`, done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.addresses.activeCheckbox) - .waitToClick(selectors.addresses.saveButton) + .waitToClick(selectors.clientAddresses.activeCheckbox) + .waitToClick(selectors.clientAddresses.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { diff --git a/e2e/paths/06_add_address_notes.spec.js b/e2e/paths/client-module/06_add_address_notes.spec.js similarity index 83% rename from e2e/paths/06_add_address_notes.spec.js rename to e2e/paths/client-module/06_add_address_notes.spec.js index 349d25093..dae6b4817 100644 --- a/e2e/paths/06_add_address_notes.spec.js +++ b/e2e/paths/client-module/06_add_address_notes.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('Add address notes path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.addresses.addressesButton) + .waitToClick(selectors.clientAddresses.addressesButton) .waitForURL('addresses/list') .url() .then(url => { @@ -73,8 +73,8 @@ describe('Add address notes path', () => { it(`should click on the edit icon of the default address`, done => { nightmare - .waitForTextInElement(selectors.addresses.defaultAddress, 'Somewhere in Thailand') - .waitToClick(selectors.addresses.firstEditButton) + .waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand') + .waitToClick(selectors.clientAddresses.firstEditButton) .waitForURL('/edit') .url() .then(result => { @@ -86,8 +86,8 @@ describe('Add address notes path', () => { // it('should add as many notes as observation types', done => { // nightmare - // .waitToClick(selectors.addresses.defaultCheckboxInput) - // .waitToClick(selectors.fiscalData.saveButton) + // .waitToClick(selectors.clientAddresses.defaultCheckboxInput) + // .waitToClick(selectors.clientFiscalData.saveButton) // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { diff --git a/e2e/paths/07_edit_web_access.spec.js b/e2e/paths/client-module/07_edit_web_access.spec.js similarity index 72% rename from e2e/paths/07_edit_web_access.spec.js rename to e2e/paths/client-module/07_edit_web_access.spec.js index 6bb20d593..10619ebcf 100644 --- a/e2e/paths/07_edit_web_access.spec.js +++ b/e2e/paths/client-module/07_edit_web_access.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('Edit web access path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.webAccess.webAccessButton) + .waitToClick(selectors.clientWebAccess.webAccessButton) .waitForURL('web-access') .url() .then(url => { @@ -73,8 +73,8 @@ describe('Edit web access path', () => { it(`should click on the Enable web access checkbox to uncheck it`, done => { nightmare - .waitToClick(selectors.webAccess.enableWebAccessCheckbox) - .waitToClick(selectors.fiscalData.saveButton) + .waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox) + .waitToClick(selectors.clientFiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -87,13 +87,13 @@ describe('Edit web access path', () => { it('should confirm Enable web access checkbox is unchecked', done => { nightmare .waitForSnackbarReset() - .waitToClick(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .waitToClick(selectors.webAccess.webAccessButton) - .wait(selectors.webAccess.enableWebAccessCheckbox) + .waitToClick(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .waitToClick(selectors.clientWebAccess.webAccessButton) + .wait(selectors.clientWebAccess.enableWebAccessCheckbox) .evaluate(selector => { return document.querySelector(selector).checked; - }, selectors.webAccess.enableWebAccessCheckbox) + }, selectors.clientWebAccess.enableWebAccessCheckbox) .then(value => { expect(value).toBeFalsy(); done(); @@ -103,10 +103,10 @@ describe('Edit web access path', () => { it('should edit the User name', done => { nightmare - .wait(selectors.webAccess.userNameInput) - .clearInput(selectors.webAccess.userNameInput) - .type(selectors.webAccess.userNameInput, 'Hulk') - .click(selectors.webAccess.saveButton) + .wait(selectors.clientWebAccess.userNameInput) + .clearInput(selectors.clientWebAccess.userNameInput) + .type(selectors.clientWebAccess.userNameInput, 'Hulk') + .click(selectors.clientWebAccess.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -119,11 +119,12 @@ describe('Edit web access path', () => { it('should confirm the User name have been edited', done => { nightmare .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.webAccess.webAccessButton) - .wait(selectors.webAccess.userNameInput) - .getInputValue(selectors.webAccess.userNameInput) + .click(selectors.clientBasicData.basicDataButton) + .wait(selectors.clientBasicData.nameInput) + .click(selectors.clientWebAccess.webAccessButton) + .wait(selectors.clientWebAccess.userNameInput) + .waitForTextInInput(selectors.clientWebAccess.userNameInput, 'Hulk') + .getInputValue(selectors.clientWebAccess.userNameInput) .then(result => { expect(result).toEqual('Hulk'); done(); diff --git a/e2e/paths/08_add_notes.spec.js b/e2e/paths/client-module/08_add_notes.spec.js similarity index 83% rename from e2e/paths/08_add_notes.spec.js rename to e2e/paths/client-module/08_add_notes.spec.js index c8f12209c..1e78f3a1f 100644 --- a/e2e/paths/08_add_notes.spec.js +++ b/e2e/paths/client-module/08_add_notes.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('Add notes path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.notes.notesButton) + .waitToClick(selectors.clientNotes.notesButton) .waitForURL('notes/list') .url() .then(url => { @@ -73,7 +73,7 @@ describe('Add notes path', () => { it(`should click on the add note button`, done => { nightmare - .waitToClick(selectors.notes.addNoteFloatButton) + .waitToClick(selectors.clientNotes.addNoteFloatButton) .waitForURL('/notes/create') .url() .then(url => { @@ -85,8 +85,8 @@ describe('Add notes path', () => { it(`should create a note`, done => { nightmare - .type(selectors.notes.noteInput, 'Meeting with Black Widow 21st 9am') - .click(selectors.notes.saveButton) + .type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am') + .click(selectors.clientNotes.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -99,8 +99,8 @@ describe('Add notes path', () => { it('should confirm the note was created', done => { nightmare .waitForSnackbarReset() - .wait(selectors.notes.firstNoteText) - .getInnerText(selectors.notes.firstNoteText) + .wait(selectors.clientNotes.firstNoteText) + .getInnerText(selectors.clientNotes.firstNoteText) .then(value => { expect(value).toEqual('Meeting with Black Widow 21st 9am'); done(); diff --git a/e2e/paths/09_add_credit.spec.js b/e2e/paths/client-module/09_add_credit.spec.js similarity index 82% rename from e2e/paths/09_add_credit.spec.js rename to e2e/paths/client-module/09_add_credit.spec.js index a106bfd27..4608755ce 100644 --- a/e2e/paths/09_add_credit.spec.js +++ b/e2e/paths/client-module/09_add_credit.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('Add credit path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.credit.creditButton) + .waitToClick(selectors.clientCredit.creditButton) .waitForURL('credit/list') .url() .then(url => { @@ -73,7 +73,7 @@ describe('Add credit path', () => { it(`should click on the add credit button`, done => { nightmare - .waitToClick(selectors.credit.addCreditFloatButton) + .waitToClick(selectors.clientCredit.addCreditFloatButton) .waitForURL('/credit/create') .url() .then(url => { @@ -85,9 +85,9 @@ describe('Add credit path', () => { it(`should edit the credit`, done => { nightmare - .clearInput(selectors.credit.creditInput) - .type(selectors.credit.creditInput, 999) - .click(selectors.credit.saveButton) + .clearInput(selectors.clientCredit.creditInput) + .type(selectors.clientCredit.creditInput, 999) + .click(selectors.clientCredit.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -100,8 +100,8 @@ describe('Add credit path', () => { it('should confirm the credit was updated', done => { nightmare .waitForSnackbarReset() - .wait(selectors.credit.firstCreditText) - .getInnerText(selectors.credit.firstCreditText) + .wait(selectors.clientCredit.firstCreditText) + .getInnerText(selectors.clientCredit.firstCreditText) .then(value => { expect(value).toContain(999); done(); diff --git a/e2e/paths/10_add_greuge.spec.js b/e2e/paths/client-module/10_add_greuge.spec.js similarity index 78% rename from e2e/paths/10_add_greuge.spec.js rename to e2e/paths/client-module/10_add_greuge.spec.js index 594193321..5e35e5801 100644 --- a/e2e/paths/10_add_greuge.spec.js +++ b/e2e/paths/client-module/10_add_greuge.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('Add greuge path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.greuge.greugeButton) + .waitToClick(selectors.clientGreuge.greugeButton) .waitForURL('greuge/list') .url() .then(url => { @@ -73,7 +73,7 @@ describe('Add greuge path', () => { it(`should click on the add greuge button`, done => { nightmare - .waitToClick(selectors.greuge.addGreugeFloatButton) + .waitToClick(selectors.clientGreuge.addGreugeFloatButton) .waitForURL('greuge/create') .url() .then(url => { @@ -85,7 +85,7 @@ describe('Add greuge path', () => { it(`should receive an error if all fields are empty but date on submit`, done => { nightmare - .click(selectors.credit.saveButton) + .click(selectors.clientCredit.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -97,8 +97,8 @@ describe('Add greuge path', () => { it(`should receive an error if all fields are empty but date and amount on submit`, done => { nightmare - .type(selectors.greuge.amountInput, 999) - .click(selectors.greuge.saveButton) + .type(selectors.clientGreuge.amountInput, 999) + .click(selectors.clientGreuge.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -110,9 +110,9 @@ describe('Add greuge path', () => { it(`should receive an error if all fields are empty but date and description on submit`, done => { nightmare - .clearInput(selectors.greuge.amountInput) - .type(selectors.greuge.descriptionInput, 'new armor for Batman!') - .click(selectors.greuge.saveButton) + .clearInput(selectors.clientGreuge.amountInput) + .type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!') + .click(selectors.clientGreuge.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -124,10 +124,10 @@ describe('Add greuge path', () => { it(`should receive an error if all fields are empty but date and type on submit`, done => { nightmare - .clearInput(selectors.greuge.descriptionInput) - .waitToClick(selectors.greuge.typeInput) - .waitToClick(selectors.greuge.typeSecondOption) - .click(selectors.greuge.saveButton) + .clearInput(selectors.clientGreuge.descriptionInput) + .waitToClick(selectors.clientGreuge.typeInput) + .waitToClick(selectors.clientGreuge.typeSecondOption) + .click(selectors.clientGreuge.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -139,10 +139,10 @@ describe('Add greuge path', () => { it(`should create a new greuge with all its data`, done => { nightmare - .clearInput(selectors.greuge.amountInput) - .type(selectors.greuge.amountInput, 999) - .type(selectors.greuge.descriptionInput, 'new armor for Batman!') - .click(selectors.greuge.saveButton) + .clearInput(selectors.clientGreuge.amountInput) + .type(selectors.clientGreuge.amountInput, 999) + .type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!') + .click(selectors.clientGreuge.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -155,8 +155,8 @@ describe('Add greuge path', () => { it('should confirm the greuge was added to the list', done => { nightmare .waitForSnackbarReset() - .wait(selectors.greuge.firstGreugeText) - .getInnerText(selectors.greuge.firstGreugeText) + .wait(selectors.clientGreuge.firstGreugeText) + .getInnerText(selectors.clientGreuge.firstGreugeText) .then(value => { expect(value).toContain(999); expect(value).toContain('new armor for Batman!'); diff --git a/e2e/paths/11_mandate.spec.js b/e2e/paths/client-module/11_mandate.spec.js similarity index 86% rename from e2e/paths/11_mandate.spec.js rename to e2e/paths/client-module/11_mandate.spec.js index 02a1f9b86..c0e535535 100644 --- a/e2e/paths/11_mandate.spec.js +++ b/e2e/paths/client-module/11_mandate.spec.js @@ -1,7 +1,7 @@ -import config from '../helpers/config.js'; -import createNightmare from '../helpers/nightmare'; -import selectors from '../helpers/selectors.js'; -import {catchErrors} from '../../services/utils/jasmineHelpers'; +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 = '#!/'; @@ -61,7 +61,7 @@ describe('mandate path', () => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter') .waitToClick(selectors.clientsIndex.searchResult) - .waitToClick(selectors.mandate.mandateButton) + .waitToClick(selectors.clientMandate.mandateButton) .waitForURL('mandate') .url() .then(url => { @@ -73,8 +73,8 @@ describe('mandate path', () => { it('should confirm the client has a mandate of the CORE type', done => { nightmare - .wait(selectors.mandate.firstMandateText) - .getInnerText(selectors.mandate.firstMandateText) + .wait(selectors.clientMandate.firstMandateText) + .getInnerText(selectors.clientMandate.firstMandateText) .then(value => { expect(value).toContain('1'); expect(value).toContain('WAY'); diff --git a/e2e/paths/item-module/06_create_item_barcode.spec.js b/e2e/paths/item-module/06_create_item_barcode.spec.js new file mode 100644 index 000000000..46c7245d1 --- /dev/null +++ b/e2e/paths/item-module/06_create_item_barcode.spec.js @@ -0,0 +1,43 @@ +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; + +fdescribe('create item barcodes 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 access to the items index by clicking the items button', done => { + nightmare + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .url() + .then(url => { + expect(url).toEqual(config.url + '#!/item/list'); + done(); + }) + .catch(catchErrors(done)); + }); +});