salix/e2e/paths/04-item/09_index.spec.js

85 lines
3.9 KiB
JavaScript
Raw Normal View History

2019-03-06 08:50:12 +00:00
import selectors from '../../helpers/selectors.js';
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', () => {
let browser;
2020-01-09 12:07:16 +00:00
let page;
beforeAll(async() => {
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() => {
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() => {
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() => {
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);
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() => {
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() => {
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() => {
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);
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();
});
});