2019-03-06 08:50:12 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import createNightmare from '../../helpers/nightmare';
|
|
|
|
|
2019-10-03 07:56:29 +00:00
|
|
|
describe('Item index path', () => {
|
2019-03-06 08:50:12 +00:00
|
|
|
const nightmare = createNightmare();
|
|
|
|
|
|
|
|
beforeAll(() => {
|
|
|
|
nightmare
|
2019-03-08 10:01:10 +00:00
|
|
|
.loginAndModule('salesPerson', 'item')
|
|
|
|
.waitToClick(selectors.itemsIndex.searchIcon);
|
2019-03-06 08:50:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
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.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)
|
2019-06-26 13:27:58 +00:00
|
|
|
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
2019-03-08 10:01:10 +00:00
|
|
|
.waitToClick(selectors.itemsIndex.searchIcon)
|
2019-03-06 08:50:12 +00:00
|
|
|
.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.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)
|
2019-06-26 13:27:58 +00:00
|
|
|
.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton)
|
2019-03-08 10:01:10 +00:00
|
|
|
.waitToClick(selectors.itemsIndex.searchIcon)
|
|
|
|
.wait(selectors.itemsIndex.searchResult)
|
2019-03-06 08:50:12 +00:00
|
|
|
.isVisible(selectors.itemsIndex.firstItemId);
|
|
|
|
|
|
|
|
expect(idVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|