salix/e2e/paths/01-salix/03_smartTable_searchBar_int...

69 lines
2.5 KiB
JavaScript
Raw Normal View History

import selectors from '../../helpers/selectors.js';
import getBrowser from '../../helpers/puppeteer';
2022-12-22 06:46:06 +00:00
describe('SmartTable SearchBar integration', () => {
let browser;
let page;
beforeAll(async() => {
browser = await getBrowser();
page = browser.page;
await page.loginAndModule('salesPerson', 'item');
await page.waitToClick(selectors.globalItems.searchButton);
});
afterAll(async() => {
await browser.close();
});
2023-05-04 08:00:21 +00:00
it('should search by type in searchBar, reload page and have same results', async() => {
await page.waitToClick(selectors.itemsIndex.openAdvancedSearchButton);
await page.autocompleteSearch(selectors.itemsIndex.advancedSearchItemType, 'Anthurium');
await page.waitToClick(selectors.itemsIndex.advancedSearchButton);
2023-06-13 11:32:04 +00:00
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 4);
2023-05-04 08:00:21 +00:00
await page.reload({
waitUntil: 'networkidle2'
});
2023-06-13 11:32:04 +00:00
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 4);
2023-06-13 12:15:31 +00:00
await page.write(selectors.itemsIndex.advancedSmartTableGrouping, '1');
2023-05-04 08:00:21 +00:00
await page.keyboard.press('Enter');
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
2023-05-04 08:00:21 +00:00
await page.reload({
waitUntil: 'networkidle2'
});
2023-06-13 12:15:31 +00:00
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 1);
2022-12-21 14:01:05 +00:00
});
2023-05-04 08:00:21 +00:00
it('should filter in section without smart-table and search in searchBar go to zone section', async() => {
await page.loginAndModule('salesPerson', 'zone');
await page.waitToClick(selectors.globalItems.searchButton);
2022-12-21 14:01:05 +00:00
2023-05-04 08:00:21 +00:00
await page.doSearch('A');
const firstCount = await page.countElement(selectors.zoneIndex.searchResult);
2022-12-21 14:01:05 +00:00
2023-05-04 08:00:21 +00:00
await page.doSearch('A');
const secondCount = await page.countElement(selectors.zoneIndex.searchResult);
2022-12-21 14:01:05 +00:00
2023-05-04 08:00:21 +00:00
expect(firstCount).toEqual(7);
expect(secondCount).toEqual(7);
});
2023-05-04 08:00:21 +00:00
it('should order orders by first id and order by last id, reload page and have same order', async() => {
await page.loginAndModule('developer', 'item');
await page.accessToSection('item.fixedPrice');
await page.keyboard.press('Enter');
2023-05-04 08:00:21 +00:00
await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '1');
2023-05-04 08:00:21 +00:00
await page.waitToClick(selectors.itemFixedPrice.orderColumnId);
await page.reload({
waitUntil: 'networkidle2'
});
2023-05-26 09:53:32 +00:00
await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '3');
});
});