2018-02-26 12:24:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-02-26 12:24:47 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
describe('Item edit tax path', () => {
|
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('buyer');
|
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
expect(url.hash).toEqual('#!/item/index');
|
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
expect(resultCount).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
expect(url).toContain('tax');
|
|
|
|
});
|
|
|
|
|
|
|
|
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)
|
|
|
|
.waitToClick(selectors.itemTax.secondClassSelectOptionOne)
|
|
|
|
.waitToClick(selectors.itemTax.thirdClassSelect)
|
|
|
|
.waitToClick(selectors.itemTax.thirdClassSelectOptionTwo)
|
|
|
|
.click(selectors.itemTax.submitTaxButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
expect(firstVatType).toEqual('Reduced VAT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the second item tax class was edited`, async () => {
|
|
|
|
const secondVatType = await nightmare
|
|
|
|
.getInputValue(selectors.itemTax.secondClassSelect);
|
|
|
|
|
|
|
|
expect(secondVatType).toEqual('General VAT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should confirm the third item tax class was edited`, async () => {
|
|
|
|
const thirdVatType = await nightmare
|
|
|
|
.getInputValue(selectors.itemTax.thirdClassSelect);
|
|
|
|
|
|
|
|
expect(thirdVatType).toEqual('Reduced VAT');
|
2018-02-26 12:24:47 +00:00
|
|
|
});
|
|
|
|
});
|