e2e path for item summary

This commit is contained in:
Carlos Jimenez 2018-02-22 16:44:14 +01:00
parent 51f8d01d24
commit bf751341c3
3 changed files with 142 additions and 2 deletions

View File

@ -17,5 +17,6 @@ export default {
vnMenuItem: 'vn-menu-item > li > a',
vnAutocomplete: 'vn-autocomplete',
vnCheck: 'vn-check',
vnIconButton: 'vn-icon-button'
vnIconButton: 'vn-icon-button',
vnItemSummary: 'vn-item-summary > vn-card > div > vn-vertical'
};

View File

@ -136,8 +136,10 @@ export default {
itemsIndex: {
createItemButton: `${components.vnFloatButton}`,
searchResult: `${components.vnItemProduct} > vn-horizontal > vn-one`,
searchResultPreviewButton: `${components.vnItemProduct}:nth-child(1) > vn-horizontal > vn-horizontal > vn-one:nth-child(2) > vn-icon > i`,
searchItemInput: `${components.vnTextfield}`,
searchButton: `${components.vnSearchBar} > vn-icon-button > button`
searchButton: `${components.vnSearchBar} > vn-icon-button > button`,
closeItemSummaryPreview: 'body > vn-app > vn-vertical > vn-vertical > ui-view > vn-item-list:nth-child(1) > div > vn-dialog > div > button > vn-icon'
},
itemBasicData: {
basicDataButton: `${components.vnMenuItem}[ui-sref="item.card.data"]`,
@ -185,5 +187,12 @@ export default {
},
itemTags: {
tagsButton: `${components.vnMenuItem}[ui-sref="item.card.tags"]`
},
itemSummary: {
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`,
niche: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(1) > vn-vertical > p:nth-child(2)`,
botanical: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(2) > vn-vertical > p`,
barcode: `${components.vnItemSummary} > vn-horizontal:nth-child(2) > vn-one:nth-child(3) > vn-vertical > p`
}
};

View File

@ -0,0 +1,130 @@
import selectors from '../../helpers/selectors.js';
import createNightmare from '../../helpers/helpers';
fdescribe('Item summary 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 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 summary button to open the item summary popup`, () => {
return nightmare
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
.isVisible(selectors.itemSummary.basicData)
.then(result => {
expect(result).toBeFalsy();
return nightmare
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
.isVisible(selectors.itemSummary.basicData);
})
.then(result => {
expect(result).toBeTruthy();
});
});
it(`should check the item summary preview shows fields from basic data`, () => {
return nightmare
.getInnerText(selectors.itemSummary.basicData)
.then(result => {
expect(result).toContain('Name: Gem of Time');
});
});
it(`should check the item summary preview shows fields from tags`, () => {
return nightmare
.getInnerText(selectors.itemSummary.tags)
.then(result => {
expect(result).toContain('Color: Yellow');
});
});
it(`should check the item summary preview shows fields from niche`, () => {
return nightmare
.getInnerText(selectors.itemSummary.niche)
.then(result => {
expect(result).toContain('Warehouse One: A1');
});
});
it(`should check the item summary preview shows fields from botanical`, () => {
return nightmare
.getInnerText(selectors.itemSummary.botanical)
.then(result => {
expect(result).toContain('Botanical: Hedera helix');
});
});
it(`should check the item summary preview shows fields from barcode`, () => {
return nightmare
.getInnerText(selectors.itemSummary.barcode)
.then(result => {
expect(result).toContain('1');
});
});
it(`should close the summary popup`, () => {
return nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.isVisible(selectors.itemSummary.basicData)
.then(result => {
expect(result).toBeFalsy();
});
});
it(`should navigate to the one of the items detailed section`, () => {
return nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('summary')
.parsedUrl()
.then(url => {
expect(url.hash).toContain('summary');
});
});
it(`should check the item summary shows fields from all its sections`, () => {
return nightmare
.getInnerText(selectors.itemSummary.basicData)
.then(result => {
expect(result).toContain('Name: Gem of Time');
return nightmare
.getInnerText(selectors.itemSummary.tags);
})
.then(result => {
expect(result).toContain('Color: Yellow');
return nightmare
.getInnerText(selectors.itemSummary.niche);
})
.then(result => {
expect(result).toContain('Warehouse One: A1');
return nightmare
.getInnerText(selectors.itemSummary.botanical);
})
.then(result => {
expect(result).toContain('Botanical: Hedera helix');
return nightmare
.getInnerText(selectors.itemSummary.barcode);
})
.then(result => {
expect(result).toContain('1');
});
});
});