lint warnings corrected + en json

This commit is contained in:
Carlos Jimenez 2018-09-05 08:27:50 +02:00
parent e00d054fe9
commit 9b6b08400f
3 changed files with 383 additions and 387 deletions

View File

@ -1,338 +1,336 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Client', () => {
describe('Edit fiscalData path', () => {
const nightmare = createNightmare();
describe('Client Edit fiscalData path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
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('#!/client/index');
});
});
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('#!/client/index');
});
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)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
it('should search for the user Bruce Banner', () => {
describe('Confirms 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
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
describe('Confirms 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('/address/index')
.url()
.then(url => {
expect(url).toContain('/address/index');
});
});
it(`should click on the 1st edit icon to check EQtax isnt checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.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 isnt checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.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')
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index')
.url()
.then(url => {
expect(url).toContain('fiscal-data');
expect(url).toContain('/address/index');
});
});
it('should edit the clients fiscal data', () => {
it(`should click on the 1st edit icon to check EQtax isnt checked`, () => {
return nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.type(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.waitForTextInInput(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.clearInput(selectors.clientFiscalData.fiscalIdInput)
.type(selectors.clientFiscalData.fiscalIdInput, '94980061C')
.clearInput(selectors.clientFiscalData.addressInput)
.type(selectors.clientFiscalData.addressInput, 'Somewhere edited')
.clearInput(selectors.clientFiscalData.postcodeInput)
.type(selectors.clientFiscalData.postcodeInput, '12345')
.clearInput(selectors.clientFiscalData.cityInput)
.type(selectors.clientFiscalData.cityInput, 'N/A')
.waitToClick(selectors.clientFiscalData.countryInput)
.waitToClick(selectors.clientFiscalData.countryThirdOption)
.waitToClick(selectors.clientFiscalData.provinceInput)
.waitToClick(selectors.clientFiscalData.provinceFifthOption)
.waitToClick(selectors.clientFiscalData.activeCheckboxLabel)
.waitToClick(selectors.clientFiscalData.frozenCheckboxLabel)
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.waitToClick(selectors.clientFiscalData.viesCheckboxInput)
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
.click(selectors.clientFiscalData.saveButton)
.waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.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 isnt checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitToClick(selectors.clientAddresses.secondEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.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 clients fiscal data', () => {
return nightmare
.wait(selectors.clientFiscalData.socialNameInput)
.clearInput(selectors.clientFiscalData.socialNameInput)
.type(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.waitForTextInInput(selectors.clientFiscalData.socialNameInput, 'SMASH!')
.clearInput(selectors.clientFiscalData.fiscalIdInput)
.type(selectors.clientFiscalData.fiscalIdInput, '94980061C')
.clearInput(selectors.clientFiscalData.addressInput)
.type(selectors.clientFiscalData.addressInput, 'Somewhere edited')
.clearInput(selectors.clientFiscalData.postcodeInput)
.type(selectors.clientFiscalData.postcodeInput, '12345')
.clearInput(selectors.clientFiscalData.cityInput)
.type(selectors.clientFiscalData.cityInput, 'N/A')
.waitToClick(selectors.clientFiscalData.countryInput)
.waitToClick(selectors.clientFiscalData.countryThirdOption)
.waitToClick(selectors.clientFiscalData.provinceInput)
.waitToClick(selectors.clientFiscalData.provinceFifthOption)
.waitToClick(selectors.clientFiscalData.activeCheckboxLabel)
.waitToClick(selectors.clientFiscalData.frozenCheckboxLabel)
.waitToClick(selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.waitToClick(selectors.clientFiscalData.viesCheckboxInput)
.waitToClick(selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.waitToClick(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
.click(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});
it('should propagate the Equalization tax', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Equivalent tax spreaded']));
});
});
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('/address/index')
.url()
.then(url => {
expect(url).toContain('/address/index');
});
});
it(`should click on the 1st edit icon to confirm EQtax is checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.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)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
});
});
});
it('should navigate back to fiscal data to confirm its name have been edited', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput)
.getInputValue(selectors.clientFiscalData.socialNameInput)
.then(result => {
expect(result).toEqual('SMASH!');
});
});
it('should confirm the fiscal id have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.fiscalIdInput)
.then(result => {
expect(result).toEqual('94980061C');
});
});
it('should confirm the address have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.addressInput)
.then(result => {
expect(result).toEqual('Somewhere edited');
});
});
it('should confirm the postcode have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.postcodeInput)
.then(result => {
expect(result).toEqual('12345');
});
});
it('should confirm the city have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.cityInput)
.then(result => {
expect(result).toEqual('N/A');
});
});
it(`should confirm the country have been selected`, () => {
return nightmare
.getInputValue(selectors.clientFiscalData.countryInput)
.then(result => {
expect(result).toEqual('Francia');
});
});
it(`should confirm the province have been selected`, () => {
return nightmare
.getInputValue(selectors.clientFiscalData.provinceInput)
.then(result => {
expect(result).toEqual('Province two');
});
});
it('should confirm active checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.activeCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm frozen checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.frozenCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm Has to invoice checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm Vies checkbox is checked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.viesCheckboxInput)
.then(value => {
expect(value).toBeTruthy();
});
});
it('should confirm Invoice by mail checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm invoice by address checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm Equalization tax checkbox is checked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
});
});
it('should confirm Verified data checkbox is checked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => {
expect(value).toBeTruthy();
});
});
describe('confirm invoice by address checkbox gets checked if the EQtax differs between addresses', () => {
it(`should click on the addresses button to access to the client's addresses`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index')
.url()
.then(url => {
expect(url).toContain('/address/index');
});
});
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitToClick(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.click(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});
it('should propagate the Equalization tax', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Equivalent tax spreaded']));
});
});
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('/address/index')
.url()
.then(url => {
expect(url).toContain('/address/index');
});
});
it(`should click on the 1st edit icon to confirm EQtax is checked`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.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)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
});
});
});
it('should navigate back to fiscal data to confirm its name have been edited', () => {
it('should navigate back to fiscal data to confirm invoice by address is now checked', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.socialNameInput)
.getInputValue(selectors.clientFiscalData.socialNameInput)
.then(result => {
expect(result).toEqual('SMASH!');
});
});
it('should confirm the fiscal id have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.fiscalIdInput)
.then(result => {
expect(result).toEqual('94980061C');
});
});
it('should confirm the address have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.addressInput)
.then(result => {
expect(result).toEqual('Somewhere edited');
});
});
it('should confirm the postcode have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.postcodeInput)
.then(result => {
expect(result).toEqual('12345');
});
});
it('should confirm the city have been edited', () => {
return nightmare
.getInputValue(selectors.clientFiscalData.cityInput)
.then(result => {
expect(result).toEqual('N/A');
});
});
it(`should confirm the country have been selected`, () => {
return nightmare
.getInputValue(selectors.clientFiscalData.countryInput)
.then(result => {
expect(result).toEqual('Francia');
});
});
it(`should confirm the province have been selected`, () => {
return nightmare
.getInputValue(selectors.clientFiscalData.provinceInput)
.then(result => {
expect(result).toEqual('Province two');
});
});
it('should confirm active checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.activeCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm frozen checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.frozenCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm Has to invoice checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm Vies checkbox is checked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.viesCheckboxInput)
.then(value => {
expect(value).toBeTruthy();
});
});
it('should confirm Invoice by mail checkbox is unchecked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByMailCheckboxLabel)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm invoice by address checkbox is unchecked', () => {
return nightmare
.wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should confirm Equalization tax checkbox is checked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel)
.then(value => {
expect(value).toBeTruthy();
});
});
it('should confirm Verified data checkbox is checked', () => {
return nightmare
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
.then(value => {
expect(value).toBeTruthy();
});
});
describe('confirm invoice by address checkbox gets checked if the EQtax differs between addresses', () => {
it(`should click on the addresses button to access to the client's addresses`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('/address/index')
.url()
.then(url => {
expect(url).toContain('/address/index');
});
});
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, () => {
return nightmare
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitToClick(selectors.clientAddresses.equalizationTaxCheckboxLabel)
.click(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});
it('should navigate back to fiscal data to confirm invoice by address is now checked', () => {
return nightmare
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.evaluate(selector => {
return document.querySelector(selector).checked;
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
.then(value => {
expect(value).toBeTruthy();
});
});
});
});
});

View File

@ -1,99 +1,96 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('Client', () => {
describe('Add address notes path', () => {
const nightmare = createNightmare();
describe('Client add address notes path', () => {
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
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('#!/client/index');
});
});
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('#!/client/index');
});
it('should search for the user Petter Parker', () => {
return nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
it('should search for the user Petter Parker', () => {
return nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Petter Parker')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
it(`should click on the search result to access to the client addresses`, () => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.url()
.then(url => {
expect(url).toContain('address/index');
});
});
it(`should click on the search result to access to the client addresses`, () => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.url()
.then(url => {
expect(url).toContain('address/index');
});
it(`should click on the edit icon of the default address`, () => {
return nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit')
.url()
.then(result => {
expect(result).toContain('/edit');
});
});
it(`should click on the edit icon of the default address`, () => {
return nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit')
.url()
.then(result => {
expect(result).toContain('/edit');
});
it('should not save a description without observation type', () => {
return nightmare
.waitToClick(selectors.clientAddresses.addObservationButton)
.wait(selectors.clientAddresses.firstObservationDescriptionInput)
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
.waitToClick(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Observation type cannot be blank']));
});
});
it('should not save a description without observation type', () => {
return nightmare
.waitToClick(selectors.clientAddresses.addObservationButton)
.wait(selectors.clientAddresses.firstObservationDescriptionInput)
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
.waitToClick(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Observation type cannot be blank']));
});
it('should not save an observation type without description', () => {
return nightmare
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
.waitToClick(selectors.clientAddresses.firstObservationTypeSelect)
.waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne)
.waitToClick(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Some fields are invalid']));
});
});
it('should not save an observation type without description', () => {
return nightmare
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
.waitToClick(selectors.clientAddresses.firstObservationTypeSelect)
.waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne)
.waitToClick(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Some fields are invalid']));
});
});
it('should create two new observations', () => {
return nightmare
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
.waitToClick(selectors.clientAddresses.addObservationButton)
.waitToClick(selectors.clientAddresses.secondObservationTypeSelect)
.waitToClick(selectors.clientAddresses.secondObservationTypeSelectOptionTwo)
.type(selectors.clientAddresses.secondObservationDescriptionInput, 'second description')
.waitToClick(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
it('should create two new observations', () => {
return nightmare
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
.waitToClick(selectors.clientAddresses.addObservationButton)
.waitToClick(selectors.clientAddresses.secondObservationTypeSelect)
.waitToClick(selectors.clientAddresses.secondObservationTypeSelectOptionTwo)
.type(selectors.clientAddresses.secondObservationDescriptionInput, 'second description')
.waitToClick(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual(jasmine.arrayContaining(['Data saved!']));
});
});
});

View File

@ -31,5 +31,6 @@
"Sample type cannot be blank": "Sample type cannot be blank",
"The package cannot be blank": "The package cannot be blank",
"The warehouse can't be repeated": "The warehouse can't be repeated",
"The sales of that ticket can't be modified": "The sales of that ticket can't be modified"
"The sales of that ticket can't be modified": "The sales of that ticket can't be modified",
"The new quantity should be smaller than the old one": "The new quantity should be smaller than the old one"
}