diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index 8f0aea0c2..75bc6d09a 100644 --- a/client/client/src/fiscal-data/fiscal-data.html +++ b/client/client/src/fiscal-data/fiscal-data.html @@ -12,7 +12,7 @@ - + diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index fa1ae9b2a..7e7db8208 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -53,8 +53,8 @@ export default { fiscalDataButton: `${components.vnMenuItem}[ui-sref="clientCard.fiscalData"]`, socialNameInput: `${components.vnTextfield}[name="socialName"]`, 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)`, + equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`, + acceptPropagationButton: `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(2)`, addressInput: `${components.vnTextfield}[name="street"]`, cityInput: `${components.vnTextfield}[name="city"]`, postcodeInput: `${components.vnTextfield}[name="postcode"]`, @@ -97,7 +97,9 @@ export default { defaultAddress: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(2) > vn-one > vn-horizontal > vn-one > div:nth-child(2)', secondMakeDefaultStar: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > ui-view > vn-client-addresses > vn-vertical > vn-card > div > vn-vertical > vn-horizontal:nth-child(3) > vn-one > vn-horizontal > vn-none > i', firstEditButton: `${components.vnIconButton}[icon='edit']`, + secondEditButton: `vn-horizontal:nth-child(3) > vn-one > vn-horizontal > a > ${components.vnIconButton}[icon='edit']`, activeCheckboxLabel: `${components.vnCheck}[label='Enabled'] > label > input`, + equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`, saveButton: `${components.vnSubmit}` } }; diff --git a/e2e/paths/create_client_path.spec.js b/e2e/paths/01_create_client_path.spec.js similarity index 100% rename from e2e/paths/create_client_path.spec.js rename to e2e/paths/01_create_client_path.spec.js diff --git a/e2e/paths/edit_basic_data.spec.js b/e2e/paths/02_edit_basic_data.spec.js similarity index 100% rename from e2e/paths/edit_basic_data.spec.js rename to e2e/paths/02_edit_basic_data.spec.js diff --git a/e2e/paths/edit_fiscal_data.spec.js b/e2e/paths/03_edit_fiscal_data.spec.js similarity index 76% rename from e2e/paths/edit_fiscal_data.spec.js rename to e2e/paths/03_edit_fiscal_data.spec.js index 7ccc176bb..6c024f7a7 100644 --- a/e2e/paths/edit_fiscal_data.spec.js +++ b/e2e/paths/03_edit_fiscal_data.spec.js @@ -70,10 +70,55 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should click on the search result to access to the client's fiscal data`, done => { + describe('Confirm all addresses have EQtax for future propagation test', () => { + it(`should click on the search result to access to the client's addresses`, done => { + nightmare + .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') + .waitToClick(selectors.clientsIndex.searchResult) + .waitToClick(selectors.addresses.addressesButton) + .waitForURL('/addresses/list') + .url() + .then(url => { + expect(url).toContain('/addresses/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the 1st edit icon to check EQtax is checked`, done => { + nightmare + .waitToClick(selectors.addresses.firstEditButton) + .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); + done(); + }) + .catch(catchErrors(done)); + }); + + 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) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeTruthy(); + done(); + }) + .catch(catchErrors(done)); + }); + }); + + it(`should click on the fiscal data button to start editing`, done => { nightmare - .waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner') - .waitToClick(selectors.clientsIndex.searchResult) .waitToClick(selectors.fiscalData.fiscalDataButton) .waitForURL('fiscal-data') .url() @@ -157,10 +202,9 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(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 => { + it('should propagate the Equalization tax', done => { nightmare - .waitToClick(selectors.fiscalData.cancelPropagationButton) + .waitToClick(selectors.fiscalData.acceptPropagationButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) .then(result => { @@ -187,11 +231,57 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it('should edit the address', done => { + describe('Confirm all addresses havent got EQtax as uncheck was propagated', () => { + it(`should click on the addresses button to access to the client's addresses`, done => { + nightmare + .waitToClick(selectors.addresses.addressesButton) + .waitForURL('/addresses/list') + .url() + .then(url => { + expect(url).toContain('/addresses/list'); + done(); + }) + .catch(catchErrors(done)); + }); + + it(`should click on the 1st edit icon to check EQtax is unchecked`, done => { + nightmare + .waitToClick(selectors.addresses.firstEditButton) + .wait(selectors.addresses.equalizationTaxCheckboxLabel) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + + 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) + .wait(200) + .evaluate(selector => { + return document.querySelector(selector).checked; + }, selectors.addresses.equalizationTaxCheckboxLabel) + .then(value => { + expect(value).toBeFalsy(); + done(); + }) + .catch(catchErrors(done)); + }); + }); + + 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 in New York edited') + .type(selectors.fiscalData.addressInput, 'Somewhere edited') .click(selectors.fiscalData.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive) @@ -211,7 +301,7 @@ describe('Edit fiscalData path', () => { .wait(selectors.fiscalData.addressInput) .getInputValue(selectors.fiscalData.addressInput) .then(result => { - expect(result).toEqual('Somewhere in New York edited'); + expect(result).toEqual('Somewhere edited'); done(); }) .catch(catchErrors(done)); @@ -307,36 +397,6 @@ describe('Edit fiscalData path', () => { .catch(catchErrors(done)); }); - it(`should edit the country`, done => { - nightmare - .waitToClick(selectors.fiscalData.countryInput) - .waitToClick(selectors.fiscalData.countryThirdOption) - .wait(200) - .waitToClick(selectors.fiscalData.saveButton) - .wait(selectors.globalItems.snackbarIsActive) - .getInnerText(selectors.globalItems.snackbarIsActive) - .then(result => { - expect(result).toEqual('Data saved!'); - done(); - }) - .catch(catchErrors(done)); - }); - - it(`should confirm the country have been selected`, done => { - nightmare - .waitForSnackbarReset() - .click(selectors.basicData.basicDataButton) - .wait(selectors.basicData.nameInput) - .click(selectors.fiscalData.fiscalDataButton) - .wait(200) - .getInputValue(selectors.fiscalData.countryInput) - .then(result => { - expect(result).toEqual('Holanda'); - done(); - }) - .catch(catchErrors(done)); - }); - it('should uncheck the active checkbox', done => { nightmare .waitToClick(selectors.fiscalData.activeCheckboxLabel) @@ -367,35 +427,35 @@ describe('Edit fiscalData path', () => { .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('Data saved!'); - 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('Data saved!'); + // 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 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 diff --git a/e2e/paths/edit_pay_method.spec.js b/e2e/paths/04_edit_pay_method.spec.js similarity index 100% rename from e2e/paths/edit_pay_method.spec.js rename to e2e/paths/04_edit_pay_method.spec.js diff --git a/e2e/paths/edit_addresses.spec.js b/e2e/paths/05_edit_addresses.spec.js similarity index 100% rename from e2e/paths/edit_addresses.spec.js rename to e2e/paths/05_edit_addresses.spec.js