(page, reportName)
| 635 | } |
| 636 | |
| 637 | async function openReportAutomationTab(page, reportName) { |
| 638 | if (await reportExists(page, reportName)) { |
| 639 | const menu = await openNavigationEntryMenu(page, reportName); |
| 640 | const maintenance = menu.locator('#navigationMenuAdvanced, a:has-text("Dataset maintenance")').first(); |
| 641 | if (await maintenance.count().catch(() => 0)) { |
| 642 | await maintenance.click(); |
| 643 | await waitForIdle(page, 15000); |
| 644 | await clickFirst( |
| 645 | page, |
| 646 | ['#tabHeaderDataload', '#tabHeaderDataload a', 'a:has-text("Automation")', 'a:has-text("Dataload")'], |
| 647 | 'automation tab' |
| 648 | ); |
| 649 | await page.locator('#datasourceSelect').first().waitFor({ state: 'visible', timeout: 15000 }); |
| 650 | return; |
| 651 | } |
| 652 | } |
| 653 | |
| 654 | let datasetId = await page.locator('#datasetId').first().inputValue().catch(() => ''); |
| 655 | if (!datasetId) { |
| 656 | datasetId = await page.evaluate(() => String(window.OCA?.Analytics?.currentReportData?.options?.dataset || '')).catch(() => ''); |
| 657 | } |
| 658 | await ensureNavigationSection(page, 'datasets'); |
| 659 | if (!datasetId) { |
| 660 | datasetId = await page.locator('#datasetId').first().inputValue().catch(() => ''); |
| 661 | } |
| 662 | let datasetEntry = datasetId |
| 663 | ? page.locator(`#navigationDatasets a[data-id="${datasetId}"][data-item_type="dataset"]`).first() |
| 664 | : page.locator('#navigationDatasets a[data-item_type="dataset"]').filter({ hasText: reportName }).first(); |
| 665 | if (!(await datasetEntry.count().catch(() => 0))) { |
| 666 | datasetEntry = page.locator('#navigationDatasets a[data-item_type="dataset"]').filter({ hasText: reportName }).first(); |
| 667 | } |
| 668 | await datasetEntry.waitFor({ state: 'attached', timeout: 20000 }); |
| 669 | const entryVisible = await datasetEntry.isVisible().catch(() => false); |
| 670 | if (entryVisible) { |
| 671 | await datasetEntry.click(); |
| 672 | } else { |
| 673 | await datasetEntry.evaluate((node) => node.click()); |
| 674 | } |
| 675 | await waitForIdle(page, 15000); |
| 676 | await clickFirst( |
| 677 | page, |
| 678 | ['#tabHeaderDataload', '#tabHeaderDataload a', 'a:has-text("Automation")', 'a:has-text("Dataload")'], |
| 679 | 'automation tab' |
| 680 | ); |
| 681 | await page.locator('#datasourceSelect').first().waitFor({ state: 'visible', timeout: 15000 }); |
| 682 | } |
| 683 | |
| 684 | async function selectDataloadSource(page, label) { |
| 685 | const datasource = page.locator('#datasourceSelect').first(); |
no test coverage detected