2019-03-10 12:14:13 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-03-10 12:14:13 +00:00
|
|
|
|
2019-03-14 07:44:47 +00:00
|
|
|
describe('Item descriptor 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('buyer', 'item');
|
|
|
|
await page.accessToSearchResult('1');
|
|
|
|
await page.accessToSection('item.card.basicData');
|
|
|
|
});
|
|
|
|
|
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
2019-03-10 12:14:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the descriptor inactive icon is dark as the item is active', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.wait(selectors.itemDescriptor.inactiveIcon);
|
|
|
|
await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
2020-04-08 09:24:40 +00:00
|
|
|
const darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
2019-03-10 12:14:13 +00:00
|
|
|
|
|
|
|
expect(darkIcon).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should set the item to inactive', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-10 12:14:13 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2019-03-10 12:14:13 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should reload the section and check the inactive icon is bright', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.reloadSection('item.card.basicData');
|
|
|
|
await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
2020-04-08 09:24:40 +00:00
|
|
|
const brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
2019-03-10 12:14:13 +00:00
|
|
|
|
|
|
|
expect(brightIcon).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should set the item back to active', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-10 12:14:13 +00:00
|
|
|
|
2020-04-08 09:24:40 +00:00
|
|
|
expect(message.type).toBe('success');
|
2019-03-10 12:14:13 +00:00
|
|
|
});
|
|
|
|
});
|