57 lines
2.1 KiB
JavaScript
57 lines
2.1 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Item edit tax path', () => {
|
|
let browser;
|
|
let page;
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('buyer', 'item');
|
|
await page.accessToSearchResult('Ranged weapon longbow 2m');
|
|
await page.accessToSection('item.card.tax');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
await browser.close();
|
|
});
|
|
|
|
it(`should add the item tax to all countries`, async() => {
|
|
await page.autocompleteSearch(selectors.itemTax.firstClass, 'General VAT');
|
|
await page.autocompleteSearch(selectors.itemTax.secondClass, 'General VAT');
|
|
await page.autocompleteSearch(selectors.itemTax.thirdClass, 'General VAT');
|
|
await page.waitToClick(selectors.itemTax.submitTaxButton);
|
|
const message = await page.waitForSnackbar();
|
|
|
|
expect(message.text).toContain('Data saved!');
|
|
});
|
|
|
|
it(`should confirm the first item tax class was edited`, async() => {
|
|
await page.reloadSection('item.card.tax');
|
|
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value');
|
|
|
|
expect(firstVatType).toEqual('General VAT');
|
|
});
|
|
|
|
it(`should confirm the second item tax class was edited`, async() => {
|
|
const secondVatType = await page
|
|
.waitToGetProperty(selectors.itemTax.secondClass, 'value');
|
|
|
|
expect(secondVatType).toEqual('General VAT');
|
|
});
|
|
|
|
it(`should confirm the third item tax class was edited`, async() => {
|
|
const thirdVatType = await page
|
|
.waitToGetProperty(selectors.itemTax.thirdClass, 'value');
|
|
|
|
expect(thirdVatType).toEqual('General VAT');
|
|
});
|
|
|
|
it(`should edit the first class without saving the form`, async() => {
|
|
await page.autocompleteSearch(selectors.itemTax.firstClass, 'Reduced VAT');
|
|
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClass, 'value');
|
|
|
|
expect(firstVatType).toEqual('Reduced VAT');
|
|
});
|
|
});
|