refactor e2e

This commit is contained in:
Bernat 2018-10-30 08:51:18 +01:00
parent 1718952fcf
commit d220e9b9cd
12 changed files with 890 additions and 1062 deletions

View File

@ -10,7 +10,7 @@ describe('Claim edit basic data path', () => {
});
it('should click on the Claims button of the top bar menu', async () => {
let url = await nightmare
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.claimsButton)
@ -21,7 +21,7 @@ describe('Claim edit basic data path', () => {
});
it('should search for the claim with id 1', async () => {
let resultCount = await nightmare
const resultCount = await nightmare
.wait(selectors.claimsIndex.searchResult)
.type(selectors.claimsIndex.searchClaimInput, '1')
.click(selectors.claimsIndex.searchButton)
@ -32,7 +32,7 @@ describe('Claim edit basic data path', () => {
});
it(`should click on the search result to access to the claim Basic Data`, async () => {
let url = await nightmare
const url = await nightmare
.waitToClick(selectors.claimsIndex.searchResult)
.waitToClick(selectors.claimBasicData.basicDataButton)
.waitForURL('basic-data')
@ -42,7 +42,7 @@ describe('Claim edit basic data path', () => {
});
it(`should edit claim state, is paid with mana and observation fields`, async () => {
let result = await nightmare
const result = await nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectThirdOption)
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)
@ -55,7 +55,7 @@ describe('Claim edit basic data path', () => {
});
it('should confirm the claim state was edited', async () => {
let result = await nightmare
const result = await nightmare
.click(selectors.claimDetails.detailsButton)
.wait(selectors.claimDetails.addItemButton)
.click(selectors.claimBasicData.basicDataButton)
@ -66,8 +66,8 @@ describe('Claim edit basic data path', () => {
});
it('should confirm the Is paid with mana checkbox is checked', async () => {
let value = await nightmare
.evaluate(selector => {
const value = await nightmare
.evaluate((selector) => {
return document.querySelector(selector).checked;
}, selectors.claimBasicData.isPaidWithManaCheckbox);
@ -75,14 +75,14 @@ describe('Claim edit basic data path', () => {
});
it('should confirm the claim observation was edited', async () => {
let result = await nightmare
const result = await nightmare
.getInputValue(selectors.claimBasicData.observationInput);
expect(result).toEqual('edited observation');
});
it(`should edit the claim to leave it untainted`, async () => {
let result = await nightmare
const result = await nightmare
.waitToClick(selectors.claimBasicData.claimStateSelect)
.waitToClick(selectors.claimBasicData.claimStateSelectFourthOption)
.waitToClick(selectors.claimBasicData.isPaidWithManaCheckbox)

View File

@ -9,59 +9,51 @@ describe('Client Edit basicData path', () => {
.waitForLogin('employee');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Bruce Wayne', done => {
return nightmare
it('should search for the user Bruce Wayne', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Wayne')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it('should click on the search result to access to the client summary', done => {
return nightmare
it('should click on the search result to access to the client summary', async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Wayne')
.waitToClick(selectors.clientsIndex.searchResult)
.waitForURL('summary')
.url()
.then(url => {
.url();
expect(url).toContain('summary');
done();
}).catch(done.fail);
});
it('should not be able to change the salesPerson', done => {
return nightmare
it('should not be able to change the salesPerson', async () => {
const result = await nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.evaluate(selector => {
.evaluate((selector) => {
return document.querySelector(selector).disabled;
}, selectors.clientBasicData.salesPersonInput)
.then(value => {
expect(value).toBeTruthy();
done();
}).catch(done.fail);
}, selectors.clientBasicData.salesPersonInput);
expect(result).toBeTruthy();
});
it('should edit the client basic data but leave salesPerson untainted', done => {
return nightmare
it('should edit the client basic data but leave salesPerson untainted', async () => {
const result = await nightmare
.clearInput(selectors.clientBasicData.nameInput)
.type(selectors.clientBasicData.nameInput, 'Ptonomy Wallace')
.clearInput(selectors.clientBasicData.contactInput)
@ -75,69 +67,55 @@ describe('Client Edit basicData path', () => {
.waitToClick(selectors.clientBasicData.channelInput)
.waitToClick(selectors.clientBasicData.channelRumorsOption)
.click(selectors.clientBasicData.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should confirm the name have been edited', done => {
return nightmare
it('should confirm the name have been edited', async () => {
const result = await nightmare
.click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput)
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.getInputValue(selectors.clientBasicData.nameInput)
.then(result => {
.getInputValue(selectors.clientBasicData.nameInput);
expect(result).toEqual('Ptonomy Wallace');
done();
}).catch(done.fail);
});
it('should confirm the contact name have been edited', done => {
return nightmare
.getInputValue(selectors.clientBasicData.contactInput)
.then(result => {
it('should confirm the contact name have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.contactInput);
expect(result).toEqual('David Haller');
done();
}).catch(done.fail);
});
it('should confirm the landline phone number have been added', done => {
return nightmare
.getInputValue(selectors.clientBasicData.phoneInput)
.then(result => {
it('should confirm the landline phone number have been added', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.phoneInput);
expect(result).toEqual('987654321');
done();
}).catch(done.fail);
});
it('should confirm the mobile phone number have been added', done => {
return nightmare
.getInputValue(selectors.clientBasicData.mobileInput)
.then(result => {
it('should confirm the mobile phone number have been added', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.mobileInput);
expect(result).toEqual('123456789');
done();
}).catch(done.fail);
});
it('should confirm the email have been edited', done => {
return nightmare
.getInputValue(selectors.clientBasicData.emailInput)
.then(result => {
it('should confirm the email have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.emailInput);
expect(result).toEqual('PWallace@verdnatura.es');
done();
}).catch(done.fail);
});
it('should confirm the channel have been selected', done => {
return nightmare
.getInputValue(selectors.clientBasicData.channelInput)
.then(result => {
it('should confirm the channel have been selected', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.channelInput);
expect(result).toEqual('Rumors on the streets');
done();
}).catch(done.fail);
});
});
@ -148,59 +126,51 @@ describe('Client Edit basicData path', () => {
.waitForLogin('salesAssistant');
});
it('should now click on the Clients button of the top bar menu', done => {
return nightmare
it('should now click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should now search for the user Ptonomy Wallace', done => {
return nightmare
it('should now search for the user Ptonomy Wallace', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Ptonomy Wallace')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it('should now click on the search result to access to the client summary', done => {
return nightmare
it('should now click on the search result to access to the client summary', async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Ptonomy Wallace')
.waitToClick(selectors.clientsIndex.searchResult)
.waitForURL('summary')
.url()
.then(url => {
.url();
expect(url).toContain('summary');
done();
}).catch(done.fail);
});
it('should be able to change the salesPerson', done => {
return nightmare
it('should be able to change the salesPerson', async () => {
const result = await nightmare
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.evaluate(selector => {
.evaluate((selector) => {
return document.querySelector(selector).disabled;
}, selectors.clientBasicData.salesPersonInput)
.then(value => {
expect(value).toBeFalsy();
done();
}).catch(done.fail);
}, selectors.clientBasicData.salesPersonInput);
expect(result).toBeFalsy();
});
it('should edit the client basic data including salesPerson', done => {
return nightmare
it('should edit the client basic data including salesPerson', async () => {
const result = await nightmare
.clearInput(selectors.clientBasicData.nameInput)
.type(selectors.clientBasicData.nameInput, 'Ororo Munroe')
.clearInput(selectors.clientBasicData.contactInput)
@ -216,78 +186,62 @@ describe('Client Edit basicData path', () => {
.waitToClick(selectors.clientBasicData.channelInput)
.waitToClick(selectors.clientBasicData.channelMetropolisOption)
.click(selectors.clientBasicData.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should now confirm the name have been edited', done => {
return nightmare
it('should now confirm the name have been edited', async () => {
const result = await nightmare
.click(selectors.clientFiscalData.fiscalDataButton)
.wait(selectors.clientFiscalData.addressInput)
.click(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.getInputValue(selectors.clientBasicData.nameInput)
.then(result => {
.getInputValue(selectors.clientBasicData.nameInput);
expect(result).toEqual('Ororo Munroe');
done();
}).catch(done.fail);
});
it('should now confirm the contact name have been edited', done => {
return nightmare
.getInputValue(selectors.clientBasicData.contactInput)
.then(result => {
it('should now confirm the contact name have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.contactInput);
expect(result).toEqual('Black Panther');
done();
}).catch(done.fail);
});
it('should now confirm the landline phone number have been added', done => {
return nightmare
.getInputValue(selectors.clientBasicData.phoneInput)
.then(result => {
it('should now confirm the landline phone number have been added', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.phoneInput);
expect(result).toEqual('123456789');
done();
}).catch(done.fail);
});
it('should now confirm the mobile phone number have been added', done => {
return nightmare
.getInputValue(selectors.clientBasicData.mobileInput)
.then(result => {
it('should now confirm the mobile phone number have been added', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.mobileInput);
expect(result).toEqual('987654321');
done();
}).catch(done.fail);
});
it('should now confirm the email have been edited', done => {
return nightmare
.getInputValue(selectors.clientBasicData.emailInput)
.then(result => {
it('should now confirm the email have been edited', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.emailInput);
expect(result).toEqual('Storm@verdnatura.es');
done();
}).catch(done.fail);
});
it('should confirm the sales person have been selected', done => {
return nightmare
.getInputValue(selectors.clientBasicData.salesPersonInput)
.then(result => {
it('should confirm the sales person have been selected', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.salesPersonInput);
expect(result).toEqual('accessory');
done();
}).catch(done.fail);
});
it('should now confirm the channel have been selected', done => {
return nightmare
.getInputValue(selectors.clientBasicData.channelInput)
.then(result => {
it('should now confirm the channel have been selected', async () => {
const result = await nightmare
.getInputValue(selectors.clientBasicData.channelInput);
expect(result).toEqual('Metropolis newspaper');
done();
}).catch(done.fail);
});
});
});

View File

@ -11,7 +11,7 @@ describe('Client', () => {
});
it('should click on the Clients button of the top bar menu', async () => {
let url = await nightmare
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
@ -22,7 +22,7 @@ describe('Client', () => {
});
it('should search for the user Bruce Banner', async () => {
let resultCount = await nightmare
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Bruce Banner')
.click(selectors.clientsIndex.searchButton)
@ -33,7 +33,7 @@ describe('Client', () => {
});
it(`should click on the search result to access to the client's pay method`, async () => {
let url = await nightmare
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientPayMethod.payMethodButton)
@ -44,7 +44,7 @@ describe('Client', () => {
});
it(`should attempt to edit the Pay method without an IBAN but fail`, async () => {
let snackbarMessage = await nightmare
const snackbarMessage = await nightmare
.waitToClick(selectors.clientPayMethod.payMethodInput)
.waitToClick(selectors.clientPayMethod.payMethodIBANOption)
.waitForTextInInput(selectors.clientPayMethod.payMethodInput, 'PayMethod with IBAN')
@ -61,7 +61,7 @@ describe('Client', () => {
});
it(`should add the IBAN but fail as it requires a BIC code`, async () => {
let snackbarMessage = await nightmare
const snackbarMessage = await nightmare
.clearInput(selectors.clientPayMethod.IBANInput)
.type(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
.waitForTextInInput(selectors.clientPayMethod.IBANInput, 'ES91 2100 0418 4502 0005 1332')
@ -72,7 +72,7 @@ describe('Client', () => {
});
it(`should create a new BIC code`, async () => {
let newcode = await nightmare
const newcode = await nightmare
.click(selectors.clientPayMethod.newBankEntityButton)
.type(selectors.clientPayMethod.newBankEntityName, 'Gotham City Banks')
.type(selectors.clientPayMethod.newBankEntityBIC, 'GTHMCT')
@ -83,21 +83,21 @@ describe('Client', () => {
});
it(`should confirm the IBAN pay method is sucessfully saved`, async () => {
let payMethod = await nightmare
const payMethod = await nightmare
.getInputValue(selectors.clientPayMethod.payMethodInput);
expect(payMethod).toEqual('PayMethod with IBAN');
});
it('should confirm the due day have been edited', async () => {
let dueDate = await nightmare
const dueDate = await nightmare
.getInputValue(selectors.clientPayMethod.dueDayInput);
expect(dueDate).toEqual('60');
});
it('should confirm the IBAN was saved', async () => {
let IBAN = await nightmare
const IBAN = await nightmare
.waitProperty(selectors.clientPayMethod.IBANInput, 'value')
.getProperty(selectors.clientPayMethod.IBANInput, 'value');
@ -105,7 +105,7 @@ describe('Client', () => {
});
it('should confirm the swift / BIC code was saved', async () => {
let code = await nightmare
const code = await nightmare
.waitProperty(selectors.clientPayMethod.swiftBicInput, 'value')
.getProperty(selectors.clientPayMethod.swiftBicInput, 'value');
@ -113,8 +113,8 @@ describe('Client', () => {
});
it('should confirm Received LCR checkbox is checked', async () => {
let checkedBox = await nightmare
.evaluate(selector => {
const checkedBox = await nightmare
.evaluate((selector) => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreLCRCheckbox);
@ -122,8 +122,8 @@ describe('Client', () => {
});
it('should confirm Received core VNL checkbox is unchecked', async () => {
let checkedBox = await nightmare
.evaluate(selector => {
const checkedBox = await nightmare
.evaluate((selector) => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedCoreVNLCheckbox);
@ -131,8 +131,8 @@ describe('Client', () => {
});
it('should confirm Received B2B VNL checkbox is unchecked', async () => {
let checkedBox = await nightmare
.evaluate(selector => {
const checkedBox = await nightmare
.evaluate((selector) => {
return document.querySelector(selector).checked;
}, selectors.clientPayMethod.receivedB2BVNLCheckbox);

View File

@ -10,80 +10,68 @@ describe('Client', () => {
.waitForLogin('employee');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Bruce Banner', done => {
return nightmare
it('should search for the user Bruce Banner', async () => {
const resultCount = await 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);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client addresses`, done => {
return nightmare
it(`should click on the search result to access to the client addresses`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.url()
.then(url => {
.url();
expect(url).toContain('address/index');
done();
}).catch(done.fail);
});
it(`should click on the add new address button to access to the new address form`, done => {
return nightmare
it(`should click on the add new address button to access to the new address form`, async () => {
const url =await nightmare
.waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create')
.url()
.then(url => {
.url();
expect(url).toContain('address/create');
done();
}).catch(done.fail);
});
it(`should return to the addreses section by clicking the cancel button`, done => {
return nightmare
it(`should return to the addreses section by clicking the cancel button`, async () => {
const url = await nightmare
.waitToClick(selectors.clientAddresses.cancelButton)
.waitForURL('address/index')
.url()
.then(url => {
.url();
expect(url).toContain('address/index');
done();
}).catch(done.fail);
});
it(`should now click on the add new address button to access to the new address form`, done => {
return nightmare
it(`should now click on the add new address button to access to the new address form`, async () => {
const url = await nightmare
.waitToClick(selectors.clientAddresses.createAddress)
.waitForURL('address/create')
.url()
.then(url => {
.url();
expect(url).toContain('address/create');
done();
}).catch(done.fail);
});
it('should receive an error after clicking save button as consignee, street and town fields are empty', done => {
return nightmare
it('should receive an error after clicking save button as consignee, street and town fields are empty', async () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.defaultCheckboxInput)
.clearInput(selectors.clientAddresses.streetAddressInput)
.type(selectors.clientAddresses.postcodeInput, '10022')
@ -94,69 +82,57 @@ describe('Client', () => {
.type(selectors.clientAddresses.phoneInput, '999887744')
.type(selectors.clientAddresses.mobileInput, '999887744')
.waitToClick(selectors.clientFiscalData.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
});
it(`should create a new address with all it's data`, done => {
return nightmare
it(`should create a new address with all it's data`, async () => {
const result = await nightmare
.type(selectors.clientAddresses.consigneeInput, 'Bruce Bunner')
.type(selectors.clientAddresses.streetAddressInput, '320 Park Avenue New York')
.type(selectors.clientAddresses.cityInput, 'New York')
.click(selectors.clientAddresses.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should click on the addresses button confirm the new address exists and it's the default one`, done => {
return nightmare
it(`should click on the addresses button confirm the new address exists and it's the default one`, async () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.addressesButton)
.wait(selectors.clientAddresses.defaultAddress)
.getInnerText(selectors.clientAddresses.defaultAddress)
.then(result => {
.getInnerText(selectors.clientAddresses.defaultAddress);
expect(result).toContain('320 Park Avenue New York');
done();
}).catch(done.fail);
});
it(`should click on the make default icon of the second address then confirm it is the default one now`, done => {
return nightmare
it(`should click on the make default icon of the second address then confirm it is the default one now`, async () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.secondMakeDefaultStar)
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.getInnerText(selectors.clientAddresses.defaultAddress)
.then(result => {
.getInnerText(selectors.clientAddresses.defaultAddress);
expect(result).toContain('Somewhere in Thailand');
done();
}).catch(done.fail);
});
it(`should click on the edit icon of the default address`, done => {
return nightmare
it(`should click on the edit icon of the default address`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, 'Somewhere in Thailand')
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit')
.url()
.then(result => {
expect(result).toContain('/edit');
done();
}).catch(done.fail);
.url();
expect(url).toContain('/edit');
});
it(`should click on the active checkbox and receive an error to save it because it is the default address`, done => {
return nightmare
it(`should click on the active checkbox and receive an error to save it because it is the default address`, async () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.activeCheckbox)
.waitToClick(selectors.clientAddresses.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('The default consignee can not be unchecked');
done();
}).catch(done.fail);
});
});
});

View File

@ -9,95 +9,81 @@ describe('Client add address notes path', () => {
.waitForLogin('employee');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Petter Parker', done => {
return nightmare
it('should search for the user Petter Parker', async () => {
const resultCount = await 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);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client addresses`, done => {
return nightmare
it(`should click on the search result to access to the client addresses`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientAddresses.addressesButton)
.waitForURL('address/index')
.url()
.then(url => {
.url();
expect(url).toContain('address/index');
done();
}).catch(done.fail);
});
it(`should click on the edit icon of the default address`, done => {
return nightmare
it(`should click on the edit icon of the default address`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientAddresses.defaultAddress, '20 Ingram Street')
.waitToClick(selectors.clientAddresses.firstEditButton)
.waitForURL('/edit')
.url()
.then(result => {
expect(result).toContain('/edit');
done();
}).catch(done.fail);
.url();
expect(url).toContain('/edit');
});
it('should not save a description without observation type', done => {
return nightmare
it('should not save a description without observation type', async () => {
const result = await nightmare
.waitToClick(selectors.clientAddresses.addObservationButton)
.wait(selectors.clientAddresses.firstObservationDescriptionInput)
.type(selectors.clientAddresses.firstObservationDescriptionInput, 'first description')
.waitToClick(selectors.clientAddresses.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Observation type cannot be blank');
done();
}).catch(done.fail);
});
it('should not save an observation type without description', done => {
return nightmare
it('should not save an observation type without description', async () => {
const result = await nightmare
.clearInput(selectors.clientAddresses.firstObservationDescriptionInput)
.waitToClick(selectors.clientAddresses.firstObservationTypeSelect)
.waitToClick(selectors.clientAddresses.firstObservationTypeSelectOptionOne)
.waitToClick(selectors.clientAddresses.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
});
it('should create two new observations', done => {
return nightmare
it('should create two new observations', async () => {
const result = await 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)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
});

View File

@ -10,80 +10,68 @@ describe('Client', () => {
.waitForLogin('employee');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Bruce Banner', done => {
return nightmare
it('should search for the user Bruce Banner', async () => {
const resultCount = await 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);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's web access`, done => {
return nightmare
it(`should click on the search result to access to the client's web access`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientWebAccess.webAccessButton)
.waitForURL('web-access')
.url()
.then(url => {
.url();
expect(url).toContain('web-access');
done();
}).catch(done.fail);
});
it(`should uncheck the Enable web access checkbox and update the name`, done => {
return nightmare
it(`should uncheck the Enable web access checkbox and update the name`, async () => {
const result = await nightmare
.waitToClick(selectors.clientWebAccess.enableWebAccessCheckbox)
.clearInput(selectors.clientWebAccess.userNameInput)
.type(selectors.clientWebAccess.userNameInput, 'Hulk')
.waitToClick(selectors.clientWebAccess.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should confirm web access is now unchecked', done => {
return nightmare
it('should confirm web access is now unchecked', async () => {
const result = await nightmare
.waitToClick(selectors.clientBasicData.basicDataButton)
.wait(selectors.clientBasicData.nameInput)
.waitToClick(selectors.clientWebAccess.webAccessButton)
.wait(selectors.clientWebAccess.enableWebAccessCheckbox)
.evaluate(selector => {
.evaluate((selector) => {
return document.querySelector(selector).checked;
}, selectors.clientWebAccess.enableWebAccessCheckbox)
.then(value => {
expect(value).toBeFalsy();
done();
}).catch(done.fail);
}, selectors.clientWebAccess.enableWebAccessCheckbox);
expect(result).toBeFalsy();
});
it('should confirm web access name have been updated', done => {
return nightmare
.getInputValue(selectors.clientWebAccess.userNameInput)
.then(result => {
it('should confirm web access name have been updated', async () => {
const result = await nightmare
.getInputValue(selectors.clientWebAccess.userNameInput);
expect(result).toEqual('Hulk');
done();
}).catch(done.fail);
});
});
});

View File

@ -10,75 +10,63 @@ describe('Client', () => {
.waitForLogin('employee');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async ()=> {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Bruce Banner', done => {
return nightmare
it('should search for the user Bruce Banner', async () => {
const resultCount = await 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);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's notes`, done => {
return nightmare
it(`should click on the search result to access to the client's notes`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientNotes.notesButton)
.waitForURL('note/index')
.url()
.then(url => {
.url();
expect(url).toContain('note/index');
done();
}).catch(done.fail);
});
it(`should click on the add note button`, done => {
return nightmare
it(`should click on the add note button`, async () => {
const url = await nightmare
.waitToClick(selectors.clientNotes.addNoteFloatButton)
.waitForURL('/note/create')
.url()
.then(url => {
.url();
expect(url).toContain('/note/create');
done();
}).catch(done.fail);
});
it(`should create a note`, done => {
return nightmare
it(`should create a note`, async () => {
const result = await nightmare
.type(selectors.clientNotes.noteInput, 'Meeting with Black Widow 21st 9am')
.click(selectors.clientNotes.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should confirm the note was created', done => {
return nightmare
it('should confirm the note was created', async () => {
const result = await nightmare
.wait(selectors.clientNotes.firstNoteText)
.getInnerText(selectors.clientNotes.firstNoteText)
.then(value => {
expect(value).toEqual('Meeting with Black Widow 21st 9am');
done();
}).catch(done.fail);
.getInnerText(selectors.clientNotes.firstNoteText);
expect(result).toEqual('Meeting with Black Widow 21st 9am');
});
});
});

View File

@ -10,77 +10,65 @@ describe('Client', () => {
.waitForLogin('salesAssistant');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Ororo Munroe', done => {
return nightmare
it('should search for the user Hank Pym', async () => {
const resultCount = await nightmare
.wait(selectors.clientsIndex.searchResult)
.type(selectors.clientsIndex.searchClientInput, 'Ororo Munroe')
.type(selectors.clientsIndex.searchClientInput, 'Hank Pym')
.click(selectors.clientsIndex.searchButton)
.waitForNumberOfElements(selectors.clientsIndex.searchResult, 1)
.countElement(selectors.clientsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's credit`, done => {
return nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Ororo Munroe')
it(`should click on the search result to access to the client's credit`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Hank Pym')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientCredit.creditButton)
.waitForURL('credit/index')
.url()
.then(url => {
.url();
expect(url).toContain('credit/index');
done();
}).catch(done.fail);
});
it(`should click on the add credit button`, done => {
return nightmare
it(`should click on the add credit button`, async () => {
const url = await nightmare
.waitToClick(selectors.clientCredit.addCreditFloatButton)
.waitForURL('/credit/create')
.url()
.then(url => {
.url();
expect(url).toContain('/credit/create');
done();
}).catch(done.fail);
});
it(`should edit the credit`, done => {
return nightmare
it(`should edit the credit`, async () => {
const result = await nightmare
.clearInput(selectors.clientCredit.creditInput)
.type(selectors.clientCredit.creditInput, 999)
.click(selectors.clientCredit.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should confirm the credit was updated', done => {
return nightmare
it('should confirm the credit was updated', async () => {
const result = await nightmare
.wait(selectors.clientCredit.firstCreditText)
.getInnerText(selectors.clientCredit.firstCreditText)
.then(value => {
expect(value).toContain(999);
expect(value).toContain('salesAssistant');
done();
}).catch(done.fail);
.getInnerText(selectors.clientCredit.firstCreditText);
expect(result).toContain(999);
expect(result).toContain('salesAssistant');
});
});
});

View File

@ -10,91 +10,77 @@ describe('Client', () => {
.waitForLogin('salesAssistant');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Petter Parker', done => {
return nightmare
it('should search for the user Petter Parker', async () => {
const resultCount = await 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);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's greuge`, done => {
return nightmare
it(`should click on the search result to access to the client's greuge`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter Parker')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientGreuge.greugeButton)
.waitForURL('greuge/index')
.url()
.then(url => {
.url();
expect(url).toContain('greuge/index');
done();
}).catch(done.fail);
});
it(`should click on the add greuge button`, done => {
return nightmare
it(`should click on the add greuge button`, async () => {
const url = await nightmare
.waitToClick(selectors.clientGreuge.addGreugeFloatButton)
.waitForURL('greuge/create')
.url()
.then(url => {
.url();
expect(url).toContain('greuge/create');
done();
}).catch(done.fail);
});
it(`should receive an error if all fields are empty but date and type on submit`, done => {
return nightmare
it(`should receive an error if all fields are empty but date and type on submit`, async () => {
const result = await nightmare
.waitToClick(selectors.clientGreuge.typeInput)
.waitToClick(selectors.clientGreuge.typeSecondOption)
.click(selectors.clientGreuge.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Some fields are invalid');
done();
}).catch(done.fail);
});
it(`should create a new greuge with all its data`, done => {
return nightmare
it(`should create a new greuge with all its data`, async () => {
const result = await nightmare
.type(selectors.clientGreuge.amountInput, 999)
.waitForTextInInput(selectors.clientGreuge.amountInput, '999')
.type(selectors.clientGreuge.descriptionInput, 'new armor for Batman!')
.click(selectors.clientGreuge.saveButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it('should confirm the greuge was added to the list', done => {
return nightmare
it('should confirm the greuge was added to the list', async () => {
const result = await nightmare
.wait(selectors.clientGreuge.firstGreugeText)
.getInnerText(selectors.clientGreuge.firstGreugeText)
.then(value => {
expect(value).toContain(999);
expect(value).toContain('new armor for Batman!');
expect(value).toContain('Diff');
done();
}).catch(done.fail);
.getInnerText(selectors.clientGreuge.firstGreugeText);
expect(result).toContain(999);
expect(result).toContain('new armor for Batman!');
expect(result).toContain('Diff');
});
});
});

View File

@ -10,55 +10,47 @@ describe('Client', () => {
.waitForLogin('salesPerson');
});
it('should click on the Clients button of the top bar menu', done => {
return nightmare
it('should click on the Clients button of the top bar menu', async () => {
const url = await nightmare
.waitToClick(selectors.globalItems.applicationsMenuButton)
.wait(selectors.globalItems.applicationsMenuVisible)
.waitToClick(selectors.globalItems.clientsButton)
.wait(selectors.clientsIndex.createClientButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/client/index');
done();
}).catch(done.fail);
});
it('should search for the user Petter Parker', done => {
return nightmare
it('should search for the user Petter Parker', async () => {
const resultCount = await 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);
done();
}).catch(done.fail);
.countElement(selectors.clientsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the client's mandate`, done => {
return nightmare
it(`should click on the search result to access to the client's mandate`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Petter')
.waitToClick(selectors.clientsIndex.searchResult)
.waitToClick(selectors.clientMandate.mandateButton)
.waitForURL('mandate')
.url()
.then(url => {
.url();
expect(url).toContain('mandate');
done();
}).catch(done.fail);
});
it('should confirm the client has a mandate of the CORE type', done => {
return nightmare
it('should confirm the client has a mandate of the CORE type', async () => {
const result = await nightmare
.wait(selectors.clientMandate.firstMandateText)
.getInnerText(selectors.clientMandate.firstMandateText)
.then(value => {
expect(value).toContain('1');
expect(value).toContain('VNL');
expect(value).toContain('CORE');
done();
}).catch(done.fail);
.getInnerText(selectors.clientMandate.firstMandateText);
expect(result).toContain('1');
expect(result).toContain('VNL');
expect(result).toContain('CORE');
});
});
});

View File

@ -10,45 +10,39 @@ describe('Item', () => {
.waitForLogin('buyer');
});
it('should access to the items index by clicking the items button', done => {
return nightmare
it('should access to the items index by clicking the items button', async () => {
const url = await nightmare
.click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/item/index');
done();
}).catch(done.fail);
});
it('should search for the item Gem of Mind', done => {
return nightmare
it('should search for the item Gem of Mind', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.itemsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the item basic data`, done => {
return nightmare
it(`should click on the search result to access to the item basic data`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemBasicData.basicDataButton)
.waitForURL('data')
.url()
.then(url => {
.url();
expect(url).toContain('data');
done();
}).catch(done.fail);
});
it(`should edit the item basic data`, done => {
return nightmare
it(`should edit the item basic data`, async () => {
const result = await nightmare
.clearInput(selectors.itemBasicData.nameInput)
.type(selectors.itemBasicData.nameInput, 'Rose of Purity')
.waitToClick(selectors.itemBasicData.typeSelect)
@ -65,89 +59,71 @@ describe('Item', () => {
.type(selectors.itemBasicData.longNameInput, 'RS Rose of Purity')
.waitToClick(selectors.itemBasicData.isActiveCheckbox)
.click(selectors.itemBasicData.submitBasicDataButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should confirm the item name was edited`, done => {
return nightmare
it(`should confirm the item name was edited`, async () => {
const result = await nightmare
.click(selectors.itemNiches.nicheButton)
.wait(selectors.itemNiches.firstWarehouseDisabled)
.waitToClick(selectors.itemBasicData.basicDataButton)
.waitForTextInInput(selectors.itemBasicData.nameInput, 'Rose of Purity')
.getInputValue(selectors.itemBasicData.nameInput)
.then(result => {
.getInputValue(selectors.itemBasicData.nameInput);
expect(result).toEqual('Rose of Purity');
done();
}).catch(done.fail);
});
it(`should confirm the item type was edited`, done => {
return nightmare
.getInputValue(selectors.itemBasicData.typeSelect)
.then(result => {
it(`should confirm the item type was edited`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBasicData.typeSelect);
expect(result).toEqual('Crisantemo');
done();
}).catch(done.fail);
});
it(`should confirm the item intrastad was edited`, done => {
return nightmare
.getInputValue(selectors.itemBasicData.intrastatSelect)
.then(result => {
it(`should confirm the item intrastad was edited`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBasicData.intrastatSelect);
expect(result).toEqual('Coral y materiales similares');
done();
}).catch(done.fail);
});
it(`should confirm the item relevancy was edited`, done => {
return nightmare
.getInputValue(selectors.itemBasicData.relevancyInput)
.then(result => {
it(`should confirm the item relevancy was edited`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBasicData.relevancyInput);
expect(result).toEqual('1');
done();
}).catch(done.fail);
});
it(`should confirm the item origin was edited`, done => {
return nightmare
.getInputValue(selectors.itemBasicData.originSelect)
.then(result => {
it(`should confirm the item origin was edited`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBasicData.originSelect);
expect(result).toEqual('Spain');
done();
}).catch(done.fail);
});
it(`should confirm the item expence was edited`, done => {
return nightmare
.getInputValue(selectors.itemBasicData.expenceSelect)
.then(result => {
it(`should confirm the item expence was edited`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBasicData.expenceSelect);
expect(result).toEqual('Adquisición mercancia Extracomunitaria');
done();
}).catch(done.fail);
});
it(`should confirm the item long name was edited`, done => {
return nightmare
.getInputValue(selectors.itemBasicData.longNameInput)
.then(result => {
it(`should confirm the item long name was edited`, async () => {
const result = await nightmare
.getInputValue(selectors.itemBasicData.longNameInput);
expect(result).toEqual('RS Rose of Purity');
done();
}).catch(done.fail);
});
it('should confirm isActive checkbox is unchecked', done => {
return nightmare
.evaluate(selector => {
it('should confirm isActive checkbox is unchecked', async () => {
const result = await nightmare
.evaluate((selector) => {
return document.querySelector(selector).checked;
}, selectors.itemBasicData.isActiveCheckbox)
.then(value => {
expect(value).toBeFalsy();
done();
}).catch(done.fail);
}, selectors.itemBasicData.isActiveCheckbox);
expect(result).toBeFalsy();
});
});
});

View File

@ -10,45 +10,39 @@ describe('Item', () => {
.waitForLogin('buyer');
});
it('should access to the items index by clicking the items button', done => {
return nightmare
it('should access to the items index by clicking the items button', async () => {
const url = await nightmare
.click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton)
.parsedUrl()
.then(url => {
.parsedUrl();
expect(url.hash).toEqual('#!/item/index');
done();
}).catch(done.fail);
});
it('should search for the item Gem of Time', done => {
return nightmare
it('should search for the item Gem of Time', async () => {
const resultCount = await nightmare
.wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
done();
}).catch(done.fail);
.countElement(selectors.itemsIndex.searchResult);
expect(resultCount).toEqual(1);
});
it(`should click on the search result to access to the item tax`, done => {
return nightmare
it(`should click on the search result to access to the item tax`, async () => {
const url = await nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTax.taxButton)
.waitForURL('tax')
.url()
.then(url => {
.url();
expect(url).toContain('tax');
done();
}).catch(done.fail);
});
it(`should add the item tax to all countries`, done => {
return nightmare
it(`should add the item tax to all countries`, async () => {
const result = await nightmare
.waitToClick(selectors.itemTax.firstClassSelect)
.waitToClick(selectors.itemTax.firstClassSelectOptionTwo)
.waitToClick(selectors.itemTax.secondClassSelect)
@ -56,35 +50,35 @@ describe('Item', () => {
.waitToClick(selectors.itemTax.thirdClassSelect)
.waitToClick(selectors.itemTax.thirdClassSelectOptionTwo)
.click(selectors.itemTax.submitTaxButton)
.waitForLastSnackbar()
.then(result => {
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
done();
}).catch(done.fail);
});
it(`should confirm the item tax class was edited`, done => {
return nightmare
it(`should confirm the first item tax class was edited`, async () => {
const firstVatType = await nightmare
.click(selectors.itemTags.tagsButton)
.wait(selectors.itemTags.firstTagDisabled)
.click(selectors.itemTax.taxButton)
.waitToClick(selectors.itemTax.taxButton)
.waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced')
.getInputValue(selectors.itemTax.firstClassSelect)
.then(result => {
expect(result).toEqual('Reduced VAT');
return nightmare
.getInputValue(selectors.itemTax.firstClassSelect);
expect(firstVatType).toEqual('Reduced VAT');
});
it(`should confirm the second item tax class was edited`, async () => {
const secondVatType = await nightmare
.getInputValue(selectors.itemTax.secondClassSelect);
})
.then(result => {
expect(result).toEqual('General VAT');
return nightmare
expect(secondVatType).toEqual('General VAT');
});
it(`should confirm the third item tax class was edited`, async () => {
const thirdVatType = await nightmare
.getInputValue(selectors.itemTax.thirdClassSelect);
})
.then(result => {
expect(result).toEqual('Reduced VAT');
done();
}).catch(done.fail);
expect(thirdVatType).toEqual('Reduced VAT');
});
});
});