2018-02-26 12:24:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-02-26 12:24:47 +00:00
|
|
|
|
2019-10-08 15:27:27 +00:00
|
|
|
describe('Item edit tax path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.loginAndModule('buyer', 'item');
|
|
|
|
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
|
|
|
await page.accessToSection('item.card.tax');
|
|
|
|
});
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should add the item tax to all countries`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT');
|
|
|
|
await page.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT');
|
|
|
|
await page.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General VAT');
|
|
|
|
await page.waitToClick(selectors.itemTax.submitTaxButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the first item tax class was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.reloadSection('item.card.tax');
|
2020-01-29 13:54:07 +00:00
|
|
|
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-10-08 15:27:27 +00:00
|
|
|
expect(firstVatType).toEqual('General VAT');
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the second item tax class was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const secondVatType = await page
|
2020-01-29 13:54:07 +00:00
|
|
|
.waitToGetProperty(selectors.itemTax.secondClassAutocomplete, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(secondVatType).toEqual('General VAT');
|
|
|
|
});
|
|
|
|
|
2019-01-07 08:33:07 +00:00
|
|
|
it(`should confirm the third item tax class was edited`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const thirdVatType = await page
|
2020-01-29 13:54:07 +00:00
|
|
|
.waitToGetProperty(selectors.itemTax.thirdClassAutocomplete, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-10-08 15:27:27 +00:00
|
|
|
expect(thirdVatType).toEqual('General VAT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should edit the first class without saving the form`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT');
|
2020-01-29 13:54:07 +00:00
|
|
|
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value');
|
2019-10-08 15:27:27 +00:00
|
|
|
|
|
|
|
expect(firstVatType).toEqual('Reduced VAT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now click the undo changes button and see the changes works`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemTax.undoChangesButton);
|
2020-01-29 13:54:07 +00:00
|
|
|
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value');
|
2019-10-08 15:27:27 +00:00
|
|
|
|
|
|
|
expect(firstVatType).toEqual('General VAT');
|
2018-02-26 12:24:47 +00:00
|
|
|
});
|
|
|
|
});
|