Repository navigation
test(dashboard): migrate dashboard load smoke test to Playwright - #41432
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41432 +/- ##
==========================================
+ Coverage 65.15% 65.39% +0.24%
==========================================
Files 2789 2754 -35
Lines 157546 154213 -3333
Branches 35864 35403 -461
==========================================
- Hits 102648 100849 -1799
+ Misses 52929 51455 -1474
+ Partials 1969 1909 -60
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
c4d54af to
af20b73
Compare
Migrates the genuine end-to-end case from the legacy Cypress "Dashboard load" suite. Builds a multi-chart dashboard via the API, loads it, and asserts every chart renders by issuing real /api/v1/chart/data queries that all return 200. The remaining legacy cases (edit/standalone URL-param rendering, send-log-data) only assert DOM/URL state with no backend round-trip and are better served by component/RTL coverage, so they are not migrated here. Adds DashboardPage.waitForAllChartsRendered(), which derives the chart set from the dashboard and waits on each chart's render marker (the same signal the legacy Cypress waitForChartLoad relied on). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the local findDatasetIdByName(page: any) with the existing typed getDatasetByName(page: Page) helper, which routes through the retry-wrapped apiGet path and avoids a new any. Addresses review feedback. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
- Use typed apiPostChart/apiPutChart instead of raw apiPost/apiPut - Collapse the special-cased chart-association loop into one loop - Guard chart id (result?.id ?? id) and the data-test-chart-id attribute against undefined for a clear failure instead of a #chart-id-undefined timeout - Match meta.sliceName to each chart's real slice_name - Parallel-safe chart/dashboard names via Date.now()_parallelIndex Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
… in load spec Address round-2 review feedback on the dashboard-load Playwright migration: - Render proof: wait on each expected `#chart-id-<id>` (the ChartRenderer render marker) instead of snapshotting holder count after the first holder attaches. A chart that never renders now times out and fails the test rather than passing on a partial count. - Query proof: collect chart-data POSTs keyed by the slice_id encoded in the `form_data` query param, then assert every expected chart issued a 200 — not just that one chart-data request succeeded. - Reuse `extractIdFromResponse` for both chart and dashboard creation instead of re-implementing the `result?.id ?? id` normalization twice. - Extract the ROOT/GRID/ROW/CHART position_json scaffold into a typed `buildDashboardPositionJson` helper in dashboard-test-helpers.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
4062c95 to
e9e489b
Compare
Address review feedback on the dashboard load spec: - Replace the #chart-id-<id> visibility wait, which false-passes when a plugin fails to load (SuperChartCore emits the id container up front and mounts the viz lazily inside it) and false-fails valid no-results charts (SuperChart renders EmptyState as a fragment that never receives the id). DashboardPage.getChartRenderState now resolves rendered/no-results/failed from each outcome's actual markup, ruling out the failed and empty markers before testing #chart-id-<id> for content — EmptyState's svg is inlined by @svgr/webpack, so an empty chart would otherwise read as rendered. The check is viz-type agnostic: big_number_total paints text, not a canvas. - Accept 200 or 202 for /api/v1/chart/data: with GLOBAL_ASYNC_QUERIES a cold-cache query legitimately returns 202 and delivers its result out of band, so the render assertion is what proves the data arrived. - Keep the single-row position_json builder local to the spec and make it throw on grid overflow instead of hoisting a parallel layout helper; restores dashboard-test-helpers.ts to its prior state. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
| const chartKeys = charts.map(chart => `CHART-${chart.id}`); | ||
| const positionJson: DashboardPositionJson = { | ||
| ...emptyLayout, | ||
| [DASHBOARD_GRID_ID]: { | ||
| ...emptyLayout[DASHBOARD_GRID_ID], | ||
| children: [DASHBOARD_ROW_ID], | ||
| }, | ||
| [DASHBOARD_ROW_ID]: { | ||
| type: ROW_TYPE, | ||
| id: DASHBOARD_ROW_ID, | ||
| children: chartKeys, | ||
| parents: [DASHBOARD_ROOT_ID, DASHBOARD_GRID_ID], | ||
| meta: { background: BACKGROUND_TRANSPARENT }, | ||
| }, | ||
| }; | ||
|
|
||
| charts.forEach(chart => { | ||
| const chartKey = `CHART-${chart.id}`; | ||
| positionJson[chartKey] = { | ||
| type: CHART_TYPE, | ||
| id: chartKey, |
There was a problem hiding this comment.
Suggestion: The layout component key is derived only from the chart ID, so passing the same chart more than once creates duplicate children entries pointing to a single object key that gets overwritten; this produces an inconsistent layout and prevents rendering duplicated chart instances. Generate a unique component ID per placement (for example by index or nonce) while keeping meta.chartId as the actual chart reference. [logic error]
Severity Level: Major ⚠️
- ⚠️ Playwright-created dashboards cannot reuse same chart multiple times.
- ⚠️ Duplicate chart placements share layout config, losing per-instance sizing.
- ⚠️ Future tests using repeated charts see unexpected rendering behavior.Steps of Reproduction ✅
1. In `superset-frontend/playwright/helpers/api/dashboard.ts:85-133`, call
`buildSingleRowDashboardLayout()` with a `charts` array that includes the same
`DashboardLayoutChart.id` value more than once (e.g., two entries both with `id: 42` but
different `width`).
2. At line 100, `const chartKeys = charts.map(chart => `CHART-${chart.id}`);` produces
duplicate keys, e.g. `["CHART-42", "CHART-42"]`, which are then assigned as the `children`
of `DASHBOARD_ROW_ID` at lines 101-114.
3. In the `charts.forEach` loop at lines 116-130, both placements use the same `chartKey`
(`"CHART-42"`), so `positionJson[chartKey]` is assigned twice, and the first placement’s
layout meta (including `width`, `height`, or `sliceName`) is overwritten by the last.
4. Any caller that uses this `positionJson` as a dashboard `position_json` payload (e.g.,
via `apiPostDashboard` starting at line 141 in the same file) cannot represent multiple
distinct placements of the same chart: all repeated children reference a single layout
node, so per-instance configuration is lost and repeated charts cannot be modeled
correctly.(Use Cmd/Ctrl + Click for best experience)
Prompt for AI Agent 🤖
This is a comment left during a code review.
**Path:** superset-frontend/playwright/helpers/api/dashboard.ts
**Line:** 100:120
**Comment:**
*Logic Error: The layout component key is derived only from the chart ID, so passing the same chart more than once creates duplicate `children` entries pointing to a single object key that gets overwritten; this produces an inconsistent layout and prevents rendering duplicated chart instances. Generate a unique component ID per placement (for example by index or nonce) while keeping `meta.chartId` as the actual chart reference.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix|
The flagged issue is correct. Because To resolve this, you should generate a unique key for each placement by incorporating the index. Here is the corrected implementation for the const chartKeys = charts.map((chart, index) => `CHART-${chart.id}-${index}`);
const positionJson: DashboardPositionJson = {
...emptyLayout,
[DASHBOARD_GRID_ID]: {
...emptyLayout[DASHBOARD_GRID_ID],
children: [DASHBOARD_ROW_ID],
},
[DASHBOARD_ROW_ID]: {
type: ROW_TYPE,
id: DASHBOARD_ROW_ID,
children: chartKeys,
parents: [DASHBOARD_ROOT_ID, DASHBOARD_GRID_ID],
meta: { background: BACKGROUND_TRANSPARENT },
},
};
charts.forEach((chart, index) => {
const chartKey = `CHART-${chart.id}-${index}`;
positionJson[chartKey] = {
type: CHART_TYPE,
id: chartKey,
children: [],
parents: [DASHBOARD_ROOT_ID, DASHBOARD_GRID_ID, DASHBOARD_ROW_ID],
meta: {
chartId: chart.id,
width: chart.width ?? GRID_DEFAULT_CHART_WIDTH,
height: chart.height ?? DEFAULT_CHART_HEIGHT,
sliceName: chart.sliceName,
},
};
});Would you like me to check the rest of the comments on this PR and implement fixes for them as well? superset-frontend/playwright/helpers/api/dashboard.ts |
Code Review Agent Run #4cfc77Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Code Review Agent Run #2d67f4Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
rusackas
left a comment
There was a problem hiding this comment.
Thanks @sadpandajoe, LGTM. Nice to see those hand-rolled position_json blobs collapse into one shared helper.
There's a Codeant thread above to assess/address/resolve if you don't mind. Leaving the merge to you whenever you're ready :)
…che#41432) Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
* refactor(mcp): dedupe list-tool schemas and delete dead middleware (apache#41923) * fix(ag-grid-table): respect row limit with server pagination (apache#41346) Co-authored-by: Claude Opus 4.8 <[email protected]> * feat(table/pivot-table): correct non-additive totals/subtotals via DB rollup [SIP-216] (apache#41184) Co-authored-by: Superset Dev <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Amin Ghadersohi <[email protected]> * feat(datasets): add RLS filter indicator badge to dataset list and explore view (apache#38807) Co-authored-by: Evan <[email protected]> * fix(chart): updates counties of kenya map (apache#38019) Co-authored-by: Zack Adams <[email protected]> Co-authored-by: Claude Sonnet 4.6 <[email protected]> Co-authored-by: Evan <[email protected]> Co-authored-by: Evan Rusackas <[email protected]> * chore(deps): bump actions/setup-go from 6.5.0 to 7.0.0 (apache#42303) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump nanoid from 5.0.9 to 6.0.0 in /superset-frontend (apache#42230) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: hainenber <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hainenber <[email protected]> Co-authored-by: Joe Li <[email protected]> Co-authored-by: Evan <[email protected]> Co-authored-by: Claude Sonnet 5 <[email protected]> * test(dashboard): migrate dashboard load smoke test to Playwright (apache#41432) Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]> * fix(superset_app_root): when used with oauth (apache#38033) Signed-off-by: Grégoire Bellon-Gervais <[email protected]> Co-authored-by: Evan Rusackas <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> * refactor: engine enforce SQLAlchemy 2.0 (apache#42277) * fix(ag-grid-table): avoid ambiguous build query import (apache#42313) * fix: Revert "chore(deps): bump echarts from 5.6.0 to 6.1.0 in /superset-frontend" (apache#42314) Co-authored-by: Claude Opus 4.8 <[email protected]> * adding circleci config * fix(plugin-chart-echarts): import the -obj locale build so time axes render (apache#42317) Co-authored-by: Claude Opus 4.8 <[email protected]> * fix(pandas_postprocessing): avoid FutureWarning for max/min in boxplot MINMAX (apache#42272) * fix(heatmap): correct tooltip axis value lookup and percentage calculations and add tests (apache#41864) Signed-off-by: yousoph <[email protected]> Co-authored-by: Kamil Gabryjelski <[email protected]> Co-authored-by: Claude Opus 4.6 <[email protected]> * fix(forecast): resolve time grain robustly for Prophet forecasting (apache#42145) Co-authored-by: Claude Opus 4.8 <[email protected]> * fix: Added PostgreSQL 17.X to the supported database versions table in (apache#42280) * fix(helm): add MCP HTTPRoute configuration (apache#42219) * fix(dashboard): offer Exit edit mode when there is nothing to discard (apache#42208) Co-authored-by: Claude Code <[email protected]> * chore(deps): bump actions/labeler from 6.2.0 to 7.0.0 (apache#42332) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump github/codeql-action/analyze from 4.37.0 to 4.37.1 (apache#42331) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump github/codeql-action/init from 4.37.0 to 4.37.1 (apache#42334) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump @formatjs/intl-durationformat from 0.10.17 to 0.10.18 in /superset-frontend (apache#42337) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump caniuse-lite from 1.0.30001805 to 1.0.30001806 in /docs (apache#42333) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump echarts to 6.1.0 with locale and containLabel guards (apache#42315) (apache#42321) Co-authored-by: Claude Code <[email protected]> Co-authored-by: Amin Ghadersohi <[email protected]> * docs: add pattern to the list of organisations using superset (apache#42341) * chore(deps): bump ag-grid from 36.0.0 to 36.0.1 in /superset-frontend (apache#42338) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: hainenber <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hainenber <[email protected]> * fix(mcp): trust dataset is_dttm flag when applying time_grain to VARCHAR temporal columns (apache#42288) * chore(deps-dev): update taos-ws-py requirement from >=0.6.9 to >=0.7.0 (apache#42344) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump the storybook group in /superset-frontend with 5 updates (apache#42355) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(native-filters): keep filter value input caret at inline start (apache#42323) Co-authored-by: Claude Opus 4.8 <[email protected]> * fix(mcp): truncate query-tool responses instead of hard-failing (apache#42244) * chore(deps): bump nh3 from 0.3.5 to 0.3.6 (apache#42349) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joe Li <[email protected]> * chore(deps): bump pydantic from 2.11.7 to 2.13.4 (apache#42350) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joe Li <[email protected]> * chore(deps): bump sqlalchemy-continuum from 1.6.0 to 1.7.0 (apache#42351) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joe Li <[email protected]> * fix(embedded): stop rejecting guest chart data built from control-specific params keys (apache#42295) Co-authored-by: Claude Code <[email protected]> * fix(explore): show the beginning date on time-series x-axis line charts (apache#42046) * fix(api): add example to get_export_ids_schema so Swagger "Try it out" pre-fills a valid array (apache#42265) * chore: SQLAlchemy User cascade backref warnings are irrelevant (apache#42360) * fix(charts): handle async (202) chart-data responses in StatefulChart (apache#42157) Co-authored-by: Claude Sonnet 4.5 <[email protected]> Co-authored-by: Evan Rusackas <[email protected]> * feat(KustoKQL): Add support for NULL / IS NOT NULL operator (apache#37890) Co-authored-by: ag-ramachandran <[email protected]> Co-authored-by: Joe Li <[email protected]> * chore(deps): bump pillow from 12.2.0 to 12.3.0 (apache#42348) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joe Li <[email protected]> * chore(deps): bump flask-compress from 1.17 to 1.24 (apache#42346) Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Joe Li <[email protected]> * chore(deps-dev): bump databricks-sql-connector from 4.2.6 to 4.3.0 (apache#42347) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Joe Li <[email protected]> Co-authored-by: Evan Rusackas <[email protected]> * fix(native-filters): use FILTER_STATE_CACHE_CONFIG timeout for dynamic filter option queries (apache#38910) * fix(explore): render Jinja before validating legacy chart filters (apache#41996) * fix(dataset): disable duplicate button when name is empty (apache#42217) Co-authored-by: AS-MAC-1123 <[email protected]> Co-authored-by: Evan Rusackas <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]> * docs(gunicorn): correct dead links in values.yaml (apache#42385) * chore(deps): bump @deck.gl/mapbox from 9.3.6 to 9.3.7 in /superset-frontend in the deckgl group (apache#42377) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump actions/checkout from 7.0.0 to 7.0.1 (apache#42376) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump immer from 11.1.11 to 11.1.15 in /superset-frontend (apache#42378) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps): bump body-parser from 1.20.5 to 1.20.6 in /docs (apache#42370) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * chore(deps-dev): bump brace-expansion from 1.1.15 to 1.1.16 in /superset-embedded-sdk (apache#42369) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix(security): bump pyasn1 from 0.6.3 to 0.6.4 (apache#42363) * fix(security): bump pillow from 12.2.0 to 12.3.0 (apache#42362) * docs(map-tiles): add Yandex Maps Tiles API configuration (apache#42375) * ci: improve conditional checks for lillio tests and build --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: hainenber <[email protected]> Signed-off-by: Grégoire Bellon-Gervais <[email protected]> Signed-off-by: yousoph <[email protected]> Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Amin Ghadersohi <[email protected]> Co-authored-by: Evan Rusackas <[email protected]> Co-authored-by: Claude Opus 4.8 <[email protected]> Co-authored-by: Superset Dev <[email protected]> Co-authored-by: SkinnyPigeon <[email protected]> Co-authored-by: Zack <[email protected]> Co-authored-by: Zack Adams <[email protected]> Co-authored-by: Evan Rusackas <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: hainenber <[email protected]> Co-authored-by: Joe Li <[email protected]> Co-authored-by: Grégoire <[email protected]> Co-authored-by: Hans Yu <[email protected]> Co-authored-by: Elizabeth Thompson <[email protected]> Co-authored-by: yousoph <[email protected]> Co-authored-by: Kamil Gabryjelski <[email protected]> Co-authored-by: Amitesh Gupta <[email protected]> Co-authored-by: David <[email protected]> Co-authored-by: Yash Shrivastava <[email protected]> Co-authored-by: JUST.in DO IT <[email protected]> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: jesperct <[email protected]> Co-authored-by: Abdul Rehman <[email protected]> Co-authored-by: jenwitteng <[email protected]> Co-authored-by: Ramachandran A G <[email protected]> Co-authored-by: ag-ramachandran <[email protected]> Co-authored-by: Ujjwal Jain <[email protected]> Co-authored-by: Jean Massucatto <[email protected]> Co-authored-by: suvankardas216 <[email protected]> Co-authored-by: AS-MAC-1123 <[email protected]> Co-authored-by: Alejandro Solares <[email protected]> Co-authored-by: ViktorGo86 <[email protected]>
SUMMARY
Migrates the genuine end-to-end case from the legacy Cypress Dashboard load suite (
dashboard/load.test.ts) to the existing Playwright framework, as part of the dashboard Cypress→Playwright migration.The original suite had five cases. Only "should load dashboard" is a true E2E test — it loads a multi-chart dashboard and proves the charts render via real backend queries. The other four (
should load in edit mode,should load in standalone mode,should load in edit/standalone mode,should send log data) only assert DOM/URL state from URL params (?edit=true&standalone=true) or intercept a log request — there is no data round-trip to make them E2E. They belong in component/RTL coverage and are intentionally not migrated here.Design decisions:
testWithAssetsfixture) rather than relying on a seeded example, so the test is hermetic, self-cleaning, and deterministic.POST /api/v1/chart/dataresponse and accepts 200 or 202; 202 is valid when asynchronous queries are enabled.buildSingleRowDashboardLayout()andDashboardPage.getChart()helpers, and replaces duplicated inline layout fixtures in related Playwright specs.TESTING INSTRUCTIONS
ADDITIONAL INFORMATION