2018-02-22 15:44:14 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/helpers';
|
|
|
|
|
2018-02-22 15:44:53 +00:00
|
|
|
describe('Item summary path', () => {
|
2018-02-22 15:44:14 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
2018-03-02 11:15:17 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
return nightmare
|
|
|
|
.waitForLogin('developer');
|
|
|
|
});
|
|
|
|
|
2018-02-22 15:44:14 +00:00
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2018-02-23 08:42:19 +00:00
|
|
|
it('should search for the item Gem of Time', () => {
|
2018-02-22 15:44:14 +00:00
|
|
|
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
|
2018-03-05 14:21:14 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
|
2018-02-22 15:44:14 +00:00
|
|
|
.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
|
2018-03-05 14:21:14 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
|
2018-02-22 15:44:14 +00:00
|
|
|
.getInnerText(selectors.itemSummary.tags)
|
|
|
|
.then(result => {
|
|
|
|
expect(result).toContain('Color: Yellow');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary preview shows fields from niche`, () => {
|
|
|
|
return nightmare
|
2018-03-05 14:21:14 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
|
2018-02-22 15:44:14 +00:00
|
|
|
.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
|
2018-03-05 14:21:14 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
|
2018-02-22 15:44:14 +00:00
|
|
|
.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
|
2018-03-05 14:21:14 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.barcode, '1')
|
2018-02-22 15:44:14 +00:00
|
|
|
.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
|
2018-03-05 14:21:14 +00:00
|
|
|
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
|
2018-02-22 15:44:14 +00:00
|
|
|
.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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|