From 31df9ec0e265dcc54810c858e13636678e7e3942 Mon Sep 17 00:00:00 2001 From: Carlos Jimenez <=> Date: Fri, 16 Mar 2018 15:09:04 +0100 Subject: [PATCH] fixed all e2e paths --- client/item/src/niche/item-niche.spec.js | 2 +- e2e/helpers/selectors.js | 20 ++++++--- .../02_edit_item_basic_data.spec.js | 5 ++- .../item-module/03_edit_item_tax.spec.js | 2 +- .../item-module/04_create_item_tags.spec.js | 44 ++++++++----------- .../item-module/05_create_item_niche.spec.js | 18 +++----- 6 files changed, 44 insertions(+), 47 deletions(-) diff --git a/client/item/src/niche/item-niche.spec.js b/client/item/src/niche/item-niche.spec.js index 3218f262e4..e223133d93 100644 --- a/client/item/src/niche/item-niche.spec.js +++ b/client/item/src/niche/item-niche.spec.js @@ -92,7 +92,7 @@ describe('Item', () => { }); describe('submit()', () => { - it("should return an error message 'The niche must be unique' when the niche code isnt unique", () => { + it("should return an error message 'The niche must be unique' when the niche warehouse isnt unique", () => { controller.$scope.form = {}; spyOn(controller.vnApp, 'showMessage').and.callThrough(); controller.niches = [ diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index ab30e2db70..497b8de649 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -188,24 +188,29 @@ export default { itemTags: { goToItemIndexButton: 'vn-item-descriptor [ui-sref="item.index"]', tagsButton: `${components.vnMenuItem}[ui-sref="item.card.tags"]`, + firstRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(2) > ${components.vnIcon}[icon="remove_circle_outline"]`, firstTagSelect: `vn-item-tags vn-horizontal:nth-child(2) > ${components.vnAutocomplete}[field="itemTag.tagFk"] input`, + firstTagDisabled: `vn-item-tags vn-horizontal:nth-child(2) > vn-textfield[label="Tag"] > div > input`, firstTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(2) > ${components.vnAutocomplete}[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`, firstValueInput: `vn-item-tags vn-horizontal:nth-child(2) > vn-textfield[label="Value"] > div > input`, firstRelevancyInput: `vn-horizontal:nth-child(2) > vn-textfield[label="Relevancy"] > div > input`, secondTagSelect: `vn-item-tags vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="itemTag.tagFk"] input`, + secondTagDisabled: `vn-item-tags vn-horizontal:nth-child(3) > vn-textfield[label="Tag"] > div > input`, secondTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`, secondValueInput: `vn-item-tags vn-horizontal:nth-child(3) > vn-textfield[label="Value"] > div > input`, secondRelevancyInput: `vn-horizontal:nth-child(3) > vn-textfield[label="Relevancy"] > div > input`, thirdTagSelect: `vn-item-tags vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemTag.tagFk"] input`, + thirdTagDisabled: `vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Tag"] > div > input`, thirdTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`, thirdValueInput: `vn-item-tags vn-horizontal:nth-child(4) > vn-textfield[label="Value"] > div > input`, thirdRelevancyInput: `vn-horizontal:nth-child(4) > vn-textfield[label="Relevancy"] > div > input`, fourthTagSelect: `vn-item-tags vn-horizontal:nth-child(5) > ${components.vnAutocomplete}[field="itemTag.tagFk"] input`, + fourthTagDisabled: `vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Tag"] > div > input`, fourthTagSelectOptionOne: `vn-item-tags vn-horizontal:nth-child(5) > ${components.vnAutocomplete}[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(1)`, fourthValueInput: `vn-item-tags vn-horizontal:nth-child(5) > vn-textfield[label="Value"] > div > input`, fourthRelevancyInput: `vn-horizontal:nth-child(5) > vn-textfield[label="Relevancy"] > div > input`, - fifthRemoveTagButton: `vn-item-tags vn-horizontal:nth-child(6) > ${components.vnIcon}[icon="remove_circle_outline"]`, fifthTagSelect: `vn-item-tags vn-horizontal:nth-child(6) > ${components.vnAutocomplete}[field="itemTag.tagFk"] input`, + fifthTagDisabled: `vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Tag"] > div > input`, fifthTagSelectOptionFive: `vn-item-tags vn-horizontal:nth-child(6) > ${components.vnAutocomplete}[field="itemTag.tagFk"] vn-drop-down ul > li:nth-child(5)`, fifthValueInput: `vn-item-tags vn-horizontal:nth-child(6) > vn-textfield[label="Value"] > div > input`, fifthRelevancyInput: `vn-horizontal:nth-child(6) > vn-textfield[label="Relevancy"] > div > input`, @@ -233,14 +238,17 @@ export default { nicheButton: `${components.vnMenuItem}[ui-sref="item.card.niche"]`, addNicheButton: `${components.vnIcon}[icon="add_circle"]`, firstWarehouseSelect: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] input`, + firstWarehouseDisabled: `vn-horizontal:nth-child(2) > vn-textfield[label="Warehouse"] > div > input`, firstWarehouseSelectSecondOption: `${components.vnAutocomplete}[field="itemNiche.warehouseFk"] vn-drop-down ul > li:nth-child(2)`, + firstCodeInput: `vn-horizontal:nth-child(2) > vn-textfield[label="code"] > div > input`, secondWarehouseSelect: `vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] input`, - thirdWarehouseSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] input`, - thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] vn-drop-down ul > li:nth-child(4)`, + secondWarehouseDisabled: `vn-horizontal:nth-child(3) > vn-textfield[label="Warehouse"] > div > input`, + secondCodeInput: `vn-horizontal:nth-child(3) > vn-textfield[label="code"] > div > input`, secondNicheRemoveButton: `vn-horizontal:nth-child(3) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`, - firstCodeInput: `vn-horizontal:nth-child(2) > ${components.vnTextfield}`, - secondCodeInput: `vn-horizontal:nth-child(3) > ${components.vnTextfield}`, - thirdCodeInput: `vn-horizontal:nth-child(4) > ${components.vnTextfield}`, + thirdWarehouseSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] input`, + thirdWarehouseDisabled: `vn-horizontal:nth-child(4) > vn-textfield[label="Warehouse"] > div > input`, + thirdWarehouseSelectFourthOption: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemNiche.warehouseFk"] vn-drop-down ul > li:nth-child(4)`, + thirdCodeInput: `vn-horizontal:nth-child(4) > vn-textfield[label="code"] > div > input`, submitNichesButton: `${components.vnSubmit}` }, itemBotanical: { diff --git a/e2e/paths/item-module/02_edit_item_basic_data.spec.js b/e2e/paths/item-module/02_edit_item_basic_data.spec.js index c2de03c068..36b7fb81e8 100644 --- a/e2e/paths/item-module/02_edit_item_basic_data.spec.js +++ b/e2e/paths/item-module/02_edit_item_basic_data.spec.js @@ -66,9 +66,10 @@ describe('edit item basic data path', () => { it(`should confirm the item name was edited`, () => { return nightmare - .click(selectors.itemNiches.firstCodeInput) - .wait(selectors.itemNiches.firstCodeInput) + .click(selectors.itemNiches.nicheButton) + .wait(selectors.itemNiches.firstWarehouseDisabled) .waitToClick(selectors.itemBasicData.basicDataButton) + .waitForTextInInput(selectors.itemBasicData.nameInput, 'Rose of Purity') .getInputValue(selectors.itemBasicData.nameInput) .then(result => { expect(result).toEqual('Rose of Purity'); 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 07bb754141..4347d17521 100644 --- a/e2e/paths/item-module/03_edit_item_tax.spec.js +++ b/e2e/paths/item-module/03_edit_item_tax.spec.js @@ -61,7 +61,7 @@ describe('add item tax path', () => { it(`should confirm the item tax class was edited`, () => { return nightmare .click(selectors.itemTags.tagsButton) - .wait(selectors.itemTags.firstTagSelect) + .wait(selectors.itemTags.firstTagDisabled) .waitToClick(selectors.itemTax.taxButton) .waitForTextInInput(selectors.itemTax.firstClassSelect, 'general') .getInputValue(selectors.itemTax.firstClassSelect) diff --git a/e2e/paths/item-module/04_create_item_tags.spec.js b/e2e/paths/item-module/04_create_item_tags.spec.js index 19d9ef26ab..e83725bfaa 100644 --- a/e2e/paths/item-module/04_create_item_tags.spec.js +++ b/e2e/paths/item-module/04_create_item_tags.spec.js @@ -43,22 +43,14 @@ describe('create item tags path', () => { }); }); - it(`should create a new tag, edit another and delete a former one`, () => { + it(`should create a new tag and delete a former one`, () => { return nightmare - .waitToClick(selectors.itemTags.firstTagSelect) - .waitToClick(selectors.itemTags.firstTagSelectOptionOne) - .clearInput(selectors.itemTags.firstValueInput) - .type(selectors.itemTags.firstValueInput, 'Dark Blue') - .clearInput(selectors.itemTags.firstRelevancyInput) - .type(selectors.itemTags.firstRelevancyInput, '2') - .waitToClick(selectors.itemTags.fifthRemoveTagButton) + .waitToClick(selectors.itemTags.firstRemoveTagButton) .waitToClick(selectors.itemTags.addItemTagButton) .waitToClick(selectors.itemTags.fifthTagSelect) .waitToClick(selectors.itemTags.fifthTagSelectOptionFive) .type(selectors.itemTags.fifthValueInput, 'Thanos') .type(selectors.itemTags.fifthRelevancyInput, '1') - .clearInput(selectors.itemTags.secondRelevancyInput) - .type(selectors.itemTags.secondRelevancyInput, '5') .click(selectors.itemTags.submitItemTagsButton) .waitForSnackbar() .then(result => { @@ -71,8 +63,8 @@ describe('create item tags path', () => { .click(selectors.itemBasicData.basicDataButton) .wait(selectors.itemBasicData.nameInput) .click(selectors.itemTags.tagsButton) - .waitForTextInInput(selectors.itemTags.firstTagSelect, 'Owner') - .getInputValue(selectors.itemTags.firstTagSelect) + .waitForTextInInput(selectors.itemTags.firstTagDisabled, 'Owner') + .getInputValue(selectors.itemTags.firstTagDisabled) .then(result => { expect(result).toEqual('Owner'); }); @@ -98,19 +90,19 @@ describe('create item tags path', () => { it(`should confirm the second select is the expected one`, () => { return nightmare - .waitForTextInInput(selectors.itemTags.secondTagSelect, 'Color') - .getInputValue(selectors.itemTags.secondTagSelect) + .waitForTextInInput(selectors.itemTags.secondTagDisabled, 'Location') + .getInputValue(selectors.itemTags.secondTagDisabled) .then(result => { - expect(result).toEqual('Color'); + expect(result).toEqual('Location'); }); }); it(`should confirm the second value is the expected one`, () => { return nightmare - .waitForTextInInput(selectors.itemTags.secondValueInput, 'Dark Blue') + .waitForTextInInput(selectors.itemTags.secondValueInput, 'Gamoras hideout') .getInputValue(selectors.itemTags.secondValueInput) .then(result => { - expect(result).toEqual('Dark Blue'); + expect(result).toEqual('Gamoras hideout'); }); }); @@ -125,8 +117,8 @@ describe('create item tags path', () => { it(`should confirm the third select is the expected one`, () => { return nightmare - .waitForTextInInput(selectors.itemTags.thirdTagSelect, 'Shape') - .getInputValue(selectors.itemTags.thirdTagSelect) + .waitForTextInInput(selectors.itemTags.thirdTagDisabled, 'Shape') + .getInputValue(selectors.itemTags.thirdTagDisabled) .then(result => { expect(result).toEqual('Shape'); }); @@ -152,8 +144,8 @@ describe('create item tags path', () => { it(`should confirm the fourth select is the expected one`, () => { return nightmare - .waitForTextInInput(selectors.itemTags.fourthTagSelect, 'Power') - .getInputValue(selectors.itemTags.fourthTagSelect) + .waitForTextInInput(selectors.itemTags.fourthTagDisabled, 'Power') + .getInputValue(selectors.itemTags.fourthTagDisabled) .then(result => { expect(result).toEqual('Power'); }); @@ -179,19 +171,19 @@ describe('create item tags path', () => { it(`should confirm the fifth select is the expected one`, () => { return nightmare - .waitForTextInInput(selectors.itemTags.fifthTagSelect, 'Location') - .getInputValue(selectors.itemTags.fifthTagSelect) + .waitForTextInInput(selectors.itemTags.fifthTagDisabled, 'Color') + .getInputValue(selectors.itemTags.fifthTagDisabled) .then(result => { - expect(result).toEqual('Location'); + expect(result).toEqual('Color'); }); }); it(`should confirm the fifth value is the expected one`, () => { return nightmare - .waitForTextInInput(selectors.itemTags.fifthValueInput, 'Gamoras hideout') + .waitForTextInInput(selectors.itemTags.fifthValueInput, 'Yellow') .getInputValue(selectors.itemTags.fifthValueInput) .then(result => { - expect(result).toEqual('Gamoras hideout'); + expect(result).toEqual('Yellow'); }); }); diff --git a/e2e/paths/item-module/05_create_item_niche.spec.js b/e2e/paths/item-module/05_create_item_niche.spec.js index 588dad678d..cdadc7e0f1 100644 --- a/e2e/paths/item-module/05_create_item_niche.spec.js +++ b/e2e/paths/item-module/05_create_item_niche.spec.js @@ -43,13 +43,9 @@ describe('create item niche path', () => { }); }); - it(`should click create a new niche, edit another and delete a former one`, () => { + it(`should click create a new niche and delete a former one`, () => { return nightmare .waitToClick(selectors.itemNiches.addNicheButton) - .waitToClick(selectors.itemNiches.firstWarehouseSelect) - .waitToClick(selectors.itemNiches.firstWarehouseSelectSecondOption) - .clearInput(selectors.itemNiches.firstCodeInput) - .type(selectors.itemNiches.firstCodeInput, 'A2') .waitToClick(selectors.itemNiches.secondNicheRemoveButton) .waitToClick(selectors.itemNiches.thirdWarehouseSelect) .waitToClick(selectors.itemNiches.thirdWarehouseSelectFourthOption) @@ -66,21 +62,21 @@ describe('create item niche path', () => { .click(selectors.itemBasicData.basicDataButton) .wait(selectors.itemBasicData.nameInput) .click(selectors.itemNiches.nicheButton) - .waitForTextInInput(selectors.itemNiches.firstWarehouseSelect, 'Warehouse Two') - .getInputValue(selectors.itemNiches.firstWarehouseSelect) + .waitForTextInInput(selectors.itemNiches.firstWarehouseDisabled, 'Warehouse One') + .getInputValue(selectors.itemNiches.firstWarehouseDisabled) .then(result => { - expect(result).toEqual('Warehouse Two'); + expect(result).toEqual('Warehouse One'); return nightmare .getInputValue(selectors.itemNiches.firstCodeInput); }) .then(result => { - expect(result).toEqual('A2'); + expect(result).toEqual('A1'); }); }); it(`should confirm the second niche is the expected one`, () => { return nightmare - .getInputValue(selectors.itemNiches.secondWarehouseSelect) + .getInputValue(selectors.itemNiches.secondWarehouseDisabled) .then(result => { expect(result).toEqual('Warehouse Three'); return nightmare @@ -93,7 +89,7 @@ describe('create item niche path', () => { it(`should confirm the third niche is the expected one`, () => { return nightmare - .getInputValue(selectors.itemNiches.thirdWarehouseSelect) + .getInputValue(selectors.itemNiches.thirdWarehouseDisabled) .then(result => { expect(result).toEqual('Warehouse Four'); return nightmare