2019-03-06 08:50:12 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
2020-01-14 08:24:09 +00:00
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
2019-03-06 08:50:12 +00:00
|
|
|
|
2019-10-03 07:56:29 +00:00
|
|
|
describe('Item index path', () => {
|
2020-01-14 08:24:09 +00:00
|
|
|
let browser;
|
2020-01-09 12:07:16 +00:00
|
|
|
let page;
|
|
|
|
beforeAll(async() => {
|
2020-01-14 08:24:09 +00:00
|
|
|
browser = await getBrowser();
|
|
|
|
page = browser.page;
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.loginAndModule('salesPerson', 'item');
|
|
|
|
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
|
|
|
});
|
2019-03-06 08:50:12 +00:00
|
|
|
|
2020-01-09 12:07:16 +00:00
|
|
|
afterAll(async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await browser.close();
|
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() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
|
|
|
const visible = await page.isVisible(selectors.itemsIndex.fieldsToShowForm);
|
2019-03-06 08:50:12 +00:00
|
|
|
|
|
|
|
expect(visible).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should unmark all checkboxes except the first and the last ones', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-03-06 08:50:12 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate forth and back to see the images column is still visible', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.searchResult);
|
|
|
|
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
|
|
|
await page.wait(selectors.itemsIndex.searchResult);
|
|
|
|
await page.waitImgLoad(selectors.itemsIndex.firstItemImage);
|
|
|
|
const imageVisible = await page.isVisible(selectors.itemsIndex.firstItemImageTd);
|
2019-03-06 08:50:12 +00:00
|
|
|
|
|
|
|
expect(imageVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should check the ids column is not visible', async() => {
|
2020-01-16 12:40:51 +00:00
|
|
|
await page.waitForSelector(selectors.itemsIndex.firstItemId, {hidden: true});
|
2019-03-06 08:50:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.fieldsToShowButton);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.idCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.stemsCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.sizeCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.nicheCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.typeCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.categoryCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.intrastadCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.originCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.buyerCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.destinyCheckbox);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
|
|
|
const result = await page.waitForLastSnackbar();
|
2019-03-06 08:50:12 +00:00
|
|
|
|
|
|
|
expect(result).toEqual('Data saved!');
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.searchResult);
|
|
|
|
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
|
|
|
await page.waitToClick(selectors.itemsIndex.searchIcon);
|
|
|
|
await page.wait(selectors.itemsIndex.searchResult);
|
|
|
|
const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId);
|
2019-03-06 08:50:12 +00:00
|
|
|
|
|
|
|
expect(idVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|