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('Gem of Time') .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') .click(selectors.itemTax.submitTaxButton) .waitForLastSnackbar(); expect(result).toEqual('Data saved!'); }); it(`should confirm the first item tax class was edited`, async() => { const firstVatType = await nightmare .click(selectors.itemTags.tagsButton) .wait(selectors.itemTags.firstTagDisabled) .click(selectors.itemTax.taxButton) .waitToClick(selectors.itemTax.taxButton) .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'); }); });