part of the task #145 refactoring e2e paths

This commit is contained in:
Carlos Jimenez 2018-03-05 12:26:00 +01:00
parent 24abbffba7
commit c2017f85e8
8 changed files with 56 additions and 159 deletions

View File

@ -234,10 +234,12 @@ export default {
addNicheButton: `${components.vnIcon}[icon="add_circle"]`,
firstWarehouseSelect: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`,
firstWarehouseSelectSecondOption: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`,
secondWarehouseSelect: `vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`,
thirdWarehouseSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`,
thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(4)`,
secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`,
firstCodeInput: `vn-horizontal:nth-child(2) > ${components.vnTextfield}`,
secondCodeInput: `vn-horizontal:nth-child(3) > ${components.vnTextfield}`,
thirdCodeInput: `vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
submitNichesButton: `${components.vnSubmit}`
},

View File

@ -55,97 +55,18 @@ describe('Add address path', () => {
});
});
it('should check the default checkbox then receive an error after clicking save button as the form is empty', () => {
it('should receive an error after clicking save button as consignee, street and town fields are empty', () => {
return nightmare
.waitToClick(selectors.clientAddresses.defaultCheckboxInput)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but consignee', () => {
return nightmare
.type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but Street', () => {
return nightmare
.clearInput(selectors.clientAddresses.consigneeInput)
.type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but postcode', () => {
return nightmare
.clearInput(selectors.clientAddresses.streetAddressInput)
.type(selectors.clientAddresses.postcodeInput, '10022')
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but city', () => {
return nightmare
.clearInput(selectors.clientAddresses.postcodeInput)
.type(selectors.clientAddresses.cityInput, 'New York')
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but province', () => {
return nightmare
.clearInput(selectors.clientAddresses.cityInput)
.waitToClick(selectors.clientAddresses.provinceInput)
.waitToClick(selectors.clientAddresses.provinceSecondOption)
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but province and agency', () => {
return nightmare
.waitToClick(selectors.clientAddresses.agencyInput)
.waitToClick(selectors.clientAddresses.agenctySecondOption)
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but province, agency and phone', () => {
return nightmare
.type(selectors.clientAddresses.phoneInput, '999887744')
.click(selectors.createClientView.createButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it('should receive an error when clicking the save button having all the form fields empty but province, agency and mobile', () => {
return nightmare
.clearInput(selectors.clientAddresses.phoneInput)
.type(selectors.clientAddresses.mobileInput, '999887744')
.click(selectors.createClientView.createButton)
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
@ -156,9 +77,7 @@ describe('Add address path', () => {
return nightmare
.type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
.type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
.type(selectors.clientAddresses.postcodeInput, '10022')
.type(selectors.clientAddresses.cityInput, 'New York')
.type(selectors.clientAddresses.phoneInput, '999887744')
.click(selectors.clientAddresses.saveButton)
.waitForSnackbar()
.then(result => {

View File

@ -45,9 +45,11 @@ describe('Edit web access path', () => {
});
});
it(`should click on the Enable web access checkbox to uncheck it`, () => {
it(`should uncheck the Enable web access checkbox and update the name`, () => {
return nightmare
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
.clearInput(selectors.clientWebAccess.userNameInput)
.type(selectors.clientWebAccess.userNameInput, 'Hulk')
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForSnackbar()
.then(result => {
@ -55,7 +57,7 @@ describe('Edit web access path', () => {
});
});
it('should confirm Enable web access checkbox is unchecked', () => {
it('should confirm web access is unchecked and name updated', () => {
return nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
@ -66,29 +68,9 @@ describe('Edit web access path', () => {
}, selectors.clientWebAccess.enableWebAccessCheckbox)
.then(value => {
expect(value).toBeFalsy();
});
});
it('should edit the User name', () => {
return nightmare
.wait(selectors.clientWebAccess.userNameInput)
.clearInput(selectors.clientWebAccess.userNameInput)
.type(selectors.clientWebAccess.userNameInput, 'Hulk')
.click(selectors.clientWebAccess.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toEqual('Data saved!');
});
});
it('should confirm the User name have been edited', () => {
return nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.click(selectors.clientWebAccess.webAccessButton)
.wait(selectors.clientWebAccess.userNameInput)
.waitForTextInInput(selectors.clientWebAccess.userNameInput, 'Hulk')
.getInputValue(selectors.clientWebAccess.userNameInput)
return nightmare
.getInputValue(selectors.clientWebAccess.userNameInput);
})
.then(result => {
expect(result).toEqual('Hulk');
});

View File

@ -55,39 +55,8 @@ describe('Add greuge path', () => {
});
});
it(`should receive an error if all fields are empty but date on submit`, () => {
return nightmare
.click(selectors.clientCredit.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it(`should receive an error if all fields are empty but date and amount on submit`, () => {
return nightmare
.type(selectors.clientGreuge.amountInput, 999)
.click(selectors.clientGreuge.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it(`should receive an error if all fields are empty but date and description on submit`, () => {
return nightmare
.clearInput(selectors.clientGreuge.amountInput)
.type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
.click(selectors.clientGreuge.saveButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Some fields are invalid');
});
});
it(`should receive an error if all fields are empty but date and type on submit`, () => {
return nightmare
.clearInput(selectors.clientGreuge.descriptionInput)
.waitToClick(selectors.clientGreuge.typeInput)
.waitToClick(selectors.clientGreuge.typeSecondOption)
.click(selectors.clientGreuge.saveButton)
@ -99,7 +68,6 @@ describe('Add greuge path', () => {
it(`should create a new greuge with all its data`, () => {
return nightmare
.clearInput(selectors.clientGreuge.amountInput)
.type(selectors.clientGreuge.amountInput, 999)
.type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
.click(selectors.clientGreuge.saveButton)

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('mandate path', () => {
describe('lock verified data path', () => {
const nightmare = createNightmare();
describe('as salesPerson', () => {

View File

@ -1,7 +1,7 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('mandate path', () => {
describe('invoice path', () => {
const nightmare = createNightmare();
beforeAll(() => {
@ -51,7 +51,6 @@ describe('mandate path', () => {
.getInnerText(selectors.clientInvoices.firstInvoiceText)
.then(value => {
expect(value).toContain('V1800001');
expect(value).toContain('02/03/2018');
expect(value).toContain('350.50');
});
});

View File

@ -49,11 +49,11 @@ describe('create item niche path', () => {
.waitToClick(selectors.itemNiches.firstWarehouseSelect)
.waitToClick(selectors.itemNiches.firstWarehouseSelectSecondOption)
.clearInput(selectors.itemNiches.firstCodeInput)
.type(selectors.itemNiches.firstCodeInput, 'New Location')
.type(selectors.itemNiches.firstCodeInput, 'A2')
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
.waitToClick(selectors.itemNiches.thirdWarehouseSelect)
.waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption)
.type(selectors.itemNiches.thirdCodeInput, 'a code')
.type(selectors.itemNiches.thirdCodeInput, 'A4')
.click(selectors.itemNiches.submitNichesButton)
.waitForSnackbar()
.then(result => {
@ -61,15 +61,46 @@ describe('create item niche path', () => {
});
});
it(`should confirm the remaining niches are for the second third and fourth warehouses`, () => {
it(`should confirm the first niche is the expected one`, () => {
return nightmare
.click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemNiches.nicheButton)
.wait(200)
.getInputValue(selectors.itemNiches.thirdCodeInput)
.getInputValue(selectors.itemNiches.firstWarehouseSelect)
.then(result => {
expect(result).toEqual('a code');
expect(result).toEqual('Warehouse Two');
return nightmare
.getInputValue(selectors.itemNiches.firstCodeInput);
})
.then(result => {
expect(result).toEqual('A2');
});
});
it(`should confirm the second niche is the expected one`, () => {
return nightmare
.getInputValue(selectors.itemNiches.secondWarehouseSelect)
.then(result => {
expect(result).toEqual('Warehouse Three');
return nightmare
.getInputValue(selectors.itemNiches.secondCodeInput);
})
.then(result => {
expect(result).toEqual('A3');
});
});
it(`should confirm the third niche is the expected one`, () => {
return nightmare
.getInputValue(selectors.itemNiches.thirdWarehouseSelect)
.then(result => {
expect(result).toEqual('Warehouse Four');
return nightmare
.getInputValue(selectors.itemNiches.thirdCodeInput);
})
.then(result => {
expect(result).toEqual('A4');
});
});
});

View File

@ -57,7 +57,7 @@ describe('create item botanical path', () => {
});
});
it(`should confirm the botanical for item 5 was created`, () => {
it(`should confirm the botanical for item Mjolnir was created`, () => {
return nightmare
.click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
@ -69,25 +69,23 @@ describe('create item botanical path', () => {
});
});
it(`should confirm the Genus for item 5 was created`, () => {
it(`should confirm the Genus for item Mjolnir was created`, () => {
return nightmare
.wait(200)
.getInputValue(selectors.itemBotanical.genusSelect)
.then(result => {
expect(result).toEqual('Abelia');
});
});
it(`should confirm the Species for item 5 was created`, () => {
it(`should confirm the Species for item Mjolnir was created`, () => {
return nightmare
.wait(200)
.getInputValue(selectors.itemBotanical.speciesSelect)
.then(result => {
expect(result).toEqual('dealbata');
});
});
it(`should edit botanical for the item with id Mjolnir`, () => {
it(`should edit botanical for the item Mjolnir`, () => {
return nightmare
.clearInput(selectors.itemBotanical.botanicalInput)
.type(selectors.itemBotanical.botanicalInput, 'Herp Derp')
@ -102,7 +100,7 @@ describe('create item botanical path', () => {
});
});
it(`should confirm the botanical for item 5 was edited`, () => {
it(`should confirm the botanical for item Mjolnir was edited`, () => {
return nightmare
.click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
@ -114,18 +112,16 @@ describe('create item botanical path', () => {
});
});
it(`should confirm the Genus for item 5 was edited`, () => {
it(`should confirm the Genus for item Mjolnir was edited`, () => {
return nightmare
.wait(200)
.getInputValue(selectors.itemBotanical.genusSelect)
.then(result => {
expect(result).toEqual('Abies');
});
});
it(`should confirm the Species for item 5 was edited`, () => {
it(`should confirm the Species for item Mjolnir was edited`, () => {
return nightmare
.wait(200)
.getInputValue(selectors.itemBotanical.speciesSelect)
.then(result => {
expect(result).toEqual('decurrens');