2018-02-22 15:44:14 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2018-10-24 08:57:14 +00:00
|
|
|
import createNightmare from '../../helpers/nightmare';
|
2018-02-22 15:44:14 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
describe('Item summary path', () => {
|
|
|
|
const nightmare = createNightmare();
|
2018-10-28 11:37:37 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
2018-11-23 07:05:57 +00:00
|
|
|
.loginAndModule('employee', 'item');
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the item Gem of Time', async () => {
|
|
|
|
const result = await nightmare
|
2018-11-21 13:30:32 +00:00
|
|
|
.wait(selectors.itemsIndex.searchItemInput)
|
2018-11-02 12:36:20 +00:00
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Gem of Time')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should click on the search result summary button to open the item summary popup`, async () => {
|
2018-11-20 13:22:00 +00:00
|
|
|
const isVisibleBefore = await nightmare
|
2018-11-02 12:36:20 +00:00
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Time')
|
2018-11-20 13:22:00 +00:00
|
|
|
.isVisible(selectors.itemSummary.basicData);
|
|
|
|
|
|
|
|
const isVisibleAfter = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
|
|
|
.isVisible(selectors.itemSummary.basicData);
|
|
|
|
|
|
|
|
expect(isVisibleBefore).toBeFalsy();
|
|
|
|
expect(isVisibleAfter).toBeTruthy();
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary preview shows fields from basic data`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Time')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Name: Gem of Time');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary preview shows fields from tags`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Yellow')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Color: Yellow');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary preview shows fields from niche`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A1')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Warehouse One: A1');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary preview shows fields from botanical`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: Hedera helix')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Botanical: Hedera helix');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary preview shows fields from barcode`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.barcode, '1')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('1');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should close the summary popup`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
|
|
|
|
.isVisible(selectors.itemSummary.basicData);
|
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search for the item Gem of Mind', async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.clearInput('body > vn-app > vn-vertical > vn-vertical > ui-view > vn-item-index > div > div > vn-card:nth-child(1) > div > vn-searchbar > form > vn-horizontal > vn-textfield > div > div > div.infix > input')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.type(selectors.itemsIndex.searchItemInput, 'Gem of Mind')
|
|
|
|
.click(selectors.itemsIndex.searchButton)
|
|
|
|
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
|
|
|
|
.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
|
|
|
expect(result).toEqual(1);
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now click on the search result summary button to open the item summary popup`, async () => {
|
2018-11-20 13:22:00 +00:00
|
|
|
const isVisibleBefore = await nightmare
|
2018-11-02 12:36:20 +00:00
|
|
|
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Gem of Mind')
|
2018-11-20 13:22:00 +00:00
|
|
|
.isVisible(selectors.itemSummary.basicData);
|
|
|
|
|
|
|
|
const isVisibleAfter = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResultPreviewButton)
|
|
|
|
.isVisible(selectors.itemSummary.basicData);
|
|
|
|
|
|
|
|
|
|
|
|
expect(isVisibleBefore).toBeFalsy();
|
|
|
|
expect(isVisibleAfter).toBeTruthy();
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now check the item summary preview shows fields from basic data`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Name: Gem of Mind');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now check the item summary preview shows fields from tags`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.tags, 'Color: Red')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Color: Red');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now check the item summary preview shows fields from niche`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.niche, 'Warehouse One: A4')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Warehouse One: A4');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now check the item summary preview shows fields from botanical`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.botanical, 'Botanical: -')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Botanical: -');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now check the item summary preview shows fields from barcode`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.barcode, '4')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('4');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should now close the summary popup`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
|
|
|
|
.isVisible(selectors.itemSummary.basicData);
|
|
|
|
|
|
|
|
expect(result).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should navigate to the one of the items detailed section`, async () => {
|
|
|
|
const url = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitForURL('summary')
|
|
|
|
.parsedUrl();
|
|
|
|
|
|
|
|
expect(url.hash).toContain('summary');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary shows fields from basic data section`, async () => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitForTextInElement(selectors.itemSummary.basicData, 'Name: Gem of Mind')
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Name: Gem of Mind');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary shows fields from tags section`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Color: Red');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary shows fields from niches section`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Warehouse One: A4');
|
|
|
|
});
|
|
|
|
|
|
|
|
it(`should check the item summary shows fields from botanical section`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
|
|
|
expect(result).toContain('Botanical: -');
|
|
|
|
});
|
2018-10-28 11:37:37 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
it(`should check the item summary shows fields from barcodes section`, async () => {
|
|
|
|
const result = await nightmare
|
2018-11-22 14:44:33 +00:00
|
|
|
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
|
2018-10-28 11:37:37 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
expect(result).toContain('4');
|
2018-02-22 15:44:14 +00:00
|
|
|
});
|
|
|
|
});
|