refactor test
This commit is contained in:
parent
96c00da809
commit
f1aa5a0d5c
|
@ -9,91 +9,81 @@ describe('Client Edit fiscalData 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 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);
|
||||
});
|
||||
|
||||
// Confirms all addresses have EQtax false for future propagation test step 1
|
||||
it(`should click on the search result to access to the client's addresses`, () => {
|
||||
return nightmare
|
||||
it(`should click on the search result to access to the client's 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');
|
||||
});
|
||||
});
|
||||
|
||||
// Confirms all addresses have EQtax false for future propagation test step 2
|
||||
it(`should click on the 1st edit icon to check EQtax isnt checked`, () => {
|
||||
return nightmare
|
||||
it(`should click on the 1st edit icon to check EQtax isnt checked`, async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.then(value => {
|
||||
expect(value).toBeFalsy();
|
||||
});
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
// Confirms all addresses have EQtax false for future propagation test step 3
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, () => {
|
||||
return nightmare
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax isnt checked`, async () => {
|
||||
const result = await 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();
|
||||
});
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it(`should click on the fiscal data button`, () => {
|
||||
return nightmare
|
||||
it(`should click on the fiscal data button`, async () => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForURL('fiscal-data')
|
||||
.url()
|
||||
.then(url => {
|
||||
.url();
|
||||
|
||||
expect(url).toContain('fiscal-data');
|
||||
});
|
||||
});
|
||||
|
||||
it('should not be able to edit the verified data checkbox', done => {
|
||||
return nightmare
|
||||
it('should not be able to edit the verified data checkbox', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).disabled;
|
||||
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||
.then(value => {
|
||||
expect(value).toBeTruthy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.verifiedDataCheckboxInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -103,46 +93,41 @@ describe('Client Edit fiscalData path', () => {
|
|||
.waitForLogin('administrative');
|
||||
});
|
||||
|
||||
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 Bruce Banner', done => {
|
||||
return nightmare
|
||||
it('should now 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 access to the client fiscal data`, () => {
|
||||
return nightmare
|
||||
it(`should access to the client fiscal data`, async () => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.clientsIndex.searchResult, 'Bruce Banner')
|
||||
.waitToClick(selectors.clientsIndex.searchResult)
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.waitForURL('fiscal-data')
|
||||
.url()
|
||||
.then(url => {
|
||||
.url();
|
||||
|
||||
expect(url).toContain('fiscal-data');
|
||||
});
|
||||
});
|
||||
|
||||
it('should edit the clients fiscal data', done => {
|
||||
return nightmare
|
||||
it('should edit the clients fiscal data', async () => {
|
||||
const result = await nightmare
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.clearInput(selectors.clientFiscalData.socialNameInput)
|
||||
.type(selectors.clientFiscalData.socialNameInput, 'SMASH!')
|
||||
|
@ -168,226 +153,190 @@ describe('Client Edit fiscalData path', () => {
|
|||
.waitToClick(selectors.clientFiscalData.equalizationTaxCheckboxLabel)
|
||||
.waitToClick(selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||
.click(selectors.clientFiscalData.saveButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should propagate the Equalization tax', done => {
|
||||
return nightmare
|
||||
it('should propagate the Equalization tax', async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.acceptPropagationButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Equivalent tax spreaded');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 1
|
||||
it(`should click on the addresses button to access to the client's addresses`, () => {
|
||||
return nightmare
|
||||
it(`should click on the addresses button to access to the client's addresses`, async () => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.url()
|
||||
.then(url => {
|
||||
.url();
|
||||
|
||||
expect(url).toContain('/address/index');
|
||||
});
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 2
|
||||
it(`should click on the 1st edit icon to confirm EQtax is checked`, () => {
|
||||
return nightmare
|
||||
it(`should click on the 1st edit icon to confirm EQtax is checked`, async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.wait(selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.then(value => {
|
||||
expect(value).toBeTruthy();
|
||||
});
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
// confirm all addresses have now EQtax checked step 3
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, () => {
|
||||
return nightmare
|
||||
it(`should go back to addresses then select the second one and confirm the EQtax is checked`, async () => {
|
||||
const result = await 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();
|
||||
});
|
||||
}, selectors.clientAddresses.equalizationTaxCheckboxLabel);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should navigate back to fiscal data to confirm its name have been edited', done => {
|
||||
return nightmare
|
||||
it('should navigate back to fiscal data to confirm its name have been edited', async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.wait(selectors.clientFiscalData.socialNameInput)
|
||||
.getInputValue(selectors.clientFiscalData.socialNameInput)
|
||||
.then(result => {
|
||||
.getInputValue(selectors.clientFiscalData.socialNameInput);
|
||||
|
||||
expect(result).toEqual('SMASH!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should confirm the fiscal id have been edited', done => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.clientFiscalData.fiscalIdInput)
|
||||
.then(result => {
|
||||
it('should confirm the fiscal id have been edited', async () => {
|
||||
const result = await nightmare
|
||||
.getInputValue(selectors.clientFiscalData.fiscalIdInput);
|
||||
|
||||
expect(result).toEqual('94980061C');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should confirm the address have been edited', done => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.clientFiscalData.addressInput)
|
||||
.then(result => {
|
||||
it('should confirm the address have been edited', async () => {
|
||||
const result = await nightmare
|
||||
.getInputValue(selectors.clientFiscalData.addressInput);
|
||||
|
||||
expect(result).toEqual('Somewhere edited');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should confirm the postcode have been edited', done => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.clientFiscalData.postcodeInput)
|
||||
.then(result => {
|
||||
it('should confirm the postcode have been edited', async () => {
|
||||
const result = await nightmare
|
||||
.getInputValue(selectors.clientFiscalData.postcodeInput);
|
||||
|
||||
expect(result).toEqual('12345');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it('should confirm the city have been edited', done => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.clientFiscalData.cityInput)
|
||||
.then(result => {
|
||||
it('should confirm the city have been edited', async () => {
|
||||
const result = await nightmare
|
||||
.getInputValue(selectors.clientFiscalData.cityInput);
|
||||
|
||||
expect(result).toEqual('N/A');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should confirm the country have been selected`, () => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.clientFiscalData.countryInput)
|
||||
.then(result => {
|
||||
it(`should confirm the country have been selected`, async () => {
|
||||
const result = await nightmare
|
||||
.getInputValue(selectors.clientFiscalData.countryInput);
|
||||
|
||||
expect(result).toEqual('Francia');
|
||||
});
|
||||
});
|
||||
|
||||
it(`should confirm the province have been selected`, () => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.clientFiscalData.provinceInput)
|
||||
.then(result => {
|
||||
it(`should confirm the province have been selected`, async () => {
|
||||
const result = await nightmare
|
||||
.getInputValue(selectors.clientFiscalData.provinceInput);
|
||||
|
||||
expect(result).toEqual('Province two');
|
||||
});
|
||||
});
|
||||
|
||||
it('should confirm active checkbox is unchecked', done => {
|
||||
return nightmare
|
||||
it('should confirm active checkbox is unchecked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.activeCheckboxLabel)
|
||||
.then(value => {
|
||||
expect(value).toBeFalsy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.activeCheckboxLabel);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should confirm frozen checkbox is unchecked', done => {
|
||||
return nightmare
|
||||
it('should confirm frozen checkbox is unchecked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.frozenCheckboxLabel)
|
||||
.then(value => {
|
||||
expect(value).toBeFalsy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.frozenCheckboxLabel);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should confirm Has to invoice checkbox is unchecked', done => {
|
||||
return nightmare
|
||||
it('should confirm Has to invoice checkbox is unchecked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.hasToInvoiceCheckboxLabel)
|
||||
.then(value => {
|
||||
expect(value).toBeFalsy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.hasToInvoiceCheckboxLabel);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should confirm Vies checkbox is checked', done => {
|
||||
return nightmare
|
||||
it('should confirm Vies checkbox is checked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.viesCheckboxInput)
|
||||
.then(value => {
|
||||
expect(value).toBeTruthy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.viesCheckboxInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should confirm Invoice by mail checkbox is unchecked', done => {
|
||||
return nightmare
|
||||
it('should confirm Invoice by mail checkbox is unchecked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.invoiceByMailCheckboxLabel)
|
||||
.then(value => {
|
||||
expect(value).toBeFalsy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.invoiceByMailCheckboxLabel);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should confirm invoice by address checkbox is unchecked', done => {
|
||||
return nightmare
|
||||
it('should confirm invoice by address checkbox is unchecked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
|
||||
.then(value => {
|
||||
expect(value).toBeFalsy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput);
|
||||
|
||||
expect(result).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should confirm Equalization tax checkbox is checked', done => {
|
||||
return nightmare
|
||||
it('should confirm Equalization tax checkbox is checked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel)
|
||||
.then(value => {
|
||||
expect(value).toBeTruthy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.equalizationTaxCheckboxLabel);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should confirm Verified data checkbox is checked', done => {
|
||||
return nightmare
|
||||
it('should confirm Verified data checkbox is checked', async () => {
|
||||
const result = await nightmare
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.verifiedDataCheckboxInput)
|
||||
.then(value => {
|
||||
expect(value).toBeTruthy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.verifiedDataCheckboxInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 1
|
||||
it(`should click on the addresses button to access to the client's addresses`, () => {
|
||||
return nightmare
|
||||
it(`should click on the addresses button to access to the client's addresses`, async () => {
|
||||
const url = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.addressesButton)
|
||||
.waitForURL('/address/index')
|
||||
.url()
|
||||
.then(url => {
|
||||
.url();
|
||||
|
||||
expect(url).toContain('/address/index');
|
||||
});
|
||||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 2
|
||||
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, () => {
|
||||
return nightmare
|
||||
it(`should click on the 1st edit icon to access the address details and uncheck EQtax checkbox`, async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientAddresses.firstEditButton)
|
||||
.waitToClick(selectors.clientAddresses.equalizationTaxCheckboxLabel)
|
||||
.click(selectors.clientAddresses.saveButton)
|
||||
|
@ -398,17 +347,15 @@ describe('Client Edit fiscalData path', () => {
|
|||
});
|
||||
|
||||
// confirm invoice by address checkbox gets checked if the EQtax differs between addresses step 3
|
||||
it('should navigate back to fiscal data to confirm invoice by address is now checked', done => {
|
||||
return nightmare
|
||||
it('should navigate back to fiscal data to confirm invoice by address is now checked', async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.clientFiscalData.fiscalDataButton)
|
||||
.wait(selectors.clientFiscalData.invoiceByAddressCheckboxInput)
|
||||
.evaluate(selector => {
|
||||
return document.querySelector(selector).checked;
|
||||
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput)
|
||||
.then(value => {
|
||||
expect(value).toBeTruthy();
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
}, selectors.clientFiscalData.invoiceByAddressCheckboxInput);
|
||||
|
||||
expect(result).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Item', () => {
|
||||
describe('Summary path', () => {
|
||||
describe('Item summary path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
|
@ -34,7 +33,7 @@ describe('Item', () => {
|
|||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
||||
.isVisible(selectors.itemSummary.basicData)
|
||||
.then((result) => {
|
||||
.then(result => {
|
||||
expect(result).toBeFalsy();
|
||||
return nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
||||
|
@ -108,7 +107,7 @@ describe('Item', () => {
|
|||
const result = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
|
||||
.isVisible(selectors.itemSummary.basicData)
|
||||
.then((result) => {
|
||||
.then(result => {
|
||||
expect(result).toBeFalsy();
|
||||
return nightmare
|
||||
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
||||
|
@ -211,4 +210,3 @@ describe('Item', () => {
|
|||
expect(result).toContain('4');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Item', () => {
|
||||
describe('Edit tax path', () => {
|
||||
describe('Item edit tax path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
|
@ -81,4 +80,3 @@ describe('Item', () => {
|
|||
expect(thirdVatType).toEqual('Reduced VAT');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Item', () => {
|
||||
describe('Create tags path', () => {
|
||||
describe('Item create tags path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
|
@ -10,45 +9,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 tags`, done => {
|
||||
return nightmare
|
||||
it(`should click on the search result to access to the item tags`, async () => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitToClick(selectors.itemTags.tagsButton)
|
||||
.waitForURL('tags')
|
||||
.url()
|
||||
.then(url => {
|
||||
.url();
|
||||
|
||||
expect(url).toContain('tags');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should create a new tag and delete a former one`, done => {
|
||||
return nightmare
|
||||
it(`should create a new tag and delete a former one`, async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemTags.firstRemoveTagButton)
|
||||
.waitToClick(selectors.itemTags.addItemTagButton)
|
||||
.waitToClick(selectors.itemTags.seventhTagSelect)
|
||||
|
@ -57,29 +50,26 @@ describe('Item', () => {
|
|||
.clearInput(selectors.itemTags.seventhRelevancyInput)
|
||||
.type(selectors.itemTags.seventhRelevancyInput, '1')
|
||||
.click(selectors.itemTags.submitItemTagsButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
.waitForLastSnackbar();
|
||||
|
||||
it(`should reload tags form to check that the changes are saved`, () => {
|
||||
return nightmare
|
||||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemTags.tagsButton)
|
||||
.wait('vn-item-tags');
|
||||
expect(result).toEqual('Data saved!');
|
||||
});
|
||||
|
||||
it(`should confirm the first row data is the expected one`, async () => {
|
||||
let tag = await nightmare.getProperty(selectors.itemTags.firstTagSelect, 'value');
|
||||
let value = await nightmare.getProperty(selectors.itemTags.firstValueInput, 'value');
|
||||
let relevancy = await nightmare.getProperty(selectors.itemTags.firstRelevancyInput, 'value');
|
||||
let result = await nightmare
|
||||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemTags.tagsButton)
|
||||
.wait('vn-item-tags')
|
||||
.getProperty(selectors.itemTags.firstTagSelect, 'value');
|
||||
|
||||
expect(tag).toEqual('Ancho de la base');
|
||||
expect(value).toEqual('50');
|
||||
expect(relevancy).toEqual('1');
|
||||
expect(result).toEqual('Ancho de la base');
|
||||
result = await nightmare.getProperty(selectors.itemTags.firstValueInput, 'value');
|
||||
|
||||
expect(result).toEqual('50');
|
||||
result = await nightmare.getProperty(selectors.itemTags.firstRelevancyInput, 'value');
|
||||
|
||||
expect(result).toEqual('1');
|
||||
});
|
||||
|
||||
it(`should confirm the second row data is the expected one`, async () => {
|
||||
|
@ -92,7 +82,7 @@ describe('Item', () => {
|
|||
expect(relevancy).toEqual('2');
|
||||
});
|
||||
|
||||
it(`should confirm the second row data is the expected one`, async() => {
|
||||
it(`should confirm the third row data is the expected one`, async () => {
|
||||
let tag = await nightmare.getProperty(selectors.itemTags.thirdTagSelect, 'value');
|
||||
let value = await nightmare.getProperty(selectors.itemTags.thirdValueInput, 'value');
|
||||
let relevancy = await nightmare.getProperty(selectors.itemTags.thirdRelevancyInput, 'value');
|
||||
|
@ -122,4 +112,3 @@ describe('Item', () => {
|
|||
expect(relevancy).toEqual('5');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import selectors from '../../helpers/selectors.js';
|
||||
import createNightmare from '../../helpers/nightmare';
|
||||
|
||||
describe('Item', () => {
|
||||
describe('Create niche path', () => {
|
||||
describe('Item create niche path', () => {
|
||||
const nightmare = createNightmare();
|
||||
|
||||
beforeAll(() => {
|
||||
|
@ -10,102 +9,85 @@ 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 niches`, done => {
|
||||
return nightmare
|
||||
it(`should click on the search result to access to the item niches`, async () => {
|
||||
const url = await nightmare
|
||||
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
||||
.waitToClick(selectors.itemsIndex.searchResult)
|
||||
.waitToClick(selectors.itemNiches.nicheButton)
|
||||
.waitForURL('niche')
|
||||
.url()
|
||||
.then(url => {
|
||||
.url();
|
||||
|
||||
expect(url).toContain('niche');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should click create a new niche and delete a former one`, done => {
|
||||
return nightmare
|
||||
it(`should click create a new niche and delete a former one`, async () => {
|
||||
const result = await nightmare
|
||||
.waitToClick(selectors.itemNiches.addNicheButton)
|
||||
.waitToClick(selectors.itemNiches.secondNicheRemoveButton)
|
||||
.waitToClick(selectors.itemNiches.thirdWarehouseSelect)
|
||||
.waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption)
|
||||
.type(selectors.itemNiches.thirdCodeInput, 'A4')
|
||||
.click(selectors.itemNiches.submitNichesButton)
|
||||
.waitForLastSnackbar()
|
||||
.then(result => {
|
||||
.waitForLastSnackbar();
|
||||
|
||||
expect(result).toEqual('Data saved!');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should confirm the first niche is the expected one`, done => {
|
||||
return nightmare
|
||||
it(`should confirm the first niche is the expected one`, async () => {
|
||||
let result = await nightmare
|
||||
.click(selectors.itemBasicData.basicDataButton)
|
||||
.wait(selectors.itemBasicData.nameInput)
|
||||
.click(selectors.itemNiches.nicheButton)
|
||||
.waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse One')
|
||||
.getInputValue(selectors.itemNiches.firstWarehouseSelect)
|
||||
.then(result => {
|
||||
.getInputValue(selectors.itemNiches.firstWarehouseSelect);
|
||||
|
||||
expect(result).toEqual('Warehouse One');
|
||||
return nightmare
|
||||
result = await nightmare
|
||||
.getInputValue(selectors.itemNiches.firstCodeInput);
|
||||
})
|
||||
.then(result => {
|
||||
|
||||
expect(result).toEqual('A1');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should confirm the second niche is the expected one`, done => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.itemNiches.secondWarehouseSelect)
|
||||
.then(result => {
|
||||
it(`should confirm the second niche is the expected one`, async () => {
|
||||
let result = await nightmare
|
||||
.getInputValue(selectors.itemNiches.secondWarehouseSelect);
|
||||
|
||||
expect(result).toEqual('Warehouse Three');
|
||||
return nightmare
|
||||
result = await nightmare
|
||||
.getInputValue(selectors.itemNiches.secondCodeInput);
|
||||
})
|
||||
.then(result => {
|
||||
|
||||
|
||||
expect(result).toEqual('A3');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
|
||||
it(`should confirm the third niche is the expected one`, done => {
|
||||
return nightmare
|
||||
.getInputValue(selectors.itemNiches.thirdWarehouseSelect)
|
||||
.then(result => {
|
||||
it(`should confirm the third niche is the expected one`, async () => {
|
||||
let result = await nightmare
|
||||
.getInputValue(selectors.itemNiches.thirdWarehouseSelect);
|
||||
|
||||
expect(result).toEqual('Warehouse Two');
|
||||
return nightmare
|
||||
result = await nightmare
|
||||
.getInputValue(selectors.itemNiches.thirdCodeInput);
|
||||
})
|
||||
.then(result => {
|
||||
|
||||
expect(result).toEqual('A4');
|
||||
done();
|
||||
}).catch(done.fail);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue