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
|
|
|
|
2022-10-05 11:17: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');
|
2020-10-01 06:53:31 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.searchButton);
|
2020-01-09 12:07:16 +00:00
|
|
|
});
|
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() => {
|
2021-11-12 14:17:09 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.shownColumns);
|
|
|
|
const visible = await page.isVisible(selectors.itemsIndex.shownColumnsList);
|
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.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);
|
2022-09-27 09:26:36 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-06 08:50:12 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-03-06 08:50:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should navigate forth and back to see the images column is still visible', async() => {
|
2021-11-12 14:17:09 +00:00
|
|
|
await page.closePopup();
|
2020-03-17 10:00:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.firstSearchResult);
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
2020-10-01 06:53:31 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.searchButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.itemsIndex.searchResult);
|
2020-01-09 12:07:16 +00:00
|
|
|
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
|
|
|
});
|
|
|
|
|
2020-03-17 10:00:16 +00:00
|
|
|
it('should mark all unchecked boxes to leave the index as it was', async() => {
|
2021-11-12 14:17:09 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.shownColumns);
|
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.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);
|
2022-09-27 09:26:36 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.weightByPieceCheckbox);
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.saveFieldsButton);
|
2020-04-08 09:24:40 +00:00
|
|
|
const message = await page.waitForSnackbar();
|
2019-03-06 08:50:12 +00:00
|
|
|
|
2020-11-10 11:06:21 +00:00
|
|
|
expect(message.text).toContain('Data saved!');
|
2019-03-06 08:50:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should now navigate forth and back to see the ids column is now visible', async() => {
|
2021-11-12 14:17:09 +00:00
|
|
|
await page.closePopup();
|
2020-03-17 10:00:16 +00:00
|
|
|
await page.waitToClick(selectors.itemsIndex.firstSearchResult);
|
2020-01-09 12:07:16 +00:00
|
|
|
await page.waitToClick(selectors.itemDescriptor.goBackToModuleIndexButton);
|
2020-10-01 06:53:31 +00:00
|
|
|
await page.waitToClick(selectors.globalItems.searchButton);
|
2020-11-23 17:28:39 +00:00
|
|
|
await page.waitForSelector(selectors.itemsIndex.searchResult);
|
2020-01-09 12:07:16 +00:00
|
|
|
const idVisible = await page.isVisible(selectors.itemsIndex.firstItemId);
|
2019-03-06 08:50:12 +00:00
|
|
|
|
|
|
|
expect(idVisible).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|