64 lines
2.5 KiB
JavaScript
64 lines
2.5 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.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();
|
|
|
|
expect(result).toEqual('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.firstClassAutocomplete, 'value');
|
|
|
|
expect(firstVatType).toEqual('General VAT');
|
|
});
|
|
|
|
it(`should confirm the second item tax class was edited`, async() => {
|
|
const secondVatType = await page
|
|
.waitToGetProperty(selectors.itemTax.secondClassAutocomplete, 'value');
|
|
|
|
expect(secondVatType).toEqual('General VAT');
|
|
});
|
|
|
|
it(`should confirm the third item tax class was edited`, async() => {
|
|
const thirdVatType = await page
|
|
.waitToGetProperty(selectors.itemTax.thirdClassAutocomplete, 'value');
|
|
|
|
expect(thirdVatType).toEqual('General VAT');
|
|
});
|
|
|
|
it(`should edit the first class without saving the form`, async() => {
|
|
await page.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT');
|
|
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value');
|
|
|
|
expect(firstVatType).toEqual('Reduced VAT');
|
|
});
|
|
|
|
it(`should now click the undo changes button and see the changes works`, async() => {
|
|
await page.waitToClick(selectors.itemTax.undoChangesButton);
|
|
const firstVatType = await page.waitToGetProperty(selectors.itemTax.firstClassAutocomplete, 'value');
|
|
|
|
expect(firstVatType).toEqual('General VAT');
|
|
});
|
|
});
|