2022-09-29 10:36:16 +00:00
|
|
|
import selectors from '../../helpers/selectors.js';
|
|
|
|
import getBrowser from '../../helpers/puppeteer';
|
|
|
|
|
2022-12-22 06:46:06 +00:00
|
|
|
describe('SmartTable SearchBar integration', () => {
|
2022-09-29 10:36:16 +00:00
|
|
|
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();
|
|
|
|
});
|
|
|
|
|
2022-12-21 14:01:05 +00:00
|
|
|
describe('as filters in smart-table section', () => {
|
2022-09-29 10:36:16 +00:00
|
|
|
it('should search by type in searchBar', async() => {
|
|
|
|
await page.waitToClick(selectors.itemsIndex.openAdvancedSearchButton);
|
|
|
|
await page.autocompleteSearch(selectors.itemsIndex.advancedSearchItemType, 'Anthurium');
|
|
|
|
await page.waitToClick(selectors.itemsIndex.advancedSearchButton);
|
|
|
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should reload page and have same results', async() => {
|
|
|
|
await page.reload({
|
|
|
|
waitUntil: 'networkidle2'
|
|
|
|
});
|
|
|
|
|
|
|
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 3);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search by grouping in smartTable', async() => {
|
|
|
|
await page.waitToClick(selectors.itemsIndex.advancedSmartTableButton);
|
|
|
|
await page.write(selectors.itemsIndex.advancedSmartTableGrouping, '1');
|
|
|
|
await page.keyboard.press('Enter');
|
|
|
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should now reload page and have same results', async() => {
|
|
|
|
await page.reload({
|
|
|
|
waitUntil: 'networkidle2'
|
|
|
|
});
|
|
|
|
|
|
|
|
await page.waitForNumberOfElements(selectors.itemsIndex.searchResult, 2);
|
|
|
|
});
|
2022-12-21 14:01:05 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('as filters in section without smart-table', () => {
|
|
|
|
it('go to zone section', async() => {
|
|
|
|
await page.loginAndModule('salesPerson', 'zone');
|
|
|
|
await page.waitToClick(selectors.globalItems.searchButton);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search in searchBar first time', async() => {
|
|
|
|
await page.doSearch('A');
|
|
|
|
const count = await page.countElement(selectors.zoneIndex.searchResult);
|
|
|
|
|
|
|
|
expect(count).toEqual(7);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search in searchBar second time', async() => {
|
|
|
|
await page.doSearch('A');
|
|
|
|
const count = await page.countElement(selectors.zoneIndex.searchResult);
|
|
|
|
|
|
|
|
expect(count).toEqual(7);
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should search in searchBar third time', async() => {
|
|
|
|
await page.doSearch('A');
|
|
|
|
const count = await page.countElement(selectors.zoneIndex.searchResult);
|
|
|
|
|
|
|
|
expect(count).toEqual(7);
|
|
|
|
});
|
2022-09-29 10:36:16 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('as orders', () => {
|
|
|
|
it('should order by first id', async() => {
|
|
|
|
await page.loginAndModule('developer', 'item');
|
|
|
|
await page.accessToSection('item.fixedPrice');
|
2023-04-19 11:26:56 +00:00
|
|
|
await page.keyboard.press('Enter');
|
2022-09-29 10:36:16 +00:00
|
|
|
|
2023-04-27 06:53:54 +00:00
|
|
|
await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '1');
|
2022-09-29 10:36:16 +00:00
|
|
|
});
|
|
|
|
|
2023-04-19 11:26:56 +00:00
|
|
|
it('should order by last id, reload page and have same order', async() => {
|
2022-09-29 10:36:16 +00:00
|
|
|
await page.waitToClick(selectors.itemFixedPrice.orderColumnId);
|
|
|
|
await page.reload({
|
|
|
|
waitUntil: 'networkidle2'
|
|
|
|
});
|
2023-04-27 06:53:54 +00:00
|
|
|
await page.waitForTextInField(selectors.itemFixedPrice.firstItemID, '13');
|
2022-09-29 10:36:16 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|