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

Function saveAndReloadReport

tests/playwright/common.js:462–496  ·  view source on GitHub ↗
(page, reportName, options = {})

Source from the content-addressed store, hash-verified

460}
461
462async function saveAndReloadReport(page, reportName, options = {}) {
463 const {
464 clickSave = true,
465 reloadTimeout = 45000,
466 saveVisibleTimeout = 8000,
467 } = options;
468
469 if (clickSave) {
470 const saveIcon = page.locator('#saveIcon').first();
471 await saveIcon.waitFor({ state: 'visible', timeout: saveVisibleTimeout }).catch(() => {});
472 const isVisible = await saveIcon.isVisible().catch(() => false);
473 if (isVisible) {
474 await saveIcon.click();
475 await waitForSaveComplete(page);
476 }
477 }
478
479 await page.reload({ waitUntil: 'domcontentloaded', timeout: reloadTimeout });
480 await waitForIdle(page, 20000);
481 await dismissAnalyticsOnboarding(page);
482 await waitForIdle(page, 10000);
483
484 if (!reportName) {
485 return;
486 }
487
488 const header = reportHeaderLocator(page);
489 const headerVisible = await header.isVisible().catch(() => false);
490 const headerText = headerVisible ? (await header.innerText()).trim() : '';
491 if (!headerVisible || !headerText.includes(reportName)) {
492 await openExistingReport(page, reportName);
493 return;
494 }
495 await assertReportHeader(page, reportName);
496}
497
498async function openExistingReport(page, reportName) {
499 await ensureNavigationSection(page, 'reports');

Callers 11

clearFiltersAndReloadFunction · 0.85
21_filter.jsFile · 0.85
23_sort.jsFile · 0.85
22_drilldown.jsFile · 0.85
29_group_top_n.jsFile · 0.85

Calls 8

waitForSaveCompleteFunction · 0.85
waitForIdleFunction · 0.85
reportHeaderLocatorFunction · 0.85
openExistingReportFunction · 0.85
assertReportHeaderFunction · 0.85
isVisibleMethod · 0.80
firstMethod · 0.45

Tested by

no test coverage detected