salix/e2e/paths/item-module/01_item_summary.spec.js

209 lines
7.9 KiB
JavaScript
Raw Normal View History

2018-02-22 15:44:14 +00:00
import selectors from '../../helpers/selectors.js';
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
.loginAndModule('employee', 'item');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it('should search for an item', async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-23 14:33:25 +00:00
.write(selectors.itemsIndex.searchItemInput, 'Object1 Gem1 5')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemsIndex.searchButton)
2018-11-02 12:36:20 +00:00
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
});
2019-01-11 11:25:53 +00:00
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
2019-01-11 11:25:53 +00:00
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Object1 Gem1 5')
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
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary preview shows fields from basic data`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.basicData, 'Object1 Gem1 5')
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('Object1 Gem1 5');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary preview shows fields from tags`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.tags, 'Yellow')
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('Yellow');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary preview shows fields from niche`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.niche, 'A1')
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('A1');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary preview shows fields from botanical`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.botanical, 'Hedera helix')
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('Hedera helix');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary preview shows fields from barcode`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '1')
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
2018-11-02 12:36:20 +00:00
expect(result).toContain('1');
});
2019-01-11 11:25:53 +00:00
it(`should close the summary popup`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.isVisible(selectors.itemSummary.basicData);
expect(result).toBeFalsy();
});
2019-01-11 11:25:53 +00:00
it('should search for other item', async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.clearInput('vn-item-index vn-searchbar input')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemsIndex.searchButton)
2019-01-23 14:33:25 +00:00
.write(selectors.itemsIndex.searchItemInput, 'Object2 Gem2 3')
2019-01-23 15:00:56 +00:00
.waitToClick(selectors.itemsIndex.searchButton)
2018-11-02 12:36:20 +00:00
.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1)
.countElement(selectors.itemsIndex.searchResult);
expect(result).toEqual(1);
});
2019-01-11 11:25:53 +00:00
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
2019-01-11 11:25:53 +00:00
.waitForTextInElement(selectors.itemsIndex.searchResult, 'Object2 Gem2 3')
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
});
2019-01-11 11:25:53 +00:00
it(`should now check the item summary preview shows fields from basic data`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.basicData, 'Object2 Gem2 3')
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('Object2 Gem2 3');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should now check the item summary preview shows fields from tags`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.tags, 'Red')
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('Red');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should now check the item summary preview shows fields from niche`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.niche, 'A4')
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('A4');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should now check the item summary preview shows fields from botanical`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.botanical, '-')
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('-');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should now check the item summary preview shows fields from barcode`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitForTextInElement(selectors.itemSummary.barcode, '4')
.waitToGetProperty(selectors.itemSummary.barcode, 'innerText');
2018-11-02 12:36:20 +00:00
expect(result).toContain('4');
});
2019-01-11 11:25:53 +00:00
it(`should now close the summary popup`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitToClick(selectors.itemsIndex.closeItemSummaryPreview)
.isVisible(selectors.itemSummary.basicData);
expect(result).toBeFalsy();
});
2019-01-11 11:25:53 +00:00
it(`should navigate to the one of the items detailed section`, async() => {
2018-11-02 12:36:20 +00:00
const url = await nightmare
.waitToClick(selectors.itemsIndex.searchResult)
.waitForURL('summary')
.parsedUrl();
expect(url.hash).toContain('summary');
});
2019-02-04 13:47:55 +00:00
it(`should check the descritor edit button is not visible for employee`, async() => {
const visibleButton = await nightmare
.isVisible(selectors.itemDescriptor.editButton);
expect(visibleButton).toBeFalsy();
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary shows fields from basic data section`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
2019-01-20 15:47:04 +00:00
.waitForTextInElement(selectors.itemSummary.basicData, 'Object2 Gem2 3')
.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('Object2 Gem2 3');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary shows fields from tags section`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('Red');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary shows fields from niches section`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitToGetProperty(selectors.itemSummary.niche, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('One A4');
2018-11-02 12:36:20 +00:00
});
2019-01-11 11:25:53 +00:00
it(`should check the item summary shows fields from botanical section`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
2018-11-02 12:36:20 +00:00
2019-01-20 15:47:04 +00:00
expect(result).toContain('-');
2018-11-02 12:36:20 +00:00
});
2018-10-28 11:37:37 +00:00
2019-01-11 11:25:53 +00:00
it(`should check the item summary shows fields from barcodes section`, async() => {
2018-11-02 12:36:20 +00:00
const result = await nightmare
.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
});
});