MCPcopy Create free account
hub / github.com/Rello/analytics / clearFiltersAndReload

Function clearFiltersAndReload

tests/playwright/21_filter.js:24–41  ·  view source on GitHub ↗
(page)

Source from the content-addressed store, hash-verified

22const reportName = buildUniqueName('Playwright Regression', process.env.REPORT_NAME);
23
24async function clearFiltersAndReload(page) {
25 const cancel = page.locator('#analyticsDialogBtnCancel');
26 if (await cancel.isVisible()) await cancel.click();
27 const buttons = page.locator('.filterVisualizationRemove');
28 while (await buttons.count()) {
29 const count = await buttons.count();
30 await buttons.first().click();
31 await page.waitForFunction(previousCount =>
32 document.querySelectorAll('.filterVisualizationRemove').length < previousCount
33 && !OCA.Analytics.currentXhrRequest, count);
34 }
35 await saveAndReloadReport(page, reportName);
36 const savedFilterCount = await page.evaluate(() =>
37 Object.keys(OCA.Analytics.currentReportData.options.filteroptions?.filter || {}).length);
38 if (savedFilterCount !== 0 || await buttons.count()) {
39 throw new Error('Filter cleanup did not persist after Save and reload');
40 }
41}
42
43(async () => {
44 const browser = await chromium.launch({ headless: config.headless });

Callers 1

21_filter.jsFile · 0.85

Calls 5

saveAndReloadReportFunction · 0.85
isVisibleMethod · 0.80
countMethod · 0.80
evaluateMethod · 0.80
firstMethod · 0.45

Tested by

no test coverage detected