diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 18aef276c..0e47740ef 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -55,6 +55,8 @@ export default { addressInput: `${components.vnTextfield}[name="street"]`, cityInput: `${components.vnTextfield}[name="city"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`, + provinceInput: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > ${components.vnTextfield}`, + provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(2) > ul > li:nth-child(5)`, saveButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-auto > vn-vertical > vn-client-fiscal-data > form > vn-button-bar > vn-submit > input' } }; diff --git a/e2e/paths/edit_basic_data.spec.js.js b/e2e/paths/edit_basic_data.spec.js similarity index 84% rename from e2e/paths/edit_basic_data.spec.js.js rename to e2e/paths/edit_basic_data.spec.js index 0c8436a0c..6ebaeeaf1 100644 --- a/e2e/paths/edit_basic_data.spec.js.js +++ b/e2e/paths/edit_basic_data.spec.js @@ -45,7 +45,7 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - it(`should search for the user Bruce Wayne`, done => { + it('should search for the user Bruce Wayne', done => { nightmare .wait(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne') @@ -59,7 +59,7 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - it(`should click on the search result to access to the client's basic data`, done => { + it('should click on the search result to access to the clients basic data', done => { nightmare .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne') .waitToClick(selectors.clientsIndex.searchResult) @@ -72,7 +72,7 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - it(`should edit the name`, done => { + it('should edit the name', done => { nightmare .wait(selectors.basicData.nameInput) .clearInput(selectors.basicData.nameInput) @@ -81,13 +81,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the name have been edited`, done => { + it('should confirm the name have been edited', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) @@ -96,13 +96,13 @@ describe('Edit basicData path', () => { .wait(selectors.basicData.nameInput) .getInputValue(selectors.basicData.nameInput) .then(result => { - expect(result).toEqual(`Carol Danvers Edited`); + expect(result).toEqual('Carol Danvers Edited'); done(); }) .catch(catchErrors(done)); }); - it(`should edit the tax number`, done => { + it('should edit the tax number', done => { nightmare .wait(selectors.basicData.taxNumberInput) .clearInput(selectors.basicData.taxNumberInput) @@ -111,13 +111,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the tax number have been edited`, done => { + it('should confirm the tax number have been edited', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) @@ -126,13 +126,13 @@ describe('Edit basicData path', () => { .wait(selectors.basicData.taxNumberInput) .getInputValue(selectors.basicData.taxNumberInput) .then(result => { - expect(result).toEqual(`AVG tax Edited`); + expect(result).toEqual('AVG tax Edited'); done(); }) .catch(catchErrors(done)); }); - it(`should edit the social name`, done => { + it('should edit the social name', done => { nightmare .wait(selectors.basicData.socialNameInput) .clearInput(selectors.basicData.socialNameInput) @@ -141,13 +141,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the social name have been edited`, done => { + it('should confirm the social name have been edited', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) @@ -156,13 +156,13 @@ describe('Edit basicData path', () => { .wait(selectors.basicData.socialNameInput) .getInputValue(selectors.basicData.socialNameInput) .then(result => { - expect(result).toEqual(`Avengers Team Edited`); + expect(result).toEqual('Avengers Team Edited'); done(); }) .catch(catchErrors(done)); }); - it(`should add the landline phone number`, done => { + it('should add the landline phone number', done => { nightmare .wait(selectors.basicData.phoneInput) .clearInput(selectors.basicData.phoneInput) @@ -171,13 +171,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the landline phone number have been added`, done => { + it('should confirm the landline phone number have been added', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) @@ -192,7 +192,7 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - it(`should add the mobile phone number`, done => { + it('should add the mobile phone number', done => { nightmare .wait(selectors.basicData.mobileInput) .clearInput(selectors.basicData.mobileInput) @@ -201,13 +201,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the mobile phone number have been added`, done => { + it('should confirm the mobile phone number have been added', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) @@ -222,7 +222,7 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - it(`should add the fax number`, done => { + it('should add the fax number', done => { nightmare .wait(selectors.basicData.faxInput) .clearInput(selectors.basicData.faxInput) @@ -231,13 +231,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the fax number have been added`, done => { + it('should confirm the fax number have been added', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) @@ -252,7 +252,7 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - it(`should edit the email`, done => { + it('should edit the email', done => { nightmare .wait(selectors.basicData.emailInput) .clearInput(selectors.basicData.emailInput) @@ -261,13 +261,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the email have been edited`, done => { + it('should confirm the email have been edited', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) @@ -282,7 +282,7 @@ describe('Edit basicData path', () => { .catch(catchErrors(done)); }); - // it(`should select the sales person`, done => { + // it('should select the sales person', done => { // nightmare // .wait(selectors.basicData.salesPersonInput) // .select(selectors.basicData.salesPersonInput, '') // not working quite yet @@ -290,13 +290,13 @@ describe('Edit basicData path', () => { // .wait(selectors.globalItems.snackbarIsActive) // .getInnerText(selectors.globalItems.snackbarIsActive) // .then(result => { - // expect(result).toEqual(`¡Datos guardados!`); + // expect(result).toEqual('¡Datos guardados!'); // done(); // }) // .catch(catchErrors(done)); // }); - it(`should select the channel`, done => { + it('should select the channel', done => { nightmare .waitToClick(selectors.basicData.channelInput) .waitToClick(selectors.basicData.channelInput) @@ -305,13 +305,13 @@ describe('Edit basicData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the channel have been selected`, done => { + it('should confirm the channel have been selected', done => { nightmare .waitForSnackbarReset() .click(selectors.fiscalData.fiscalDataButton) diff --git a/e2e/paths/edit_fiscal_data.spec.js.js b/e2e/paths/edit_fiscal_data.spec.js similarity index 67% rename from e2e/paths/edit_fiscal_data.spec.js.js rename to e2e/paths/edit_fiscal_data.spec.js index 231399b54..c835f60ff 100644 --- a/e2e/paths/edit_fiscal_data.spec.js.js +++ b/e2e/paths/edit_fiscal_data.spec.js @@ -45,7 +45,7 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should search for the user Bruce Banner`, done => { + it('should search for the user Bruce Banner', done => { nightmare .wait(selectors.clientsIndex.searchResult) .type(selectors.clientsIndex.searchClientInput, 'Bruce Banner') @@ -73,7 +73,7 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should uncheck the hasToInvoice checkbox`, done => { + it('should uncheck the hasToInvoice checkbox', done => { nightmare .waitToClick(selectors.fiscalData.hasToInvoiceCheckboxLabel) .waitToClick(selectors.fiscalData.saveButton) @@ -86,7 +86,7 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should confirm hasToInvoice checkbox is unchecked`, done => { + it('should confirm hasToInvoice checkbox is unchecked', done => { nightmare .waitForSnackbarReset() .waitToClick(selectors.basicData.basicDataButton) @@ -103,7 +103,7 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should uncheck the invoiceByMail checkbox`, done => { + it('should uncheck the invoiceByMail checkbox', done => { nightmare .waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel) .waitToClick(selectors.fiscalData.saveButton) @@ -116,7 +116,7 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should confirm invoiceByMail checkbox is unchecked`, done => { + it('should confirm invoiceByMail checkbox is unchecked', done => { nightmare .waitForSnackbarReset() .waitToClick(selectors.basicData.basicDataButton) @@ -133,7 +133,7 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should edit the address`, done => { + it('should edit the address', done => { nightmare .wait(selectors.fiscalData.addressInput) .clearInput(selectors.fiscalData.addressInput) @@ -142,13 +142,13 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the address have been edited`, done => { + it('should confirm the address have been edited', done => { nightmare .waitForSnackbarReset() .click(selectors.basicData.basicDataButton) @@ -157,13 +157,13 @@ describe('Edit fiscalData path', () => { .wait(selectors.fiscalData.addressInput) .getInputValue(selectors.fiscalData.addressInput) .then(result => { - expect(result).toEqual(`Alpha Flight Low-Orbit`); + expect(result).toEqual('Alpha Flight Low-Orbit'); done(); }) .catch(catchErrors(done)); }); - it(`should edit the city`, done => { + it('should edit the city', done => { nightmare .wait(selectors.fiscalData.cityInput) .clearInput(selectors.fiscalData.cityInput) @@ -172,13 +172,13 @@ describe('Edit fiscalData path', () => { .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { - expect(result).toEqual(`¡Datos guardados!`); + expect(result).toEqual('¡Datos guardados!'); done(); }) .catch(catchErrors(done)); }); - it(`should confirm the city have been edited`, done => { + it('should confirm the city have been edited', done => { nightmare .waitForSnackbarReset() .click(selectors.basicData.basicDataButton) @@ -187,9 +187,69 @@ describe('Edit fiscalData path', () => { .wait(selectors.fiscalData.cityInput) .getInputValue(selectors.fiscalData.cityInput) .then(result => { - expect(result).toEqual(`N/A`); + expect(result).toEqual('N/A'); done(); }) .catch(catchErrors(done)); }); + + 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.globalItems.snackbarIsActive) + .getInnerText(selectors.globalItems.snackbarIsActive) + .then(result => { + expect(result).toEqual('¡Datos guardados!'); + done(); + }) + .catch(catchErrors(done)); + }); + + 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) + .then(result => { + expect(result).toEqual('12345'); + done(); + }) + .catch(catchErrors(done)); + }); + + // it(`should edit the province`, done => { + // nightmare + // .waitToClick(selectors.fiscalData.provinceInput) + // .waitToClick(selectors.fiscalData.provinceInput) + // .waitToClick(selectors.fiscalData.provinceMetropolisOption) + // .waitToClick(selectors.fiscalData.saveButton) + // .wait(selectors.globalItems.snackbarIsActive) + // .getInnerText(selectors.globalItems.snackbarIsActive) + // .then(result => { + // expect(result).toEqual(`¡Datos guardados!`); + // done(); + // }) + // .catch(catchErrors(done)); + // }); + + // it(`should confirm the province have been selected`, done => { + // nightmare + // .waitForSnackbarReset() + // .click(selectors.fiscalData.fiscalDataButton) + // .wait(selectors.fiscalData.addressInput) + // .click(selectors.fiscalData.basicDataButton) + // .wait(100) + // .getInputValue(selectors.fiscalData.provinceInput) + // .then(result => { + // expect(result).toEqual('Province two'); + // done(); + // }) + // .catch(catchErrors(done)); + // }); }); diff --git a/services/db/localDB02Inserts.sql b/services/db/localDB02Inserts.sql index fccac9e2b..dc859bfbf 100644 --- a/services/db/localDB02Inserts.sql +++ b/services/db/localDB02Inserts.sql @@ -335,11 +335,11 @@ INSERT INTO `salix`.`Zone`(`id`, `name`, `printingOrder`) INSERT INTO `salix`.`Province`(`id`, `name`, `countryFk`, `warehouseFk`, `zoneFk`) VALUES - (1, 'Provicen one', 1, NULL, 1), - (2, 'Provicen two', 1, NULL, 2), - (3, 'Provicen three', 1, NULL, 3), - (4, 'Provicen four', 1, NULL, 2), - (5, 'Provicen five', 1, NULL, 1); + (1, 'Province one', 1, NULL, 1), + (2, 'Province two', 1, NULL, 2), + (3, 'Province three', 1, NULL, 3), + (4, 'Province four', 1, NULL, 2), + (5, 'Province five', 1, NULL, 1); INSERT INTO `salix`.`ClientType`(`id`, `code`, `type`) VALUES