salix/e2e/paths/04-item/12_descriptor.spec.js

51 lines
1.9 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
describe('Item descriptor path', () => {
let browser;
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
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() => {
await browser.close();
});
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');
let darkIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
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);
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
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');
let brightIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
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);
let result = await page.waitForLastSnackbar();
expect(result).toEqual('Data saved!');
});
});