salix/e2e/paths/04-item/03_tax.spec.js

49 lines
1.8 KiB
JavaScript
Raw Permalink Normal View History

2018-02-26 12:24:47 +00:00
import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2018-02-26 12:24:47 +00:00
describe('Item edit tax path', () => {
let browser;
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
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 200cm');
2020-01-09 12:07:16 +00:00
await page.accessToSection('item.card.tax');
});
2018-11-02 12:36:20 +00:00
2020-01-09 12:07:16 +00:00
afterAll(async() => {
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-02-03 14:55:11 +00:00
await page.autocompleteSearch(selectors.itemTax.firstClass, 'General VAT');
await page.autocompleteSearch(selectors.itemTax.secondClass, 'General VAT');
2020-01-09 12:07:16 +00:00
await page.waitToClick(selectors.itemTax.submitTaxButton);
2020-04-08 09:24:40 +00:00
const message = await page.waitForSnackbar();
2018-11-02 12:36:20 +00:00
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
2018-11-02 12:36:20 +00:00
});
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-02-03 14:55:11 +00:00
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value');
2018-11-02 12:36:20 +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-02-03 14:55:11 +00:00
.waitToGetProperty(selectors.itemTax.secondClass, 'value');
2018-11-02 12:36:20 +00:00
expect(secondVatType).toEqual('General VAT');
});
it(`should edit the first class without saving the form`, async() => {
2020-02-03 14:55:11 +00:00
await page.autocompleteSearch(selectors.itemTax.firstClass, 'Reduced VAT');
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value');
expect(firstVatType).toEqual('Reduced VAT');
});
2018-02-26 12:24:47 +00:00
});