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

49 lines
1.7 KiB
JavaScript

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