diff --git a/client/client/src/fiscal-data/fiscal-data.html b/client/client/src/fiscal-data/fiscal-data.html index 8f0aea0c20..75bc6d09ac 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 fa1ae9b2af..0417d1d1e7 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-main-block > 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"]`, @@ -77,7 +77,7 @@ export default { payMethodOptionOne: `${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(2)`, IBANInput: `${components.vnTextfield}[name="iban"]`, dueDayInput: `${components.vnTextfield}[name="dueDay"]`, - cancelNotificationButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-horizontal > vn-one > vn-vertical > vn-client-billing-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)', + cancelNotificationButton: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > vn-horizontal > vn-one > vn-vertical > vn-client-billing-data > vn-dialog > div > form > div.button-bar > tpl-buttons > button:nth-child(1)', saveButton: `${components.vnSubmit}` }, addresses: { @@ -94,10 +94,12 @@ export default { agenctySecondOption: `${components.vnAutocomplete}[field="$ctrl.address.agencyFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, phoneInput: `${components.vnTextfield}[name="phone"]`, mobileInput: `${components.vnTextfield}[name="mobile"]`, - 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', + defaultAddress: 'body > vn-app > vn-vertical > vn-vertical > vn-client-card > vn-main-block > 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-main-block > 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']`, - activeCheckboxLabel: `${components.vnCheck}[label='Enabled'] > label > input`, + secondEditButton: `vn-horizontal:nth-child(3) > vn-one > vn-horizontal > a > ${components.vnIconButton}[icon='edit']`, + activeCheckbox: `${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 80% rename from e2e/paths/edit_fiscal_data.spec.js rename to e2e/paths/03_edit_fiscal_data.spec.js index 7ccc176bb3..b5c2bcf5c9 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) 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 99% rename from e2e/paths/edit_addresses.spec.js rename to e2e/paths/05_edit_addresses.spec.js index 691c3a3f74..525333e917 100644 --- a/e2e/paths/edit_addresses.spec.js +++ b/e2e/paths/05_edit_addresses.spec.js @@ -288,7 +288,7 @@ describe('Edit addresses 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.activeCheckboxLabel) + .waitToClick(selectors.addresses.activeCheckbox) .waitToClick(selectors.addresses.saveButton) .wait(selectors.globalItems.snackbarIsActive) .getInnerText(selectors.globalItems.snackbarIsActive)