diff --git a/e2e/helpers/selectors.js b/e2e/helpers/selectors.js index a8850a420..92532464f 100644 --- a/e2e/helpers/selectors.js +++ b/e2e/helpers/selectors.js @@ -140,7 +140,18 @@ export default { searchButton: `${components.vnSearchBar} > vn-icon-button > button` }, itemBasicData: { - basicDataButton: `${components.vnMenuItem}[ui-sref="item.card.data"]` + basicDataButton: `${components.vnMenuItem}[ui-sref="item.card.data"]`, + typeSelect: `${components.vnAutocomplete}[field="$ctrl.item.typeFk"] > vn-vertical > ${components.vnTextfield}`, + typeSelectOptionTwo: `${components.vnAutocomplete}[field="$ctrl.item.typeFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + intrastatSelect: `${components.vnAutocomplete}[field="$ctrl.item.intrastatFk"] > vn-vertical > ${components.vnTextfield}`, + intrastatSelectOptionOne: `${components.vnAutocomplete}[field="$ctrl.item.intrastatFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`, + nameInput: `vn-horizontal:nth-child(2) > ${components.vnTextfield}`, + relevancyInput: `vn-horizontal:nth-child(3) > ${components.vnTextfield}`, + originSelect: `${components.vnAutocomplete}[field="$ctrl.item.originFk"] > vn-vertical > ${components.vnTextfield}`, + originSelectOptionTwo: `${components.vnAutocomplete}[field="$ctrl.item.originFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, + expenceSelect: `${components.vnAutocomplete}[field="$ctrl.item.expenceFk"] > vn-vertical > ${components.vnTextfield}`, + 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}` }, itemBarcodes: { barcodeButton: `${components.vnMenuItem}[ui-sref="item.card.itemBarcode"]`, @@ -171,5 +182,8 @@ export default { speciesSelectOptionOne: `${components.vnAutocomplete}[field="$ctrl.botanical.specieFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`, speciesSelectOptionTwo: `${components.vnAutocomplete}[field="$ctrl.botanical.specieFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(2)`, submitBotanicalButton: `${components.vnSubmit}` + }, + itemTags: { + tagsButton: `${components.vnMenuItem}[ui-sref="item.card.tags"]` } }; 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 new file mode 100644 index 000000000..bfcd73475 --- /dev/null +++ b/e2e/paths/item-module/02_edit_item_basic_data.spec.js @@ -0,0 +1,113 @@ +import selectors from '../../helpers/selectors.js'; +import createNightmare from '../../helpers/helpers'; + +describe('edit item basic data 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 Mind', () => { + return nightmare + .wait(selectors.itemsIndex.searchResult) + .type(selectors.itemsIndex.searchItemInput, 'Gem of Mind') + .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 basic data`, () => { + return nightmare + .waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind') + .waitToClick(selectors.itemsIndex.searchResult) + .waitToClick(selectors.itemBasicData.basicDataButton) + .waitForURL('data') + .url() + .then(url => { + expect(url).toContain('data'); + }); + }); + + it(`should edit the item basic data`, () => { + return nightmare + .clearInput(selectors.itemBasicData.nameInput) + .type(selectors.itemBasicData.nameInput, 'Rose of Purity') + .waitToClick(selectors.itemBasicData.typeSelect) + .waitToClick(selectors.itemBasicData.typeSelectOptionTwo) + .waitToClick(selectors.itemBasicData.intrastatSelect) + .waitToClick(selectors.itemBasicData.intrastatSelectOptionOne) + .clearInput(selectors.itemBasicData.relevancyInput) + .type(selectors.itemBasicData.relevancyInput, '1') + .waitToClick(selectors.itemBasicData.originSelect) + .waitToClick(selectors.itemBasicData.originSelectOptionTwo) + .waitToClick(selectors.itemBasicData.expenceSelect) + .waitToClick(selectors.itemBasicData.expenceSelectOptionTwo) + .click(selectors.itemBasicData.submitBasicDataButton) + .waitForSnackbar() + .then(result => { + expect(result).toContain('Data saved!'); + }); + }); + + it(`should confirm the item name was edited`, () => { + return nightmare + .click(selectors.itemTags.tagsButton) + .wait(selectors.itemTags.tagsButton) + .waitToClick(selectors.itemBasicData.basicDataButton) + .wait(200) + .getInputValue(selectors.itemBasicData.nameInput) + .then(result => { + expect(result).toEqual('Rose of Purity'); + }); + }); + + it(`should confirm the item type was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.typeSelect) + .then(result => { + expect(result).toEqual('Crisantemo'); + }); + }); + + it(`should confirm the item intrastad was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.intrastatSelect) + .then(result => { + expect(result).toEqual('Coral y materiales similares'); + }); + }); + + it(`should confirm the item relevancy was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.relevancyInput) + .then(result => { + expect(result).toEqual('1'); + }); + }); + + it(`should confirm the item origin was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.originSelect) + .then(result => { + expect(result).toEqual('Spain'); + }); + }); + + it(`should confirm the item expence was edited`, () => { + return nightmare + .getInputValue(selectors.itemBasicData.expenceSelect) + .then(result => { + expect(result).toEqual('loan'); + }); + }); +}); diff --git a/e2e/paths/item-module/04_create_item_niche.spec.js b/e2e/paths/item-module/05_create_item_niche.spec.js similarity index 100% rename from e2e/paths/item-module/04_create_item_niche.spec.js rename to e2e/paths/item-module/05_create_item_niche.spec.js diff --git a/e2e/paths/item-module/05_create_item_botanical.spec.js b/e2e/paths/item-module/06_create_item_botanical.spec.js similarity index 100% rename from e2e/paths/item-module/05_create_item_botanical.spec.js rename to e2e/paths/item-module/06_create_item_botanical.spec.js diff --git a/e2e/paths/item-module/06_create_item_barcode.spec.js b/e2e/paths/item-module/07_create_item_barcode.spec.js similarity index 100% rename from e2e/paths/item-module/06_create_item_barcode.spec.js rename to e2e/paths/item-module/07_create_item_barcode.spec.js