2018-02-26 12:24:47 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-02-26 12:24:47 +00:00
|
|
|
|
2019-10-08 15:27:27 +00:00
|
|
|
describe('Item edit tax path', () => {
|
2018-11-02 12:36:20 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
2018-11-20 13:22:00 +00:00
|
|
|
nightmare
|
2018-12-02 23:45:34 +00:00
|
|
|
.loginAndModule('buyer', 'item')
|
2019-03-27 07:44:15 +00:00
|
|
|
.accessToSearchResult('Ranged weapon longbow 2m')
|
2018-12-02 23:45:34 +00:00
|
|
|
.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-10-08 15:27:27 +00:00
|
|
|
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'General VAT')
|
2019-01-07 08:33:07 +00:00
|
|
|
.autocompleteSearch(selectors.itemTax.secondClassAutocomplete, 'General VAT')
|
2019-10-08 15:27:27 +00:00
|
|
|
.autocompleteSearch(selectors.itemTax.thirdClassAutocomplete, 'General 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-27 20:09:54 +00:00
|
|
|
.reloadSection('item.card.tax')
|
2019-01-07 08:33:07 +00:00
|
|
|
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-10-08 15:27:27 +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() => {
|
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
|
|
|
|
2019-10-08 15:27:27 +00:00
|
|
|
expect(thirdVatType).toEqual('General VAT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should edit the first class without saving the form`, async() => {
|
|
|
|
const firstVatType = await nightmare
|
|
|
|
.autocompleteSearch(selectors.itemTax.firstClassAutocomplete, 'Reduced VAT')
|
|
|
|
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
|
|
|
|
|
|
|
expect(firstVatType).toEqual('Reduced VAT');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now click the undo changes button and see the changes works`, async() => {
|
|
|
|
const firstVatType = await nightmare
|
|
|
|
.waitToClick(selectors.itemTax.undoChangesButton)
|
|
|
|
.waitToGetProperty(`${selectors.itemTax.firstClassAutocomplete} input`, 'value');
|
|
|
|
|
|
|
|
expect(firstVatType).toEqual('General VAT');
|
2018-02-26 12:24:47 +00:00
|
|
|
});
|
|
|
|
});
|