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 .waitToClick(selectors.itemTax.firstClassSelect) .waitToClick(selectors.itemTax.firstClassSelectOptionTwo) .waitToClick(selectors.itemTax.secondClassSelect) .waitToClick(selectors.itemTax.secondClassSelectOptionOne) .waitToClick(selectors.itemTax.thirdClassSelect) .waitToClick(selectors.itemTax.thirdClassSelectOptionTwo) .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) .waitForTextInInput(selectors.itemTax.firstClassSelect, 'reduced') .waitToGetProperty(selectors.itemTax.firstClassSelect, 'value'); expect(firstVatType).toEqual('Reduced VAT'); }); it(`should confirm the second item tax class was edited`, async () => { const secondVatType = await nightmare .waitToGetProperty(selectors.itemTax.secondClassSelect, 'value'); expect(secondVatType).toEqual('General VAT'); }); it(`should confirm the third item tax class was edited`, async () => { const thirdVatType = await nightmare .waitToGetProperty(selectors.itemTax.thirdClassSelect, 'value'); expect(thirdVatType).toEqual('Reduced VAT'); }); });