(page, reportName)
| 621 | } |
| 622 | |
| 623 | async 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 | |
| 670 | async function selectDataloadSource(page, label) { |
| 671 | const datasource = page.locator('#datasourceSelect').first(); |
no test coverage detected