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

42 lines
1.4 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 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();
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
});
2020-12-04 12:40:58 +00:00
it('should reload the section and check the inactive icon is visible', async() => {
2020-01-09 12:07:16 +00:00
await page.reloadSection('item.card.basicData');
2020-12-04 12:40:58 +00:00
const visibleIcon = await page.isVisible(selectors.itemDescriptor.inactiveIcon);
2020-12-04 12:40:58 +00:00
expect(visibleIcon).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();
2020-11-10 11:06:21 +00:00
expect(message.text).toContain('Data saved!');
});
});