diff --git a/client/client/routes.json b/client/client/routes.json index d8d0fbc039..a6fcb50362 100644 --- a/client/client/routes.json +++ b/client/client/routes.json @@ -136,10 +136,8 @@ "menu": { "description": "Credit", "icon": "credit_card" - }, - "acl": ["manager", "salesAssistant", "teamBoss", "teamManager"] - }, - { + } + }, { "url": "/create", "state": "clientCard.credit.create", "component": "vn-client-credit-create", diff --git a/client/client/src/address-create/address-create.html b/client/client/src/address-create/address-create.html index 8f2cf15426..c1b5d7a3fe 100644 --- a/client/client/src/address-create/address-create.html +++ b/client/client/src/address-create/address-create.html @@ -18,7 +18,7 @@ - + - + 0 || observationsObj.create.length > 0 || observationsObj.delete.length > 0; + canObservationsSubmit = observationsObj.update.length > 0 || observationsObj.create.length > 0 || observationsObj.delete.length > 0; if (repeatedTypes) { this.vnApp.showMessage( this.$translate.instant('The observation type must be unique') ); - } else if (submitWatcher && !submitObservations) { + } else if (canWatcherSubmit && !canObservationsSubmit) { this.$scope.watcher.submit().then(() => { this.$state.go('clientCard.addresses.list', {id: this.$state.params.id}); }); - } else if (!submitWatcher && submitObservations) { + } else if (!canWatcherSubmit && canObservationsSubmit) { this._submitObservations(observationsObj).then(() => { this.$state.go('clientCard.addresses.list', {id: this.$state.params.id}); }); - } else if (submitWatcher && submitObservations) { + } else if (canWatcherSubmit && canObservationsSubmit) { this.$q.all([this.$scope.watcher.submit(), this._submitObservations(observationsObj)]).then(() => { this.$state.go('clientCard.addresses.list', {id: this.$state.params.id}); }); diff --git a/client/core/src/directives/specs/zoom-image.spec.js b/client/core/src/directives/specs/zoom-image.spec.js index 85787bd4b0..53640558c4 100644 --- a/client/core/src/directives/specs/zoom-image.spec.js +++ b/client/core/src/directives/specs/zoom-image.spec.js @@ -41,9 +41,8 @@ describe('Directive zoomImage', () => { it('should detroy zoom container when click outside zoomed image', () => { let image = getCompiledImage(``); image[0].click(); - findContainer = document.getElementById(idContainer); - let findOutsideImage = findContainer.querySelector('.zoomImage-background'); + let findOutsideImage = document.querySelector('.zoomImage-background'); findOutsideImage.click(); findContainer = document.getElementById(idContainer); diff --git a/e2e/helpers/components_selectors.js b/e2e/helpers/components_selectors.js index 4b33bce61d..fb868b0d6f 100644 --- a/e2e/helpers/components_selectors.js +++ b/e2e/helpers/components_selectors.js @@ -12,6 +12,7 @@ export default { vnModuleContainer: 'vn-module-container > a', vnSearchBar: 'vn-searchbar > form > vn-horizontal', vnItemClient: 'vn-item-client', + vnItemProduct: 'vn-item-product', vnFloatButton: 'vn-float-button > button', vnMenuItem: 'vn-menu-item > li > a', vnAutocomplete: 'vn-autocomplete', diff --git a/e2e/helpers/extensions.js b/e2e/helpers/extensions.js index f7a568d826..d8e3151571 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 06fc42a0ee..38d312ffb2 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,13 +83,13 @@ 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`, consigneeInput: `${components.vnTextfield}[name="nickname"]`, streetAddressInput: `${components.vnTextfield}[name="street"]`, - postcodeInput: `${components.vnTextfield}[name="postcode"]`, + postcodeInput: `${components.vnTextfield}[name="postalCode"]`, cityInput: `${components.vnTextfield}[name="city"]`, provinceInput: `${components.vnAutocomplete}[field="$ctrl.address.provinceFk"] > vn-vertical > ${components.vnTextfield}`, provinceSecondOption: `${components.vnAutocomplete}[field="$ctrl.address.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, @@ -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,18 @@ 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}`, + searchResult: `${components.vnItemProduct} > vn-horizontal`, + searchItemInput: `${components.vnTextfield}`, + searchButton: `${components.vnSearchBar} > vn-icon-button > button` + }, + itemBarcodes: { + barcodeButton: `${components.vnMenuItem}[ui-sref="item.card.itemBarcode"]` } }; + 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 48dd08a77f..f8a32a1faa 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 ef8a6b388a..1a96498446 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 495f3c42a2..b3b4d416e5 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 2ea65e9360..c03934e87e 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 45a0669324..d90f7d7754 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 349d25093f..dae6b4817d 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 6bb20d593b..10619ebcf3 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 c8f12209c6..1e78f3a1f9 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 a106bfd27f..4608755ce5 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 594193321d..5e35e5801e 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 02a1f9b86b..c0e5355352 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 0000000000..af0a2bce22 --- /dev/null +++ b/e2e/paths/item-module/06_create_item_barcode.spec.js @@ -0,0 +1,71 @@ +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('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)); + }); + + it('should search for the item Gem of Time', done => { + nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + done(); + }) + .catch(catchErrors(done)); + }); + + // it(`should click on the search result to access to the item barcodes`, done => { + // nightmare + // .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + // .waitToClick(selectors.itemsIndex.searchResult) + // .waitToClick(selectors.itemBarcodes.barcodeButton) + // .waitForURL('barcode') + // .url() + // .then(url => { + // expect(url).toContain('barcode'); + // done(); + // }) + // .catch(catchErrors(done)); + // }); +}); diff --git a/package-lock.json b/package-lock.json index b8a491a425..8d9be895fd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -118,7 +118,7 @@ "angular": { "version": "1.6.8", "resolved": "https://registry.npmjs.org/angular/-/angular-1.6.8.tgz", - "integrity": "sha512-9WErZIOw1Cu1V5Yxdvxz/6YpND8ntdP71fdPpufPFJvZodZXqCjQBYrHqEoMZreO5i84O3D/Jw/vepoFt68Azw==" + "integrity": "sha1-W+N4pYvpGlSJ54tZxFGM2f0nP/s=" }, "angular-cookies": { "version": "1.6.4", @@ -5049,12 +5049,6 @@ "integrity": "sha1-Hn1Khr9JF5gFxGIugyp7G+606IE=", "dev": true }, - "eslint-plugin-angular": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-angular/-/eslint-plugin-angular-1.4.1.tgz", - "integrity": "sha1-ekJ55yLUXg5Bm9Nik3PvXQZqoOM=", - "dev": true - }, "eslint-plugin-html": { "version": "4.0.2", "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-4.0.2.tgz", @@ -11104,7 +11098,7 @@ "karma-firefox-launcher": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/karma-firefox-launcher/-/karma-firefox-launcher-1.1.0.tgz", - "integrity": "sha512-LbZ5/XlIXLeQ3cqnCbYLn+rOVhuMIK9aZwlP6eOLGzWdo1UVp7t6CN3DP4SafiRLjexKwHeKHDm0c38Mtd3VxA==", + "integrity": "sha1-LEcDBFLwRTHrfRPU/HZpYwu5Mzk=", "dev": true }, "karma-jasmine": { @@ -11125,7 +11119,7 @@ "karma-webpack": { "version": "2.0.9", "resolved": "https://registry.npmjs.org/karma-webpack/-/karma-webpack-2.0.9.tgz", - "integrity": "sha512-F1j3IG/XhiMzcunAXbWXH95uizjzr3WdTzmVWlta8xqxcCtAu9FByCb4sccIMxaVFAefpgnUW9KlCo0oLvIX6A==", + "integrity": "sha1-YciAkffdkQY1E0wDKyZqRlr/tX8=", "dev": true, "requires": { "async": "0.9.2", diff --git a/package.json b/package.json index 1cac64134f..059a1bedd7 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "eslint-config-google": "^0.6.0", "eslint-config-loopback": "^4.0.0", "eslint-config-xo": "^0.17.0", - "eslint-plugin-angular": "^1.4.1", "eslint-plugin-jasmine": "^2.8.4", "fancy-log": "^1.3.2", "file-loader": "^1.1.6", diff --git a/services/item/common/methods/item/filter.js b/services/item/common/methods/item/filter.js index 5db641a043..f85db929bc 100644 --- a/services/item/common/methods/item/filter.js +++ b/services/item/common/methods/item/filter.js @@ -19,12 +19,37 @@ module.exports = Self => { delete params.size; delete params.order; + if (params.search) { + filter.where.and = [ + { + or: [ + {id: params.search}, + {name: {regexp: params.search}} + ] + } + ]; + delete params.search; + } + if (params.itemSize) { - filter.where.size = params.itemSize; + params.size = params.itemSize; delete params.itemSize; } - Object.assign(filter.where, params); + let keys = Object.keys(params); + if (keys.length) { + keys.forEach( + key => { + if (filter.where.and) { + let filter = {}; + filter[key] = (key === 'description') ? {regexp: params[key]} : params[key]; + filter.where.and.push(filter); + } else { + filter.where[key] = (key === 'description') ? {regexp: params[key]} : params[key]; + } + } + ); + } return filter; } diff --git a/services/item/common/models/genus.json b/services/item/common/models/genus.json new file mode 100644 index 0000000000..4f269200ba --- /dev/null +++ b/services/item/common/models/genus.json @@ -0,0 +1,28 @@ +{ + "name": "Genus", + "base": "VnModel", + "options": { + "mysql": { + "table": "genus" + } + }, + "properties": { + "genus_id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "latin_genus_name": { + "type": "String" + }, + "entry_date": { + "type": "date" + }, + "expiry_date": { + "type": "date" + }, + "change_date_time": { + "type": "date" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/item-botanical.json b/services/item/common/models/item-botanical.json new file mode 100644 index 0000000000..655f0d48cf --- /dev/null +++ b/services/item/common/models/item-botanical.json @@ -0,0 +1,36 @@ +{ + "name": "ItemBotanical", + "base": "VnModel", + "options": { + "mysql": { + "table": "itemBotanical" + } + }, + "properties": { + "itemFk": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "botanical": { + "type": "String" + } + }, + "relations": { + "item": { + "type": "belongsTo", + "model": "Item", + "foreignKey": "itemFk" + }, + "genus": { + "type": "belongsTo", + "model": "Genus", + "foreignKey": "genusFk" + }, + "specie": { + "type": "belongsTo", + "model": "Specie", + "foreignKey": "specieFk" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/item-placement.json b/services/item/common/models/item-placement.json new file mode 100644 index 0000000000..c2d779fcd0 --- /dev/null +++ b/services/item/common/models/item-placement.json @@ -0,0 +1,26 @@ +{ + "name": "ItemPlacement", + "base": "VnModel", + "options": { + "mysql": { + "table": "itemPlacement" + } + }, + "properties": { + "code": { + "type": "String" + } + }, + "relations": { + "item": { + "type": "belongsTo", + "model": "Item", + "foreignKey": "itemFk" + }, + "warehouse": { + "type": "belongsTo", + "model": "Warehouse", + "foreignKey": "warehouseFk" + } + } +} \ No newline at end of file diff --git a/services/item/common/models/specie.json b/services/item/common/models/specie.json new file mode 100644 index 0000000000..c8f9818fc0 --- /dev/null +++ b/services/item/common/models/specie.json @@ -0,0 +1,35 @@ +{ + "name": "Specie", + "base": "VnModel", + "options": { + "mysql": { + "table": "specie" + } + }, + "properties": { + "specie_id": { + "type": "Number", + "id": true, + "description": "Identifier" + }, + "latin_species_name": { + "type": "String" + }, + "entry_date": { + "type": "date" + }, + "expiry_date": { + "type": "date" + }, + "change_date_time": { + "type": "date" + } + }, + "relations": { + "genus": { + "type": "belongsTo", + "model": "Genus", + "foreignKey": "genus_id" + } + } +} \ No newline at end of file diff --git a/services/item/server/model-config.json b/services/item/server/model-config.json index 8c1e5d26bf..c021a3fabf 100644 --- a/services/item/server/model-config.json +++ b/services/item/server/model-config.json @@ -40,5 +40,17 @@ }, "ItemBarcode": { "dataSource": "vn" + }, + "ItemBotanical": { + "dataSource": "vn" + }, + "ItemPlacement": { + "dataSource": "vn" + }, + "Specie": { + "dataSource": "edi" + }, + "Genus": { + "dataSource": "edi" } } diff --git a/services/loopback/common/methods/client/activeSalesPerson.js b/services/loopback/common/methods/client/activeSalesPerson.js index 5c1bb19f24..27060d1e45 100644 --- a/services/loopback/common/methods/client/activeSalesPerson.js +++ b/services/loopback/common/methods/client/activeSalesPerson.js @@ -30,7 +30,7 @@ module.exports = Client => { FROM worker em JOIN account.user ac ON em.userFk = ac.id JOIN account.role r ON r.id = ac.role - WHERE ac.active AND r.\`name\` = 'salesPerson' ${where.sql} + WHERE ac.active ${where.sql} ORDER BY em.name ASC LIMIT ? OFFSET ?`; diff --git a/services/loopback/common/methods/client/listAddresses.js b/services/loopback/common/methods/client/listAddresses.js index 0c93dd1cdf..cbd556c80f 100644 --- a/services/loopback/common/methods/client/listAddresses.js +++ b/services/loopback/common/methods/client/listAddresses.js @@ -38,7 +38,7 @@ module.exports = function(Client) { }, skip: (params.page - 1) * params.size, limit: params.size, - order: ['isDefaultAddress DESC', 'isActive DESC'], + order: ['isDefaultAddress DESC', 'isActive DESC', 'nickname DESC'], include: {observations: 'observationType'} }; @@ -67,5 +67,4 @@ module.exports = function(Client) { response('total', total); }); }; - }; diff --git a/services/loopback/common/models/account.js b/services/loopback/common/models/account.js index 4209ca51a0..d58ad5f604 100644 --- a/services/loopback/common/models/account.js +++ b/services/loopback/common/models/account.js @@ -1,7 +1,16 @@ +const md5 = require('md5'); + module.exports = function(Self) { // Validations Self.validatesUniquenessOf('name', { message: 'Ya existe un usuario con ese nombre' }); + + Self.observe('before save', (ctx, next) => { + if (ctx.currentInstance && ctx.currentInstance.id && ctx.data && ctx.data.password) { + ctx.data.password = md5(ctx.data.password); + } + next(); + }); }; diff --git a/services/loopback/common/validations/validateDni.js b/services/loopback/common/validations/validateDni.js index 242746ae95..4f8a3089be 100644 --- a/services/loopback/common/validations/validateDni.js +++ b/services/loopback/common/validations/validateDni.js @@ -69,6 +69,9 @@ module.exports = fi => { const dniLetterAscii = parseInt(dniLetterCountry.charCodeAt(0)); let dniValue = false; switch (true) { + case (dni.length === 9 && !isNaN(dni)): // dni Portugal (9 digitos) + dniValue = true; + break; case (dniLetterAscii >= 88 && dniLetterAscii <= 90): // X-Z dniValue = getDniForeign(dniNumeric, dniLetter); break; @@ -81,7 +84,7 @@ module.exports = fi => { case (dniLetterAscii === 73): // I dniValue = getDniItaly(dniLetterCountry); break; - case (dniLetterAscii >= 48 && dniLetterAscii <= 57): // 0- 9 + case (dni.length === 9 && dniLetterAscii >= 48 && dniLetterAscii <= 57): // 0- 9 dniValue = getDniSpain(dniNumeric, dniLetter); break; default: diff --git a/services/loopback/server/datasources.json b/services/loopback/server/datasources.json index 1ff4df5902..da7bcd44ad 100644 --- a/services/loopback/server/datasources.json +++ b/services/loopback/server/datasources.json @@ -34,5 +34,16 @@ "password": "", "connectTimeout": 20000, "acquireTimeout": 20000 + }, + "edi": { + "connector": "mysql", + "database": "edi", + "debug": false, + "host": "localhost", + "port": 3306, + "username": "root", + "password": "", + "connectTimeout": 20000, + "acquireTimeout": 20000 } }