From 3fd3f6149252c4e5a917a4100e8d69663b116041 Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Thu, 9 Nov 2017 13:24:23 +0100 Subject: [PATCH 1/5] Jenkins --- Jenkinsfile | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index e61547070..2901a4493 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -5,15 +5,18 @@ def branchProduction = "master" def branchTest = "test"; def dockerHost = "${env.DOCKER_HOST}"; -env.NODE_ENV = branchName; env.BRANCH_NAME = branchName; env.TAG = "${env.BUILD_NUMBER}"; -if (branchName == "test") - env.NODE_ENV = "development"; - -if (branchName == branchProduction) - dockerHost = "tcp://172.16.255.29:2375"; +switch (branchName){ + case branchTest: + env.NODE_ENV = "development"; + break; + case branchProduction: + dockerHost = "tcp://172.16.255.29:2375"; + env.NODE_ENV = "production" + break; +} node { From f1eba5d27c3a9774b9801635871a1bb04dffe291 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 13:29:51 +0100 Subject: [PATCH 2/5] translation refactor for fiscal data --- client/client/src/fiscal-data/fiscal-data.html | 12 ++++++------ client/client/src/locale/es.json | 9 +++++++-- e2e/helpers/selectors.js | 1 + 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index 73d9a96cc..1443b0a11 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -18,18 +18,18 @@ - - + + - + + label="Province"> + label="Country"> - + diff --git a/client/client/src/locale/es.json b/client/client/src/locale/es.json index c3bc8aac5..4dd110d72 100644 --- a/client/client/src/locale/es.json +++ b/client/client/src/locale/es.json @@ -4,5 +4,10 @@ "Fiscal data": "Datos Fiscales", "Has to invoice": "Factura", "Invoice by mail": "Factura impresa", - "CountryFk": "País" -} \ No newline at end of file + "Country": "País", + "Street": "Domicilio fiscal", + "City": "Municipio", + "Postcode": "Código postal", + "Province": "Provincia", + "Save": "Guardar" +} diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index 1b772561c..18aef276c 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -54,6 +54,7 @@ export default { invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`, addressInput: `${components.vnTextfield}[name="street"]`, cityInput: `${components.vnTextfield}[name="city"]`, + postcodeInput: `${components.vnTextfield}[name="postcode"]`, 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' } }; From 83e4a3c873d917c8d8919c891df8b1e9fc16a3bd Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Thu, 9 Nov 2017 13:44:06 +0100 Subject: [PATCH 3/5] Jenkinsfile --- Jenkinsfile | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 2901a4493..32f28c10f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,6 @@ def branchName = "${env.BRANCH_NAME}"; def branchProduction = "master" def branchTest = "test"; -def dockerHost = "${env.DOCKER_HOST}"; env.BRANCH_NAME = branchName; env.TAG = "${env.BUILD_NUMBER}"; @@ -13,7 +12,7 @@ switch (branchName){ env.NODE_ENV = "development"; break; case branchProduction: - dockerHost = "tcp://172.16.255.29:2375"; + env.DOCKER_HOST = "tcp://172.16.255.29:2375"; env.NODE_ENV = "production" break; } From 8c3a5a7f6e1f8bda133368892915902b56d4dd2f Mon Sep 17 00:00:00 2001 From: Vicente Falco Date: Thu, 9 Nov 2017 13:45:26 +0100 Subject: [PATCH 4/5] Jenkins error --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 32f28c10f..06f77ffed 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -20,7 +20,7 @@ switch (branchName){ node { stage ('Print environment variables'){ - echo "Branch ${branchName}, Build ${env.TAG}, NODE_ENV ${env.NODE_ENV} en docker Host ${dockerHost}" + echo "Branch ${branchName}, Build ${env.TAG}, NODE_ENV ${env.NODE_ENV} en docker Host ${env.DOCKER_HOST}" } stage ('Checkout') { checkout scm From 72239222517f13f089849f5f75ce0a311d567000 Mon Sep 17 00:00:00 2001 From: Carlos Date: Thu, 9 Nov 2017 13:54:06 +0100 Subject: [PATCH 5/5] typo corrected at dblocal fixtures plus renamed files and selectors added --- e2e/helpers/selectors.js | 2 + ...ata.spec.js.js => edit_basic_data.spec.js} | 62 ++++++------- ...ta.spec.js.js => edit_fiscal_data.spec.js} | 86 ++++++++++++++++--- services/db/localDB02Inserts.sql | 10 +-- 4 files changed, 111 insertions(+), 49 deletions(-) rename e2e/paths/{edit_basic_data.spec.js.js => edit_basic_data.spec.js} (84%) rename e2e/paths/{edit_fiscal_data.spec.js.js => edit_fiscal_data.spec.js} (67%) 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