2019-03-06 08:50:12 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-03-06 10:40:52 +00:00
|
|
|
describe('Item index path', () => {
|
2019-03-06 08:50:12 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
|
|
|
.loginAndModule('salesPerson', 'item');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should click on the fields to show button to open the list of columns to show', async() => {
|
|
|
|
const visible = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
|
|
|
.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
|
|
|
|
|
|
|
expect(visible).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should unmark all checkboxes except the first and the last ones', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.idCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.originCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.taxClassCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate forth and back to see the images column is still visible', async() => {
|
|
|
|
const imageVisible = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
|
|
|
.isVisible(selectors.itemsIndex.firstItemImage);
|
|
|
|
|
|
|
|
expect(imageVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the ids column is not visible', async() => {
|
|
|
|
const idVisible = await nightmare
|
|
|
|
.isVisible(selectors.itemsIndex.firstItemId);
|
|
|
|
|
|
|
|
expect(idVisible).toBeFalsy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
|
|
|
const result = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.fieldsToShowButton)
|
|
|
|
.waitToClick(selectors.itemsIndex.idCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.stemsCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.sizeCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.nicheCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.typeCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.categoryCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.intrastadCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.originCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.buyerCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.destinyCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.taxClassCheckbox)
|
|
|
|
.waitToClick(selectors.itemsIndex.saveFieldsButton)
|
|
|
|
.waitForLastSnackbar();
|
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
|
|
|
const idVisible = await nightmare
|
|
|
|
.waitToClick(selectors.itemsIndex.searchResult)
|
|
|
|
.waitToClick(selectors.itemsIndex.goBackToModuleIndexButton)
|
|
|
|
.wait(1999)
|
|
|
|
.isVisible(selectors.itemsIndex.firstItemId);
|
|
|
|
|
|
|
|
expect(idVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|