From bf7fe7dcf04e7968f1811c8b1dcea9efd5122fd6 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 26 Feb 2018 13:24:47 +0100 Subject: [PATCH] e2e path for item tax --- .../item-module/03_edit_item_tax.spec.js | 79 +++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 e2e/paths/item-module/03_edit_item_tax.spec.js diff --git a/e2e/paths/item-module/03_edit_item_tax.spec.js b/e2e/paths/item-module/03_edit_item_tax.spec.js new file mode 100644 index 000000000..08cc8102b --- /dev/null +++ b/e2e/paths/item-module/03_edit_item_tax.spec.js @@ -0,0 +1,79 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/helpers'; + +fdescribe('add item tax path', () => { + const nightmare = createNightmare(); + + it('should access to the items index by clicking the items button', () => { + return nightmare + .click(selectors.moduleAccessView.itemsSectionButton) + .wait(selectors.itemsIndex.createItemButton) + .parsedUrl() + .then(url => { + expect(url.hash).toEqual('#!/item/list'); + }); + }); + + it('should search for the item Gem of Time', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Time') + .click(selectors.itemsIndex.searchButton) + .waitForNumberOfElements(selectors.itemsIndex.searchResult, 1) + .countSearchResults(selectors.itemsIndex.searchResult) + .then(result => { + expect(result).toEqual(1); + }); + }); + + it(`should click on the search result to access to the item tax`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemTax.taxButton) + .waitForURL('tax') + .url() + .then(url => { + expect(url).toContain('tax'); + }); + }); + + it(`should add the item tax to all countries`, () => { + return 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) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); + }); + +// this validation might be not quite finished yet. double check if any other validation needs to be checked with Javi + + it(`should confirm the item name was edited`, () => { + return nightmare + .click(selectors.itemTags.tagsButton) + .wait(selectors.itemTags.tagsButton) + .waitToClick(selectors.itemTax.taxButton) + .wait(200) + .getInputValue(selectors.itemTax.firstClassSelect) + .then(result => { + expect(result).toEqual('General VAT'); + return nightmare + .getInputValue(selectors.itemTax.secondClassSelect); + }) + .then(result => { + expect(result).toEqual('Reduced VAT'); + return nightmare + .getInputValue(selectors.itemTax.thirdClassSelect); + }) + .then(result => { + expect(result).toEqual('General VAT'); + }); + }); +});