From 2f2950eb29178cee9095cc11ce7ff436ed1195ae Mon Sep 17 00:00:00 2001 From: Ihor Yeromin Date: Mon, 8 Sep 2025 17:52:10 +0200 Subject: [PATCH] Tests: Move Canvas tests to panel folder and add testing README (#110768) * chore(e2e-tests): move canvas tests to panels --- .github/CODEOWNERS | 2 ++ e2e-playwright/dashboards/README.md | 9 +++++++++ .../panels-suite}/canvas-scene.spec.ts | 16 ++++++++-------- 3 files changed, 19 insertions(+), 8 deletions(-) create mode 100644 e2e-playwright/dashboards/README.md rename {e2e/plugin-e2e/canvas => e2e-playwright/panels-suite}/canvas-scene.spec.ts (88%) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 23d5b5efb2e..12ba8f3cf58 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -416,6 +416,7 @@ /e2e-playwright/dashboards/cujs/ @grafana/dashboards-squad /e2e-playwright/dashboards/DashboardForConditionalRendering.json @grafana/dashboards-squad /e2e-playwright/dashboards/DashboardWithAllConditionalRendering.json @grafana/dashboards-squad +/e2e-playwright/dashboards/README.md @grafana/dashboards-squad /e2e-playwright/dashboards/AdHocFilterTest.json @grafana/datapro /e2e-playwright/dashboards/DashboardLiveTest.json @grafana/dashboards-squad /e2e-playwright/dashboards/DataLinkWithoutSlugTest.json @grafana/dashboards-squad @@ -460,6 +461,7 @@ /e2e-playwright/fixtures/long-trace-response.json @grafana/observability-traces-and-profiling /e2e-playwright/fixtures/tempo-response.json @grafana/oss-big-tent /e2e-playwright/fixtures/prometheus-response.json @grafana/datapro +/e2e-playwright/panels-suite/canvas-scene.spec.ts @grafana/dataviz-squad /e2e-playwright/panels-suite/dashlist.spec.ts @grafana/grafana-search-navigate-organise /e2e-playwright/panels-suite/datagrid-data-change.spec.ts @grafana/dataviz-squad /e2e-playwright/panels-suite/datagrid-editing-features.spec.ts @grafana/dataviz-squad diff --git a/e2e-playwright/dashboards/README.md b/e2e-playwright/dashboards/README.md new file mode 100644 index 00000000000..060dd6717e3 --- /dev/null +++ b/e2e-playwright/dashboards/README.md @@ -0,0 +1,9 @@ +# Dashboards + +## Adding Dashboard JSONs + +When adding dashboard JSON files to this folder that were exported from Grafana: + +⚠️ **Important:** Don't forget to remove the `"id"` field from the exported JSON before adding it to this folder. + +Exported dashboard JSONs contain an `id` field that should be removed to avoid conflicts when importing the dashboard in tests. diff --git a/e2e/plugin-e2e/canvas/canvas-scene.spec.ts b/e2e-playwright/panels-suite/canvas-scene.spec.ts similarity index 88% rename from e2e/plugin-e2e/canvas/canvas-scene.spec.ts rename to e2e-playwright/panels-suite/canvas-scene.spec.ts index b640f450223..7cd738bc6ba 100644 --- a/e2e/plugin-e2e/canvas/canvas-scene.spec.ts +++ b/e2e-playwright/panels-suite/canvas-scene.spec.ts @@ -43,10 +43,10 @@ test.describe('Canvas Panel - Scene Tests', () => { await expect(viewerBounds).toBeDefined(); // Test pan functionality - const startX = viewerBounds.x + 50; - const startY = viewerBounds.y + 50; - const endX = viewerBounds.x + 250; - const endY = viewerBounds.y + 250; + const startX = viewerBounds!.x + 50; + const startY = viewerBounds!.y + 50; + const endX = viewerBounds!.x + 250; + const endY = viewerBounds!.y + 250; await page.getByTestId('canvas-scene-pan-zoom'); await page.mouse.move(startX, startY); await page.mouse.down({ button: 'middle' }); @@ -79,9 +79,9 @@ async function isOutsideViewport(element: Locator, viewPort: Locator): Promise viewportBounds.x + viewportBounds.width || - elementBounds.y + elementBounds.height < viewportBounds.y || - elementBounds.y > viewportBounds.y + viewportBounds.height + elementBounds!.x + elementBounds!.width < viewportBounds!.x || + elementBounds!.x > viewportBounds!.x + viewportBounds!.width || + elementBounds!.y + elementBounds!.height < viewportBounds!.y || + elementBounds!.y > viewportBounds!.y + viewportBounds!.height ); }