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

50 lines
1.9 KiB
JavaScript
Raw Normal View History

2018-02-26 12:24:47 +00:00
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/nightmare';
2018-02-26 12:24:47 +00:00
2018-11-02 12:36:20 +00:00
describe('Item edit tax path', () => {
const nightmare = createNightmare();
beforeAll(() => {
2018-11-20 13:22:00 +00:00
nightmare
.loginAndModule('buyer', 'item')
2019-01-10 06:26:10 +00:00
.accessToSearchResult('Object1 Gem1 5')
.accessToSection('item.card.tax');
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() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-07 08:33:07 +00:00
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT')
.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT')
.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'Reduced VAT')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemTax.submitTaxButton)
2018-11-02 12:36:20 +00:00
.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the first item tax class was edited`, async() => {
2018-11-02 12:36:20 +00:00
const firstVatType = await nightmare
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemTags.tagsButton)
2018-11-02 12:36:20 +00:00
.wait(selectors.itemTags.firstTagDisabled)
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemTax.taxButton)
2018-11-02 12:36:20 +00:00
.waitToClick(selectors.itemTax.taxButton)
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
2018-11-02 12:36:20 +00:00
expect(firstVatType).toEqual('Reduced VAT');
});
2019-01-07 08:33:07 +00:00
it(`should confirm the second item tax class was edited`, async() => {
2018-11-02 12:36:20 +00:00
const secondVatType = await nightmare
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemTax.secondClassAutocomplete} input`, '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() => {
2018-11-02 12:36:20 +00:00
const thirdVatType = await nightmare
2019-01-07 08:33:07 +00:00
.waitToGetProperty(`${selectors.itemTax.thirdClassAutocomplete} input`, 'value');
2018-11-02 12:36:20 +00:00
expect(thirdVatType).toEqual('Reduced VAT');
2018-02-26 12:24:47 +00:00
});
});