2018-02-22 15:44:14 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2018-02-22 15:44:14 +00:00
|
|
|
|
2018-11-02 12:36:20 +00:00
|
|
|
describe('Item summary path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.loginAndModule('employee', 'item');
|
|
|
|
});
|
2018-10-28 11:37:37 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
it('should search for an item', async() => {
|
2020-03-31 16:33:48 +00:00
|
|
|
await page.doSearch('Ranged weapon');
|
|
|
|
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
2020-03-20 15:18:38 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemsIndex.searchResult, 'Ranged weapon');
|
|
|
|
await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton);
|
2020-01-09 12:07:16 +00:00
|
|
|
const isVisible = await page.isVisible(selectors.itemSummary.basicData);
|
2018-11-20 13:22:00 +00:00
|
|
|
|
2020-03-31 16:33:48 +00:00
|
|
|
expect(nResults).toBe(3);
|
2019-10-28 16:31:33 +00:00
|
|
|
expect(isVisible).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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Ranged weapon longbow 2m');
|
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-03-27 07:44:15 +00:00
|
|
|
expect(result).toContain('Ranged weapon longbow 2m');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.tags, 'Brown');
|
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-03-27 07:44:15 +00:00
|
|
|
expect(result).toContain('Brown');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.niche, 'A1');
|
|
|
|
const result = await page.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() => {
|
2021-03-04 06:56:31 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.botanical, 'Abelia');
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2021-03-04 06:56:31 +00:00
|
|
|
expect(result).toContain('Abelia');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.barcode, '1');
|
|
|
|
const result = await page.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() => {
|
2020-02-12 13:36:05 +00:00
|
|
|
await page.closePopup();
|
|
|
|
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
it('should search for other item', async() => {
|
2020-03-31 16:33:48 +00:00
|
|
|
await page.doSearch('Melee Reinforced');
|
|
|
|
const nResults = await page.countElement(selectors.itemsIndex.searchResult);
|
|
|
|
|
2020-03-20 15:18:38 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.firstResultPreviewButton);
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForSelector(selectors.itemSummary.basicData, {visible: true});
|
2020-03-31 16:33:48 +00:00
|
|
|
|
|
|
|
expect(nResults).toBe(2);
|
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() => {
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee Reinforced weapon combat fist 15cm');
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2020-03-17 13:01:25 +00:00
|
|
|
expect(result).toContain('Melee Reinforced weapon combat fist 15cm');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.tags, 'Silver');
|
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-03-27 07:44:15 +00:00
|
|
|
expect(result).toContain('Silver');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.botanical, '-');
|
|
|
|
const result = await page.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 close the summary popup`, async() => {
|
2020-02-12 13:36:05 +00:00
|
|
|
await page.closePopup();
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForSelector(selectors.itemSummary.basicData, {hidden: true});
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2021-03-04 06:56:31 +00:00
|
|
|
it(`should navigate to one of the items detailed section`, async() => {
|
2020-03-17 13:01:25 +00:00
|
|
|
await page.accessToSearchResult('Melee weapon combat fist 15cm');
|
2020-03-24 15:49:36 +00:00
|
|
|
await page.waitForState('item.card.summary');
|
2018-11-02 12:36:20 +00:00
|
|
|
});
|
|
|
|
|
2019-02-04 13:47:55 +00:00
|
|
|
it(`should check the descritor edit button is not visible for employee`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const visibleButton = await page.isVisible(selectors.itemDescriptor.editButton);
|
2019-02-04 13:47:55 +00:00
|
|
|
|
|
|
|
expect(visibleButton).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
2019-01-11 11:25:53 +00:00
|
|
|
it(`should check the item summary shows fields from basic data section`, async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitForTextInElement(selectors.itemSummary.basicData, 'Melee weapon combat fist 15cm');
|
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.basicData, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-04-17 07:37:55 +00:00
|
|
|
expect(result).toContain('Melee weapon combat fist 15cm');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.tags, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2019-03-27 07:44:15 +00:00
|
|
|
expect(result).toContain('Silver');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page.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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page.waitToGetProperty(selectors.itemSummary.botanical, 'innerText');
|
2018-11-02 12:36:20 +00:00
|
|
|
|
2021-03-04 06:56:31 +00:00
|
|
|
expect(result).toContain('procera');
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
const result = await page.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
|
|
|
});
|
|
|
|
});
|