(fixture = {})
| 22 | }); |
| 23 | const waitPreview = () => page.waitForFunction(() => !!Chart.getChart(document.getElementById('chartColumnPreviewCanvas'))); |
| 24 | const open = async (fixture = {}) => { |
| 25 | await page.evaluate(fixture => { |
| 26 | OCA.Analytics.Notification.dialogClose(); |
| 27 | OCA.Analytics.currentReportData = { |
| 28 | header: ['Segment', 'Year', '€', 'Cost'], |
| 29 | data: [['Retail', 2025, 12000, 7000], ['Retail', 2026, 15000, 8500], |
| 30 | ['Online', 2025, 18000, 11000], ['Online', 2026, 24000, 14000]], |
| 31 | options: {chart: 'column', chartoptions: {}, dataoptions: [], filteroptions: {}}, |
| 32 | ...fixture, |
| 33 | }; |
| 34 | window.mappingBefore = JSON.stringify(OCA.Analytics.currentReportData); |
| 35 | window.mappingChartCount = Object.keys(Chart.instances).length; |
| 36 | OCA.Analytics.Filter.openChartOptionsDialog(); |
| 37 | }, fixture); |
| 38 | await page.locator('.analyticsEnhancedDialogNavButton').filter({hasText: 'Data & series'}).click(); |
| 39 | if (fixture.data?.length === 0) { |
| 40 | await page.locator('#chartColumnPreviewMessage').filter({hasText:'No data'}).waitFor(); |
| 41 | } else { |
| 42 | await waitPreview(); |
| 43 | } |
| 44 | }; |
| 45 | try { |
| 46 | await ensureAnalyticsLoaded(page, config); |
| 47 | await open(); |
no test coverage detected