2019-03-10 12:14:13 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-03-14 07:44:47 +00:00
|
|
|
describe('Item descriptor path', () => {
|
2019-03-10 12:14:13 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
2019-03-14 07:44:47 +00:00
|
|
|
.loginAndModule('buyer', 'item')
|
2019-03-10 12:14:13 +00:00
|
|
|
.accessToSearchResult(1)
|
|
|
|
.accessToSection('item.card.data');
|
|
|
|
});
|
|
|
|
|
|
|
|
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.data')
|
|
|
|
.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!');
|
|
|
|
});
|
|
|
|
});
|