51 lines
1.9 KiB
JavaScript
51 lines
1.9 KiB
JavaScript
import selectors from '../../helpers/selectors.js';
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
describe('Item descriptor path', () => {
|
|
let browser;
|
|
let page;
|
|
beforeAll(async() => {
|
|
browser = await getBrowser();
|
|
page = browser.page;
|
|
await page.loginAndModule('buyer', 'item');
|
|
await page.accessToSearchResult('1');
|
|
await page.accessToSection('item.card.basicData');
|
|
});
|
|
|
|
afterAll(async() => {
|
|
browser.close();
|
|
});
|
|
|
|
it('should check the descriptor inactive icon is dark as the item is active', async() => {
|
|
await page.wait(selectors.itemDescriptor.inactiveIcon);
|
|
await page.waitForClassNotPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
|
let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
|
|
|
expect(darkIcon).toBeTruthy();
|
|
});
|
|
|
|
it('should set the item to inactive', async() => {
|
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
|
let result = await page.waitForLastSnackbar();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
|
|
it('should reload the section and check the inactive icon is bright', async() => {
|
|
await page.reloadSection('item.card.basicData');
|
|
await page.waitForClassPresent(selectors.itemDescriptor.inactiveIcon, 'bright');
|
|
let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
|
|
|
|
expect(brightIcon).toBeTruthy();
|
|
});
|
|
|
|
it('should set the item back to active', async() => {
|
|
await page.waitToClick(selectors.itemBasicData.isActiveCheckbox);
|
|
await page.waitToClick(selectors.itemBasicData.submitBasicDataButton);
|
|
let result = await page.waitForLastSnackbar();
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
});
|
|
});
|