salix/e2e/paths/item-module/03_edit_item_tax.spec.js

83 lines
2.9 KiB
JavaScript
Raw Normal View History

2018-02-26 12:24:47 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('add item tax path', () => {
2018-02-26 12:24:47 +00:00
const nightmare = createNightmare();
beforeAll(() => {
return nightmare
.waitForLogin('developer');
});
2018-02-26 12:24:47 +00:00
it('should access to the items index by clicking the items button', () => {
return nightmare
.click(selectors.moduleAccessView.itemsSectionButton)
.wait(selectors.itemsIndex.createItemButton)
.parsedUrl()
.then(url => {
expect(url.hash).toEqual('#!/item/list');
});
});
it('should search for the item Gem of Time', () => {
return nightmare
.wait(selectors.itemsIndex.searchResult)
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
.click(selectors.itemsIndex.searchButton)
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countSearchResults(selectors.itemsIndex.searchResult)
.then(result => {
expect(result).toEqual(1);
});
});
it(`should click on the search result to access to the item tax`, () => {
return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTax.taxButton)
.waitForURL('tax')
.url()
.then(url => {
expect(url).toContain('tax');
});
});
it(`should add the item tax to all countries`, () => {
return nightmare
.waitToClick(selectors.itemTax.firstClassSelect)
.waitToClick(selectors.itemTax.firstClassSelectOptionTwo)
.waitToClick(selectors.itemTax.secondClassSelect)
.waitToClick(selectors.itemTax.secondClassSelectOptionOne)
.waitToClick(selectors.itemTax.thirdClassSelect)
.waitToClick(selectors.itemTax.thirdClassSelectOptionTwo)
.click(selectors.itemTax.submitTaxButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Data saved!');
});
});
2018-02-28 07:16:28 +00:00
it(`should confirm the item tax class was edited`, () => {
2018-02-26 12:24:47 +00:00
return nightmare
.click(selectors.itemTags.tagsButton)
2018-03-16 14:09:04 +00:00
.wait(selectors.itemTags.firstTagDisabled)
2018-02-26 12:24:47 +00:00
.waitToClick(selectors.itemTax.taxButton)
2018-03-05 14:21:14 +00:00
.waitForTextInInput(selectors.itemTax.firstClassSelect, 'general')
2018-02-26 12:24:47 +00:00
.getInputValue(selectors.itemTax.firstClassSelect)
.then(result => {
expect(result).toEqual('General VAT');
return nightmare
.getInputValue(selectors.itemTax.secondClassSelect);
})
.then(result => {
expect(result).toEqual('Reduced VAT');
return nightmare
.getInputValue(selectors.itemTax.thirdClassSelect);
})
.then(result => {
expect(result).toEqual('General VAT');
});
});
});