salix/e2e/paths/client-module/03_edit_fiscal_data.spec.js

443 lines
17 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Edit fiscalData path', () => {
const nightmare = createNightmare();
it('should click on the Clients button of the top bar menu', () => {
return nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/clients');
});
});
it('should search for the user Bruce Banner', () => {
return nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countSearchResults(selectors.clientsIndex.searchResult)
.then(result => {
2017-11-08 14:43:34 +00:00
expect(result).toEqual(1);
});
});
describe('Confirm all addresses have EQtax false for future propagation test', () => {
it(`should click on the search result to access to the client's addresses`, () => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/addresses/list')
.url()
.then(url => {
expect(url).toContain('/addresses/list');
});
});
it(`should click on the 1st edit icon to check EQtax is checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
});
it(`should click on the fiscal data button to start editing`, () => {
return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.waitForURL('fiscal-data')
.url()
.then(url => {
expect(url).toContain('fiscal-data');
});
});
it('should edit the social name', () => {
return nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.type(selectors.clientFiscalData.socialNameInput, 'Hulk edited')
.click(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm the social name have been edited', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput)
.getInputValue(selectors.clientFiscalData.socialNameInput)
.then(result => {
expect(result).toEqual('Hulk edited');
});
});
it('should edit the fiscal id', () => {
return nightmare
.wait(selectors.clientFiscalData.fiscalIdInput)
.clearInput(selectors.clientFiscalData.fiscalIdInput)
.type(selectors.clientFiscalData.fiscalIdInput, '94980061C')
.click(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm the fiscal id have been edited', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.fiscalIdInput)
.getInputValue(selectors.clientFiscalData.fiscalIdInput)
.then(result => {
expect(result).toEqual('94980061C');
});
});
it('should check the Equalization tax checkbox', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should propagate the Equalization tax', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
.waitForSnackbar()
2017-11-08 14:43:34 +00:00
.then(result => {
expect(result).toEqual('Equivalent tax spreaded');
});
2017-11-08 14:43:34 +00:00
});
it('should confirm Equalization tax checkbox is checked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
});
});
describe('Confirm all addresses have now EQtax checked', () => {
it(`should click on the addresses button to access to the client's addresses`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/addresses/list')
.url()
.then(url => {
expect(url).toContain('/addresses/list');
});
});
it(`should click on the 1st edit icon to confirm EQtax is checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
});
});
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.wait(200)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
});
});
});
it('should go to fiscal data then edit the address', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput)
.clearInput(selectors.clientFiscalData.addressInput)
.type(selectors.clientFiscalData.addressInput, 'Somewhere edited')
.click(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm the address have been edited', () => {
return nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput)
.getInputValue(selectors.clientFiscalData.addressInput)
.then(result => {
expect(result).toEqual('Somewhere edited');
});
});
it('should edit the city', () => {
return nightmare
.wait(selectors.clientFiscalData.cityInput)
.clearInput(selectors.clientFiscalData.cityInput)
.type(selectors.clientFiscalData.cityInput, 'N/A')
.click(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm the city have been edited', () => {
return nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.cityInput)
.getInputValue(selectors.clientFiscalData.cityInput)
.then(result => {
expect(result).toEqual('N/A');
});
});
it('should edit the postcode', () => {
return nightmare
.wait(selectors.clientFiscalData.postcodeInput)
.clearInput(selectors.clientFiscalData.postcodeInput)
.type(selectors.clientFiscalData.postcodeInput, '12345')
.click(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm the postcode have been edited', () => {
return nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.postcodeInput)
.getInputValue(selectors.clientFiscalData.postcodeInput)
.then(result => {
expect(result).toEqual('12345');
});
});
it(`should edit the province`, () => {
return nightmare
.waitToClick(selectors.clientFiscalData.provinceInput)
.waitToClick(selectors.clientFiscalData.provinceFifthOption)
.wait(200)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
2017-11-09 13:47:09 +00:00
.then(result => {
expect(result).toEqual('Data saved!');
});
2017-11-09 13:47:09 +00:00
});
it(`should confirm the province have been selected`, () => {
return nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.click(selectors.clientFiscalData.fiscalDataButton)
.wait(200)
.getInputValue(selectors.clientFiscalData.provinceInput)
2017-11-09 13:47:09 +00:00
.then(result => {
expect(result).toEqual('Province two');
});
2017-11-09 13:47:09 +00:00
});
it('should uncheck the active checkbox', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.activeCheckboxLabel)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm active checkbox is unchecked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.activeCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.activeCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should uncheck the invoice by address checkbox', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm invoice by address checkbox is unchecked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should check the Verified data checkbox', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm Verified data checkbox is unchecked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.verifiedDataCheckboxInput)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should uncheck the Has to invoice checkbox', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm Has to invoice checkbox is unchecked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should uncheck the Invoice by mail checkbox', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm Invoice by mail checkbox is unchecked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should check the Vies checkbox', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.viesCheckboxInput)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm Vies checkbox is checked', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.viesCheckboxInput)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.viesCheckboxInput)
.then(value => {
expect(value).toBeTruthy();
});
});
});