Skip to content

test(charts): E2E render + interaction for Pie, Map, Graph widgets (#486) - #518

Merged
alfredo1996 merged 1 commit into
release/1.1from
test/issue-486-heavy-widgets
Apr 12, 2026
Merged

test(charts): E2E render + interaction for Pie, Map, Graph widgets (#486)#518
alfredo1996 merged 1 commit into
release/1.1from
test/issue-486-heavy-widgets

Conversation

@alfredo1996

@alfredo1996 alfredo1996 commented Apr 12, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add heavy-widgets.spec.ts with 7 E2E tests covering the three lazy-loaded widget types
  • Pie: canvas render, add to dashboard, scalar error state
  • Map: Leaflet container + tile rendering, zoom in/out controls, scalar error state
  • Graph: NVL toolbar ("Fit graph" button), interaction test, scalar error state
  • All tests use createTestDashboard() with cleanup

Closes #486

Test plan

  • npx playwright test heavy-widgets — 7/7 passing
  • CI green on full E2E suite

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Tests
    • Added end-to-end tests for heavy rendering of Pie, Map, and Graph widgets to validate display and interaction behavior.

…ph widgets (#486)

Add heavy-widgets.spec.ts with 7 tests covering lazy-loaded widget
types: Pie canvas render + dashboard add, Map Leaflet container +
zoom controls, Graph NVL toolbar + Fit graph interaction, and
incompatible data format error states for all three.

Closes #486

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@alfredo1996 alfredo1996 added enhancement New feature or request pkg:app Next.js application package area:charts Chart rendering testing labels Apr 12, 2026
@coderabbitai

coderabbitai Bot commented Apr 12, 2026

Copy link
Copy Markdown

Walkthrough

Adds a comprehensive end-to-end test suite for Pie, Map, and Graph widgets that verifies canvas/Leaflet/node-link rendering, user interactions (query execution, zoom controls), and error states when queries return incompatible data formats.

Changes

Cohort / File(s) Summary
E2E Tests for Heavy Widgets
app/e2e/heavy-widgets.spec.ts
Introduces test cases for three widget types (Pie, Map, Graph) covering: widget creation flow via dialog, query execution with Cypher editor, preview/dashboard rendering validation, interaction testing (zoom controls, fit graph), and error-state assertions for scalar query incompatibility.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed Title accurately summarizes the main change: adding E2E tests for Pie, Map, and Graph widget rendering and interactions.
Linked Issues check ✅ Passed Code changes implement all acceptance criteria from #486: dynamic import validation, render tests for three widget types, interaction tests, and error-state coverage.
Out of Scope Changes check ✅ Passed All changes are scoped to the new heavy-widgets.spec.ts test file and directly address requirements from #486 with no unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/issue-486-heavy-widgets

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@app/e2e/heavy-widgets.spec.ts`:
- Around line 107-113: The test currently only checks that the Leaflet container
and overlay svg are visible; update the assertion to verify the actual markers
for the 5 returned points by adding an assertion against the rendered marker
primitives (e.g., count of elements matching the marker selector) from the
preview returned by getPreview(dialog): locate either ".leaflet-marker-icon"
(for default Leaflet icons) or the SVG marker primitives inside
".leaflet-overlay-pane svg" (e.g., "circle" or ".marker" elements) and assert
their count equals 5 with an appropriate timeout, keeping the existing preview
and locator usage.
- Around line 215-224: The test currently only verifies toolbar visibility by
locating the "Fit graph" button (fitBtn) and clicking it, which doesn't assert
that nodes/edges rendered or pan/zoom/styling work; update the
heavy-widgets.spec.ts test to explicitly check graph rendering and interactions:
after getPreview(dialog) and ensuring preview visible, locate the graph
canvas/SVG element (e.g., query for NVL graph container or role), assert that a
minimum number of node and edge DOM elements are present, verify styling by
checking a node/edge has the expected CSS class or computed style, and assert
pan/zoom by performing a drag or wheel event on the graph element and confirming
node positions change (or transform attribute updates); keep the existing fitBtn
click but add these explicit assertions around getPreview, the graph container,
and node/edge selectors to satisfy the PR acceptance criteria.
- Around line 147-155: The test currently exercises only zoom controls (using
zoomIn/zoomOut) but must also perform a pan; add a drag interaction against the
map surface (use the existing mapContainer locator or
preview.locator('.leaflet-container') to perform a mouse drag/locator.dragTo) to
simulate panning, then assert the map still renders (e.g. await
expect(mapContainer).toBeVisible() or another existing post-pan assertion) to
prove the map remains functional after the pan.
- Around line 50-52: The test currently only checks that the canvas mounted via
getPreview(dialog) and preview.locator("canvas"), but must also assert the
actual Pie output; update the test that uses getPreview(dialog) to add
assertions that the rendered Pie has the expected number of slices and that the
legend items are visible (use preview.locator(...) with selectors targeting the
pie slice elements and legend entries and assert .toHaveCount(expectedCount) and
.toBeVisible() accordingly). Ensure you reference preview.locator for both the
slice selector and the legend selector so the test fails if the Pie renders
wrong series or hides the legend.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8849c04d-9e78-4820-a1d1-a251fa7d7bc5

📥 Commits

Reviewing files that changed from the base of the PR and between 6d853de and 4ee3902.

📒 Files selected for processing (1)
  • app/e2e/heavy-widgets.spec.ts

Comment on lines +50 to +52
const preview = getPreview(dialog);
await expect(preview.locator("canvas")).toBeVisible({ timeout: 15_000 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Assert Pie output, not just canvas mount.

A visible canvas only proves the widget mounted. It does not cover the acceptance criteria for correct slice count and legend visibility, so this can still pass when Pie renders the wrong series data.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/e2e/heavy-widgets.spec.ts` around lines 50 - 52, The test currently only
checks that the canvas mounted via getPreview(dialog) and
preview.locator("canvas"), but must also assert the actual Pie output; update
the test that uses getPreview(dialog) to add assertions that the rendered Pie
has the expected number of slices and that the legend items are visible (use
preview.locator(...) with selectors targeting the pie slice elements and legend
entries and assert .toHaveCount(expectedCount) and .toBeVisible() accordingly).
Ensure you reference preview.locator for both the slice selector and the legend
selector so the test fails if the Pie renders wrong series or hides the legend.

Comment on lines +107 to +113
const preview = getPreview(dialog);
await expect(preview.locator(".leaflet-container")).toBeVisible({
timeout: 15_000,
});
await expect(
preview.locator(".leaflet-overlay-pane svg").first(),
).toBeVisible({ timeout: 10_000 });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Verify plotted markers, not only the Leaflet shell.

.leaflet-container and an overlay svg can exist even if the lat/lng rows were not turned into map markers correctly. Please add an assertion on rendered marker primitives/count for the 5 returned points.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/e2e/heavy-widgets.spec.ts` around lines 107 - 113, The test currently
only checks that the Leaflet container and overlay svg are visible; update the
assertion to verify the actual markers for the 5 returned points by adding an
assertion against the rendered marker primitives (e.g., count of elements
matching the marker selector) from the preview returned by getPreview(dialog):
locate either ".leaflet-marker-icon" (for default Leaflet icons) or the SVG
marker primitives inside ".leaflet-overlay-pane svg" (e.g., "circle" or
".marker" elements) and assert their count equals 5 with an appropriate timeout,
keeping the existing preview and locator usage.

Comment on lines +147 to +155
// Zoom in and out via Leaflet controls — should not crash
const zoomIn = preview.locator(".leaflet-control-zoom-in");
await expect(zoomIn).toBeVisible({ timeout: 5_000 });
await zoomIn.click();
await expect(mapContainer).toBeVisible();

const zoomOut = preview.locator(".leaflet-control-zoom-out");
await zoomOut.click();
await expect(mapContainer).toBeVisible();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

This only tests zoom, not pan.

The test name and linked objective call out pan/zoom, but this segment only clicks zoom controls. Add a drag interaction on the map surface and assert the map remains functional after the pan.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/e2e/heavy-widgets.spec.ts` around lines 147 - 155, The test currently
exercises only zoom controls (using zoomIn/zoomOut) but must also perform a pan;
add a drag interaction against the map surface (use the existing mapContainer
locator or preview.locator('.leaflet-container') to perform a mouse
drag/locator.dragTo) to simulate panning, then assert the map still renders
(e.g. await expect(mapContainer).toBeVisible() or another existing post-pan
assertion) to prove the map remains functional after the pan.

Comment on lines +215 to +224
const preview = getPreview(dialog);
await expect(preview).toBeVisible({ timeout: 15_000 });

// Graph toolbar proves NVL rendered successfully
const fitBtn = dialog.getByRole("button", { name: "Fit graph" });
await expect(fitBtn).toBeVisible({ timeout: 10_000 });

// Click Fit graph — should not crash
await fitBtn.click();
await expect(dialog.getByText("Query Failed")).not.toBeVisible();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Toolbar visibility is too weak for Graph coverage.

Fit graph proves the NVL UI mounted, but not that nodes and edges rendered, pan/zoom works, or styling rules apply. Those are explicit acceptance criteria for this PR, so the main Graph regression surface is still untested here.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@app/e2e/heavy-widgets.spec.ts` around lines 215 - 224, The test currently
only verifies toolbar visibility by locating the "Fit graph" button (fitBtn) and
clicking it, which doesn't assert that nodes/edges rendered or pan/zoom/styling
work; update the heavy-widgets.spec.ts test to explicitly check graph rendering
and interactions: after getPreview(dialog) and ensuring preview visible, locate
the graph canvas/SVG element (e.g., query for NVL graph container or role),
assert that a minimum number of node and edge DOM elements are present, verify
styling by checking a node/edge has the expected CSS class or computed style,
and assert pan/zoom by performing a drag or wheel event on the graph element and
confirming node positions change (or transform attribute updates); keep the
existing fitBtn click but add these explicit assertions around getPreview, the
graph container, and node/edge selectors to satisfy the PR acceptance criteria.

@sonarqubecloud

Copy link
Copy Markdown

@alfredo1996
alfredo1996 merged commit ae77aa2 into release/1.1 Apr 12, 2026
13 checks passed
@alfredo1996
alfredo1996 deleted the test/issue-486-heavy-widgets branch April 12, 2026 17:37
alfredo1996 added a commit that referenced this pull request May 10, 2026
…ph widgets (#486) (#518)

Add heavy-widgets.spec.ts with 7 tests covering lazy-loaded widget
types: Pie canvas render + dashboard add, Map Leaflet container +
zoom controls, Graph NVL toolbar + Fit graph interaction, and
incompatible data format error states for all three.

Closes #486

Co-authored-by: alfredorubin96 <alfredo.rubin@neotechnology.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:charts Chart rendering enhancement New feature or request pkg:app Next.js application package testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants