e2e path for item tags #121

This commit is contained in:
Carlos Jimenez 2018-02-27 19:00:46 +01:00
parent 34e35ee139
commit b3ec161b00
2 changed files with 136 additions and 3 deletions

View File

@ -181,6 +181,27 @@ 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)`, 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}` submitBasicDataButton: `${components.vnSubmit}`
}, },
itemTags: {
tagsButton: `${components.vnMenuItem}[ui-sref="item.card.tags"]`,
firstTagSelect: `vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > ${components.vnTextfield}`,
firstTagSelectOptionOne: `vn-horizontal:nth-child(3) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`,
firstValueInput: `vn-horizontal:nth-child(3) > ${components.vnTextfield}`,
secondTagSelect: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > ${components.vnTextfield}`,
secondTagSelectOptionOne: `vn-horizontal:nth-child(4) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`,
secondValueInput: `vn-horizontal:nth-child(4) > ${components.vnTextfield}`,
thirdTagSelect: `vn-horizontal:nth-child(5) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > ${components.vnTextfield}`,
thirdTagSelectOptionOne: `vn-horizontal:nth-child(5) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`,
thirdValueInput: `vn-horizontal:nth-child(5) > ${components.vnTextfield}`,
fourthTagSelect: `vn-horizontal:nth-child(6) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > ${components.vnTextfield}`,
fourthTagSelectOptionOne: `vn-horizontal:nth-child(6) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(1)`,
fourthValueInput: `vn-horizontal:nth-child(6) > ${components.vnTextfield}`,
fifthRemoveTagButton: `vn-horizontal:nth-child(7) > vn-one > ${components.vnIcon}[icon="remove_circle_outline"]`,
addItemTagButton: `${components.vnIcon}[icon="add_circle"]`,
fifthTagSelect: `vn-horizontal:nth-child(7) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > ${components.vnTextfield}`,
fifthTagSelectOptionFive: `vn-horizontal:nth-child(7) > ${components.vnAutocomplete}[field="itemTag.tagFk"] > vn-vertical > vn-drop-down > vn-vertical:not(.ng-hide) > vn-auto:nth-child(2) > ul > li:nth-child(5)`,
fifthValueInput: `vn-horizontal:nth-child(7) > ${components.vnTextfield}`,
submitItemTagsButton: `${components.vnSubmit}`
},
itemTax: { itemTax: {
taxButton: `${components.vnMenuItem}[ui-sref="item.card.tax"]`, taxButton: `${components.vnMenuItem}[ui-sref="item.card.tax"]`,
firstClassSelect: `vn-horizontal:nth-child(2) > ${components.vnAutocomplete}[field="tax.taxClassFk"] > vn-vertical > ${components.vnTextfield}`, firstClassSelect: `vn-horizontal:nth-child(2) > ${components.vnAutocomplete}[field="tax.taxClassFk"] > vn-vertical > ${components.vnTextfield}`,
@ -221,9 +242,6 @@ export default {
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)`, 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}` submitBotanicalButton: `${components.vnSubmit}`
}, },
itemTags: {
tagsButton: `${components.vnMenuItem}[ui-sref="item.card.tags"]`
},
itemSummary: { itemSummary: {
basicData: `${components.vnItemSummary} > vn-horizontal:nth-child(1) > vn-one:nth-child(2) > vn-vertical > p:nth-child(2)`, basicData: `${components.vnItemSummary} > vn-horizontal:nth-child(1) > vn-one:nth-child(2) > vn-vertical > p:nth-child(2)`,
tags: `${components.vnItemSummary} > vn-horizontal:nth-child(1) > vn-one:nth-child(3) > vn-vertical > p`, tags: `${components.vnItemSummary} > vn-horizontal:nth-child(1) > vn-one:nth-child(3) > vn-vertical > p`,

View File

@ -0,0 +1,115 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
describe('create item tags 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 tags`, () => {
return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.waitToClick(selectors.itemsIndex.searchResult)
.waitToClick(selectors.itemTags.tagsButton)
.waitForURL('tags')
.url()
.then(url => {
expect(url).toContain('tags');
});
});
it(`should create a new tag, edit another 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')
.waitToClick(selectors.itemTags.fifthRemoveTagButton)
.waitToClick(selectors.itemTags.addItemTagButton)
.waitToClick(selectors.itemTags.fifthTagSelect)
.waitToClick(selectors.itemTags.fifthTagSelectOptionFive)
.type(selectors.itemTags.fifthValueInput, 'Thanos')
.click(selectors.itemTags.submitItemTagsButton)
.waitForSnackbar()
.then(result => {
expect(result).toContain('Data saved!');
});
});
it(`should confirm the remaining tags are the expected ones`, () => {
return nightmare
.click(selectors.itemBasicData.basicDataButton)
.wait(selectors.itemBasicData.nameInput)
.click(selectors.itemTags.tagsButton)
.wait(200)
.getInputValue(selectors.itemTags.firstTagSelect)
.then(result => {
expect(result).toEqual('Owner');
return nightmare
.getInputValue(selectors.itemTags.firstValueInput);
})
.then(result => {
expect(result).toEqual('Thanos');
return nightmare
.getInputValue(selectors.itemTags.secondTagSelect);
})
.then(result => {
expect(result).toEqual('Color');
return nightmare
.getInputValue(selectors.itemTags.secondValueInput);
})
.then(result => {
expect(result).toEqual('Dark Blue');
return nightmare
.getInputValue(selectors.itemTags.thirdTagSelect);
})
.then(result => {
expect(result).toEqual('Location');
return nightmare
.getInputValue(selectors.itemTags.thirdValueInput);
})
.then(result => {
expect(result).toEqual('Gamoras hideout');
return nightmare
.getInputValue(selectors.itemTags.fourthTagSelect);
})
.then(result => {
expect(result).toEqual('Shape');
return nightmare
.getInputValue(selectors.itemTags.fourthValueInput);
})
.then(result => {
expect(result).toEqual('round');
return nightmare
.getInputValue(selectors.itemTags.fifthTagSelect);
})
.then(result => {
expect(result).toEqual('Power');
return nightmare
.getInputValue(selectors.itemTags.fifthValueInput);
})
.then(result => {
expect(result).toEqual('Manipulates time');
});
});
});