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

47 lines
1.7 KiB
JavaScript

import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
describe('Item edit tax path', () => {
const nightmare = createNightmare();
beforeAll(() => {
nightmare
.loginAndModule('buyer', 'item')
.accessToSearchResult('Object1 Gem1 5')
.accessToSection('item.card.tax');
});
it(`should add the item tax to all countries`, async() => {
const result = await nightmare
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT')
.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT')
.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'Reduced VAT')
.waitToClick(selectors.itemTax.submitTaxButton)
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
it(`should confirm the first item tax class was edited`, async() => {
const firstVatType = await nightmare
.reloadSection('item.card.tax')
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
expect(firstVatType).toEqual('Reduced VAT');
});
it(`should confirm the second item tax class was edited`, async() => {
const secondVatType = await nightmare
.waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, 'value');
expect(secondVatType).toEqual('General VAT');
});
it(`should confirm the third item tax class was edited`, async() => {
const thirdVatType = await nightmare
.waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value');
expect(thirdVatType).toEqual('Reduced VAT');
});
});