From 92fe65b8986431c47a3270410681daf3c58ba47c Mon Sep 17 00:00:00 2001
From: Carlos Jimenez <=>
Date: Thu, 7 Dec 2017 13:35:40 +0100
Subject: [PATCH] repairs on e2e tests completed plus Fiscal Data Path
completed
---
.../client/src/fiscal-data/fiscal-data.html | 2 +-
client/client/src/locale/es.json | 3 +-
e2e/helpers/selectors.js | 17 +-
e2e/paths/edit_basic_data.spec.js | 8 +-
e2e/paths/edit_fiscal_data.spec.js | 309 +++++++++++++++---
5 files changed, 285 insertions(+), 54 deletions(-)
diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html
index fcabedefa..8f0aea0c2 100644
--- a/client/client/src/fiscal-data/fiscal-data.html
+++ b/client/client/src/fiscal-data/fiscal-data.html
@@ -49,7 +49,7 @@
-
+
diff --git a/client/client/src/locale/es.json b/client/client/src/locale/es.json
index 0c4cd2362..3a037b3aa 100644
--- a/client/client/src/locale/es.json
+++ b/client/client/src/locale/es.json
@@ -18,5 +18,6 @@
"Pay method" : "Forma de pago",
"Address": "Consignatario",
"Credit" : "Crédito",
- "Secured credit": "Crédito asegurado"
+ "Secured credit": "Crédito asegurado",
+ "Verified data": "Datos comprobados"
}
diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js
index ab18111ac..9a35b41f0 100644
--- a/e2e/helpers/selectors.js
+++ b/e2e/helpers/selectors.js
@@ -49,17 +49,22 @@ export default {
fiscalData: {
fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`,
socialNameInput: `${components.vnTextfield}[name="socialName"]`,
- hasToInvoiceCheckboxLabel: `${components.vnCheck}[label='Has to invoice'] > label`,
- hasToInvoiceCheckboxInput: `${components.vnCheck}[label='Has to invoice'] > label > label > input`,
- invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
- invoiceByMailCheckboxInput: `${components.vnCheck}[label='Invoice by mail'] > label > label > input`,
+ fiscalIdInput: `${components.vnTextfield}[name="fi"]`,
+ equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Equalization tax'] > label`,
+ cancelPropagationButton: `body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > vn-client-fiscal-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)`,
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)`,
+ provinceFifthOption: `${components.vnAutocomplete}[field="$ctrl.client.provinceFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(5)`,
countryInput: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > ${components.vnTextfield}`,
- countryThirdOption: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > vn-drop-down > vn-vertical > vn-one:nth-child(3) > ul > li:nth-child(3)`,
+ countryThirdOption: `${components.vnAutocomplete}[field="$ctrl.client.countryFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(3)`,
+ activeCheckboxLabel: `${components.vnCheck}[label='Active'] > label`,
+ invoiceByAddressCheckboxInput: `${components.vnCheck}[label='Invoice by address'] > label > input`,
+ verifiedDataCheckboxInput: `${components.vnCheck}[label='Verified data'] > label > input`,
+ hasToInvoiceCheckboxLabel: `${components.vnCheck}[label='Has to invoice'] > label`,
+ invoiceByMailCheckboxLabel: `${components.vnCheck}[label='Invoice by mail'] > label`,
+ viesCheckboxInput: `${components.vnCheck}[label='Vies'] > label > input`,
saveButton: `${components.vnSubmit}`
}
};
diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/edit_basic_data.spec.js
index 3e6402f6d..0ba2e4193 100644
--- a/e2e/paths/edit_basic_data.spec.js
+++ b/e2e/paths/edit_basic_data.spec.js
@@ -226,7 +226,7 @@ describe('Edit basicData path', () => {
nightmare
.waitToClick(selectors.basicData.salesPersonInput)
.waitToClick(selectors.basicData.salesBruceBannerOption)
- .wait(100)
+ .wait(200)
.waitToClick(selectors.basicData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@@ -243,7 +243,7 @@ describe('Edit basicData path', () => {
.waitToClick(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.addressInput)
.waitToClick(selectors.basicData.basicDataButton)
- .wait(selectors.basicData.salesPersonInput)
+ .wait(200)
.getInputValue(selectors.basicData.salesPersonInput)
.then(result => {
expect(result).toEqual('Bruce Banner');
@@ -256,7 +256,7 @@ describe('Edit basicData path', () => {
nightmare
.waitToClick(selectors.basicData.channelInput)
.waitToClick(selectors.basicData.channelMetropolisOption)
- .wait(100)
+ .wait(400)
.waitToClick(selectors.basicData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@@ -273,7 +273,7 @@ describe('Edit basicData path', () => {
.waitToClick(selectors.fiscalData.fiscalDataButton)
.wait(selectors.fiscalData.addressInput)
.waitToClick(selectors.basicData.basicDataButton)
- .wait(selectors.basicData.channelInput)
+ .wait(400)
.getInputValue(selectors.basicData.channelInput)
.then(result => {
expect(result).toEqual('Metropolis newspaper');
diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/edit_fiscal_data.spec.js
index b7cefa28c..58b9f3418 100644
--- a/e2e/paths/edit_fiscal_data.spec.js
+++ b/e2e/paths/edit_fiscal_data.spec.js
@@ -73,9 +73,69 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
- it('should uncheck the hasToInvoice checkbox', done => {
+ it('should edit the social name', done => {
nightmare
- .waitToClick(selectors.fiscalData.hasToInvoiceCheckboxLabel)
+ .wait(selectors.fiscalData.socialNameInput)
+ .clearInput(selectors.fiscalData.socialNameInput)
+ .type(selectors.fiscalData.socialNameInput, 'Hulk edited')
+ .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 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)
+ .then(result => {
+ expect(result).toEqual('Hulk edited');
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ 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.globalItems.snackbarIsActive)
+ .getInnerText(selectors.globalItems.snackbarIsActive)
+ .then(result => {
+ expect(result).toEqual('¡Datos guardados!');
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ 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)
+ .then(result => {
+ expect(result).toEqual('94980061C');
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it('should uncheck the Equalization tax checkbox', done => {
+ nightmare
+ .waitToClick(selectors.fiscalData.equalizationTaxCheckboxLabel)
.waitToClick(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@@ -86,27 +146,10 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
- it('should confirm hasToInvoice checkbox is unchecked', done => {
+// there should be a test to confirm propagation on addresses view once equalization tax propagation is shown on each address
+ it('should not propagate the Equalization tax', done => {
nightmare
- .waitForSnackbarReset()
- .waitToClick(selectors.basicData.basicDataButton)
- .wait(selectors.basicData.nameInput)
- .waitToClick(selectors.fiscalData.fiscalDataButton)
- .wait(selectors.fiscalData.hasToInvoiceCheckboxLabel)
- .evaluate(selector => {
- return document.querySelector(selector).checked;
- }, selectors.fiscalData.hasToInvoiceCheckboxLabel)
- .then(value => {
- expect(value).toBeFalsy();
- done();
- })
- .catch(catchErrors(done));
- });
-
- it('should uncheck the invoiceByMail checkbox', done => {
- nightmare
- .waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel)
- .waitToClick(selectors.fiscalData.saveButton)
+ .waitToClick(selectors.fiscalData.cancelPropagationButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
.then(result => {
@@ -116,28 +159,28 @@ describe('Edit fiscalData path', () => {
.catch(catchErrors(done));
});
- it('should confirm invoiceByMail checkbox is unchecked', done => {
+ it('should confirm Equalization tax checkbox is unchecked', done => {
nightmare
- .waitForSnackbarReset()
- .waitToClick(selectors.basicData.basicDataButton)
- .wait(selectors.basicData.nameInput)
- .waitToClick(selectors.fiscalData.fiscalDataButton)
- .wait(selectors.fiscalData.invoiceByMailCheckboxLabel)
- .evaluate(selector => {
- return document.querySelector(selector).checked;
- }, selectors.fiscalData.invoiceByMailCheckboxLabel)
- .then(value => {
- expect(value).toBeFalsy();
- done();
- })
- .catch(catchErrors(done));
+ .waitForSnackbarReset()
+ .waitToClick(selectors.basicData.basicDataButton)
+ .wait(selectors.basicData.nameInput)
+ .waitToClick(selectors.fiscalData.fiscalDataButton)
+ .wait(selectors.fiscalData.equalizationTaxCheckboxLabel)
+ .evaluate(selector => {
+ return document.querySelector(selector).checked;
+ }, selectors.fiscalData.equalizationTaxCheckboxLabel)
+ .then(value => {
+ expect(value).toBeFalsy();
+ done();
+ })
+ .catch(catchErrors(done));
});
it('should edit the address', done => {
nightmare
.wait(selectors.fiscalData.addressInput)
.clearInput(selectors.fiscalData.addressInput)
- .type(selectors.fiscalData.addressInput, 'Alpha Flight Low-Orbit')
+ .type(selectors.fiscalData.addressInput, 'Somewhere in New York edited')
.click(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@@ -157,7 +200,7 @@ describe('Edit fiscalData path', () => {
.wait(selectors.fiscalData.addressInput)
.getInputValue(selectors.fiscalData.addressInput)
.then(result => {
- expect(result).toEqual('Alpha Flight Low-Orbit');
+ expect(result).toEqual('Somewhere in New York edited');
done();
})
.catch(catchErrors(done));
@@ -227,6 +270,7 @@ describe('Edit fiscalData path', () => {
nightmare
.waitToClick(selectors.fiscalData.provinceInput)
.waitToClick(selectors.fiscalData.provinceFifthOption)
+ .wait(200)
.waitToClick(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@@ -243,7 +287,7 @@ describe('Edit fiscalData path', () => {
.click(selectors.basicData.basicDataButton)
.wait(selectors.basicData.nameInput)
.click(selectors.fiscalData.fiscalDataButton)
- .wait(100)
+ .wait(200)
.getInputValue(selectors.fiscalData.provinceInput)
.then(result => {
expect(result).toEqual('Province two');
@@ -256,6 +300,7 @@ describe('Edit fiscalData path', () => {
nightmare
.waitToClick(selectors.fiscalData.countryInput)
.waitToClick(selectors.fiscalData.countryThirdOption)
+ .wait(200)
.waitToClick(selectors.fiscalData.saveButton)
.wait(selectors.globalItems.snackbarIsActive)
.getInnerText(selectors.globalItems.snackbarIsActive)
@@ -269,10 +314,10 @@ describe('Edit fiscalData path', () => {
it(`should confirm the country have been selected`, done => {
nightmare
.waitForSnackbarReset()
+ .click(selectors.basicData.basicDataButton)
+ .wait(selectors.basicData.nameInput)
.click(selectors.fiscalData.fiscalDataButton)
- .wait(selectors.fiscalData.addressInput)
- .click(selectors.fiscalData.basicDataButton)
- .wait(100)
+ .wait(200)
.getInputValue(selectors.fiscalData.countryInput)
.then(result => {
expect(result).toEqual('Holanda');
@@ -280,4 +325,184 @@ describe('Edit fiscalData path', () => {
})
.catch(catchErrors(done));
});
+
+ it('should uncheck the active checkbox', done => {
+ nightmare
+ .waitToClick(selectors.fiscalData.activeCheckboxLabel)
+ .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 active checkbox is unchecked', done => {
+ nightmare
+ .waitForSnackbarReset()
+ .waitToClick(selectors.basicData.basicDataButton)
+ .wait(selectors.basicData.nameInput)
+ .waitToClick(selectors.fiscalData.fiscalDataButton)
+ .wait(selectors.fiscalData.activeCheckboxLabel)
+ .evaluate(selector => {
+ return document.querySelector(selector).checked;
+ }, selectors.fiscalData.activeCheckboxLabel)
+ .then(value => {
+ expect(value).toBeFalsy();
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it('should check the invoice by address checkbox', done => {
+ nightmare
+ .waitToClick(selectors.fiscalData.invoiceByAddressCheckboxInput)
+ .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 invoice by address checkbox is checked', done => {
+ nightmare
+ .waitForSnackbarReset()
+ .waitToClick(selectors.basicData.basicDataButton)
+ .wait(selectors.basicData.nameInput)
+ .waitToClick(selectors.fiscalData.fiscalDataButton)
+ .wait(selectors.fiscalData.invoiceByAddressCheckboxInput)
+ .evaluate(selector => {
+ return document.querySelector(selector).checked;
+ }, selectors.fiscalData.invoiceByAddressCheckboxInput)
+ .then(value => {
+ expect(value).toBeTruthy();
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it('should check the Verified data checkbox', done => {
+ nightmare
+ .waitToClick(selectors.fiscalData.verifiedDataCheckboxInput)
+ .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 Verified data checkbox is checked', done => {
+ nightmare
+ .waitForSnackbarReset()
+ .waitToClick(selectors.basicData.basicDataButton)
+ .wait(selectors.basicData.nameInput)
+ .waitToClick(selectors.fiscalData.fiscalDataButton)
+ .wait(selectors.fiscalData.verifiedDataCheckboxInput)
+ .evaluate(selector => {
+ return document.querySelector(selector).checked;
+ }, selectors.fiscalData.verifiedDataCheckboxInput)
+ .then(value => {
+ expect(value).toBeTruthy();
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it('should uncheck the Has to invoice checkbox', done => {
+ nightmare
+ .waitToClick(selectors.fiscalData.hasToInvoiceCheckboxLabel)
+ .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 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)
+ .evaluate(selector => {
+ return document.querySelector(selector).checked;
+ }, selectors.fiscalData.hasToInvoiceCheckboxLabel)
+ .then(value => {
+ expect(value).toBeFalsy();
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it('should uncheck the Invoice by mail checkbox', done => {
+ nightmare
+ .waitToClick(selectors.fiscalData.invoiceByMailCheckboxLabel)
+ .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 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)
+ .evaluate(selector => {
+ return document.querySelector(selector).checked;
+ }, selectors.fiscalData.invoiceByMailCheckboxLabel)
+ .then(value => {
+ expect(value).toBeFalsy();
+ done();
+ })
+ .catch(catchErrors(done));
+ });
+
+ it('should check the Vies checkbox', done => {
+ nightmare
+ .waitToClick(selectors.fiscalData.viesCheckboxInput)
+ .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 Vies checkbox is checked', done => {
+ nightmare
+ .waitForSnackbarReset()
+ .waitToClick(selectors.basicData.basicDataButton)
+ .wait(selectors.basicData.nameInput)
+ .waitToClick(selectors.fiscalData.fiscalDataButton)
+ .wait(selectors.fiscalData.viesCheckboxInput)
+ .evaluate(selector => {
+ return document.querySelector(selector).checked;
+ }, selectors.fiscalData.viesCheckboxInput)
+ .then(value => {
+ expect(value).toBeTruthy();
+ done();
+ })
+ .catch(catchErrors(done));
+ });
});