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

Function openReportAutomationTab

tests/playwright/common.js:623–668  ·  view source on GitHub ↗
(page, reportName)

Source from the content-addressed store, hash-verified

621}
622
623async function openReportAutomationTab(page, reportName) {
624 if (await reportExists(page, reportName)) {
625 const menu = await openNavigationEntryMenu(page, reportName);
626 const maintenance = menu.locator('#navigationMenuAdvanced, a:has-text("Dataset maintenance")').first();
627 if (await maintenance.count().catch(() => 0)) {
628 await maintenance.click();
629 await waitForIdle(page, 15000);
630 await clickFirst(
631 page,
632 ['#tabHeaderDataload', '#tabHeaderDataload a', 'a:has-text("Automation")', 'a:has-text("Dataload")'],
633 'automation tab'
634 );
635 await page.locator('#datasourceSelect').first().waitFor({ state: 'visible', timeout: 15000 });
636 return;
637 }
638 }
639
640 let datasetId = await page.locator('#datasetId').first().inputValue().catch(() => '');
641 if (!datasetId) {
642 datasetId = await page.evaluate(() => String(window.OCA?.Analytics?.currentReportData?.options?.dataset || '')).catch(() => '');
643 }
644 await ensureNavigationSection(page, 'datasets');
645 if (!datasetId) {
646 datasetId = await page.locator('#datasetId').first().inputValue().catch(() => '');
647 }
648 let datasetEntry = datasetId
649 ? page.locator(`#navigationDatasets a[data-id="${datasetId}"][data-item_type="dataset"]`).first()
650 : page.locator('#navigationDatasets a[data-item_type="dataset"]').filter({ hasText: reportName }).first();
651 if (!(await datasetEntry.count().catch(() => 0))) {
652 datasetEntry = page.locator('#navigationDatasets a[data-item_type="dataset"]').filter({ hasText: reportName }).first();
653 }
654 await datasetEntry.waitFor({ state: 'attached', timeout: 20000 });
655 const entryVisible = await datasetEntry.isVisible().catch(() => false);
656 if (entryVisible) {
657 await datasetEntry.click();
658 } else {
659 await datasetEntry.evaluate((node) => node.click());
660 }
661 await waitForIdle(page, 15000);
662 await clickFirst(
663 page,
664 ['#tabHeaderDataload', '#tabHeaderDataload a', 'a:has-text("Automation")', 'a:has-text("Dataload")'],
665 'automation tab'
666 );
667 await page.locator('#datasourceSelect').first().waitFor({ state: 'visible', timeout: 15000 });
668}
669
670async function selectDataloadSource(page, label) {
671 const datasource = page.locator('#datasourceSelect').first();

Calls 6

reportExistsFunction · 0.85
openNavigationEntryMenuFunction · 0.85
waitForIdleFunction · 0.85
clickFirstFunction · 0.85
ensureNavigationSectionFunction · 0.85
firstMethod · 0.80

Tested by

no test coverage detected