From bf7fe7dcf04e7968f1811c8b1dcea9efd5122fd6 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 26 Feb 2018 13:24:47 +0100 Subject: [PATCH 1/3] 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'); + }); + }); +}); From 30ca3412691ff00eec1758da0bced0d9f91a3a64 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 26 Feb 2018 13:27:18 +0100 Subject: [PATCH 2/3] removed focus and comments from spec file --- e2e/paths/item-module/03_edit_item_tax.spec.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/e2e/paths/item-module/03_edit_item_tax.spec.js b/e2e/paths/item-module/03_edit_item_tax.spec.js index 08cc8102b..6b1dc9fc8 100644 --- a/e2e/paths/item-module/03_edit_item_tax.spec.js +++ b/e2e/paths/item-module/03_edit_item_tax.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import createNightmare from '../../helpers/helpers'; -fdescribe('add item tax path', () => { +describe('add item tax path', () => { const nightmare = createNightmare(); it('should access to the items index by clicking the items button', () => { @@ -53,8 +53,6 @@ fdescribe('add item tax path', () => { }); }); -// 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) From bb5440fb45812b91e2cea2e4b740da44863caa9f Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Mon, 26 Feb 2018 13:43:07 +0100 Subject: [PATCH 3/3] updated item niche selectors to fix niches path --- e2e/helpers/selectors.js | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index d6876bf5b..5ba01db0e 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -97,6 +97,16 @@ export default { secondEditButton: `vn-horizontal:nth-child(3) > vn-one > vn-horizontal > a > ${components.vnIconButton}[icon='edit']`, activeCheckbox: `${components.vnCheck}[label='Enabled'] > label > input`, equalizationTaxCheckboxLabel: `${components.vnCheck}[label='Is equalizated'] > label > input`, + addAddressNoteButton: `${components.vnIcon}[icon="add_circle"]`, + firstObservationTypeSelect: `${components.vnAutocomplete}[field="observation.observationTypeFk"]:nth-child(1) > vn-vertical > ${components.vnTextfield}`, + firstObservationTypeSelectOptionOne: `${components.vnAutocomplete}[field="observation.observationTypeFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`, + firstObservationDescriptionInput: `vn-horizontal:nth-child(3) > vn-textfield[label="Description"] > div > input`, + secondObservationTypeSelect: `${components.vnAutocomplete}[field="observation.observationTypeFk"]:nth-child(2) > vn-vertical > ${components.vnTextfield}`, + secondObservationTypeSelectOptionTwo: `${components.vnAutocomplete}[field="observation.observationTypeFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + secondObservationDescriptionInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Description"] > div > input`, + thirdObservationTypeSelect: `${components.vnAutocomplete}[field="observation.observationTypeFk"]:nth-child(3) > vn-vertical > ${components.vnTextfield}`, + thirdObservationTypeSelectOptionThree: `${components.vnAutocomplete}[field="observation.observationTypeFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(3)`, + thirdObservationDescriptionInput: `vn-horizontal:nth-child(5) > vn-textfield[label="Description"] > div > input`, saveButton: `${components.vnSubmit}` }, clientWebAccess: { @@ -157,6 +167,16 @@ export default { expenceSelectOptionTwo: `${components.vnAutocomplete}[field="$ctrl.item.expenceFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, submitBasicDataButton: `${components.vnSubmit}` }, + itemTax: { + taxButton: `${components.vnMenuItem}[ui-sref="item.card.tax"]`, + firstClassSelect: `vn-horizontal:nth-child(2) > ${components.vnAutocomplete}[field="tax.taxClassFk"] > vn-vertical > ${components.vnTextfield}`, + firstClassSelectOptionTwo: `vn-horizontal:nth-child(2) > ${components.vnAutocomplete} > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + secondClassSelect: `vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="tax.taxClassFk"] > vn-vertical > ${components.vnTextfield}`, + secondClassSelectOptionOne: `vn-horizontal:nth-child(3) > ${components.vnAutocomplete} > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`, + thirdClassSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="tax.taxClassFk"] > vn-vertical > ${components.vnTextfield}`, + thirdClassSelectOptionTwo: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete} > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + submitTaxButton: `${components.vnSubmit}` + }, itemBarcodes: { barcodeButton: `${components.vnMenuItem}[ui-sref="item.card.itemBarcode"]`, addBarcodeButton: `${components.vnIcon}[icon="add_circle"]`, @@ -167,10 +187,10 @@ export default { itemNiches: { nicheButton: `${components.vnMenuItem}[ui-sref="item.card.niche"]`, addNicheButton: `${components.vnIcon}[icon="add_circle"]`, - firstWarehouseSelect: `${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`, - firstWarehouseSelectSecondOption: `${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, - thirdWarehouseSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`, - thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="niche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(4)`, + firstWarehouseSelect: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`, + firstWarehouseSelectSecondOption: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + thirdWarehouseSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > ${components.vnTextfield}`, + thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(4)`, secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`, firstCodeInput: `vn-horizontal:nth-child(2) > ${components.vnTextfield}`, thirdCodeInput: `vn-horizontal:nth-child(4) > ${components.vnTextfield}`,