Skip to content

Convert RadialBarChart stories to VR tests#6551

Merged
ckifer merged 2 commits into
mainfrom
radialbar-stories
Nov 2, 2025
Merged

Convert RadialBarChart stories to VR tests#6551
ckifer merged 2 commits into
mainfrom
radialbar-stories

Conversation

@PavelVanecek

@PavelVanecek PavelVanecek commented Nov 1, 2025

Copy link
Copy Markdown
Collaborator

Description

These are valuable as VR tests but they are not great examples so let's keep the screenshots but get rid of the stories. Also brings down the amount of work we send to Chromatic.

Summary by CodeRabbit

  • Tests

    • Added comprehensive visual regression tests for RadialBarChart covering stacked bars, ring variants, axis orientations, reversed axes, angled layouts, and other configuration scenarios to ensure rendering consistency.
  • Chores

    • Streamlined Storybook examples by removing redundant RadialBarChart story variants, keeping a single evolving example to simplify the example catalog.

@coderabbitai

coderabbitai Bot commented Nov 1, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Removed many RadialBarChart Storybook story variants from the stories file and added a comprehensive visual regression (VR) test suite for RadialBarChart covering stacked, rings, axis, reversal, and angled configurations.

Changes

Cohort / File(s) Summary
Storybook story removal
storybook/stories/Examples/RadialBarChart/RadialBarChart.stories.tsx
Deleted 14 exported story variants (StackedRadialBar, RingsWithImplicitAxes, RingsWithDefaultAxes, RingsWithDataKeys, RingsWithTypes, RingsWithDataKeysAndTypes, RingsWithCustomDomain, RingsWithRadiusAxisVertically, ReversedAngleAxis, ReversedRadiusAxis, ReversedBothAxes, Angled, ChartReversedByAngles, ChartReversedByBothAnglesAndReverseAxis) and removed StorybookArgs import. Retained RadialBarChartWithChangingDataKey.
VR test suite addition
test-vr/tests/RadialBarChart.spec-vr.tsx
Added comprehensive visual regression tests for RadialBarChart: stacked configuration, multiple rings variants (implicit/default axes, explicit data keys, explicit types, custom domain), axis orientation/positioning tests (radius axis vertical), reversed angle/radius/both axes, angled charts, and snapshot assertions for each scenario.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • New VR tests are numerous but follow repetitive patterns; review needs to ensure snapshots and mounting logic are correct.
  • Pay attention to:
    • test-vr/tests/RadialBarChart.spec-vr.tsx — snapshot baseline correctness and mounting options.
    • storybook/stories/Examples/RadialBarChart/RadialBarChart.stories.tsx — ensure removal didn't drop needed shared helpers or imports.

Suggested reviewers

  • ckifer

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The provided pull request description is largely incomplete when compared against the repository's description template. While the description does provide some motivation and context (explaining that stories are valuable as VR tests but not great examples, and mentioning a reduction in work sent to Chromatic), it is missing several required sections including: a detailed description of changes, a link to a related issue, detailed testing information, and the types of changes and checklist checkboxes. The description reads more as a brief rationale rather than a complete pull request documentation. The author should expand the pull request description to include all template sections: provide a detailed description of the changes made, link to any related issues, document how the changes were tested, specify the types of changes by checking the appropriate boxes, and complete the checklist items at the end. This will ensure the PR documentation is complete and helps reviewers understand the full scope and intent of the work.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (1 passed)
Check name Status Explanation
Title Check ✅ Passed The pull request title "Convert RadialBarChart stories to VR tests" clearly and concisely describes the primary change in the changeset. The raw summary confirms the changeset involves removing multiple Storybook story exports from the RadialBarChart.stories.tsx file while adding comprehensive VR tests to the test-vr/tests/RadialBarChart.spec-vr.tsx file. The title is specific, not vague, and accurately represents the main objective of the change without unnecessary noise.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch radialbar-stories

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5fd1d87 and e8e9f06.

⛔ Files ignored due to path filters (42)
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Angled-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Angled-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Angled-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Angles-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Angles-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Angles-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Both-Angles-And-Reverse-Axis-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Both-Angles-And-Reverse-Axis-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Both-Angles-And-Reverse-Axis-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Angle-Axis-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Angle-Axis-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Angle-Axis-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Both-Axes-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Both-Axes-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Both-Axes-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Radius-Axis-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Radius-Axis-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Reversed-Radius-Axis-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Custom-Domain-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Custom-Domain-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Custom-Domain-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Data-Keys-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Data-Keys-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Data-Keys-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Data-Keys-And-Types-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Data-Keys-And-Types-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Data-Keys-And-Types-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Default-Axes-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Default-Axes-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Default-Axes-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Implicit-Axes-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Implicit-Axes-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Implicit-Axes-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Radius-Axis-Vertically-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Radius-Axis-Vertically-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Radius-Axis-Vertically-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Types-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Types-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Rings-With-Types-1-webkit-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Stacked-RadialBar-Chart-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Stacked-RadialBar-Chart-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Stacked-RadialBar-Chart-1-webkit-linux.png is excluded by !**/*.png
📒 Files selected for processing (2)
  • storybook/stories/Examples/RadialBarChart/RadialBarChart.stories.tsx (0 hunks)
  • test-vr/tests/RadialBarChart.spec-vr.tsx (1 hunks)
💤 Files with no reviewable changes (1)
  • storybook/stories/Examples/RadialBarChart/RadialBarChart.stories.tsx
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-10-25T07:34:46.558Z
Learning: Applies to storybook/** : Use Storybook for high-fidelity examples intended for publication; prefer unit or VR tests for low-fidelity cases due to Chromatic limits
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : Mock getBoundingClientRect using test/helper/MockGetBoundingClientRect.ts when rendering Recharts components (e.g., Tooltip, Legend, charts)

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:36:02.229Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-25T07:36:02.229Z
Learning: Recharts aims for simple, declarative, and composable charts; prioritize consistency, usability, performance, and accessibility

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:34:46.558Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-10-25T07:34:46.558Z
Learning: Applies to test-vr/__snapshots__/** : Commit newly recorded or updated visual regression snapshot files under test-vr/__snapshots__ to the repository

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:34:46.558Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-10-25T07:34:46.558Z
Learning: Applies to storybook/** : Use Storybook for high-fidelity examples intended for publication; prefer unit or VR tests for low-fidelity cases due to Chromatic limits

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : When testing selectors, verify render counts using the spy and rerenderSameComponent from createSelectorTestCase

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build, Test, Pack
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
test-vr/tests/RadialBarChart.spec-vr.tsx (4)

1-5: LGTM!

The imports are appropriate for VR tests. Using RechartsHookInspector and pageData from the storybook directory is reasonable for visual regression testing.


7-20: LGTM!

The stacked RadialBar test configuration is comprehensive, testing multiple RadialBar components with the same stackId, along with Legend, PolarGrid, axes, and a styled Tooltip cursor.


22-55: LGTM!

The LOTR-themed test data is creative and provides good variety for testing different RadialBarChart configurations. The data structure (name, rings, fill) supports all the test scenarios below.


57-235: LGTM!

The test suite provides excellent coverage of RadialBarChart configurations, progressively testing:

  • Implicit and explicit axes
  • Data keys and types
  • Custom domains
  • Axis orientations and reversals
  • Angle-based chart variations

The tests are well-organized and comprehensive.

Comment thread test-vr/tests/RadialBarChart.spec-vr.tsx
@codecov

codecov Bot commented Nov 1, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.62%. Comparing base (5fd1d87) to head (2e4ddd6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6551   +/-   ##
=======================================
  Coverage   91.62%   91.62%           
=======================================
  Files         483      483           
  Lines       40267    40267           
  Branches     4568     4568           
=======================================
  Hits        36896    36896           
  Misses       3355     3355           
  Partials       16       16           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codecov

codecov Bot commented Nov 1, 2025

Copy link
Copy Markdown

Bundle Report

Bundle size has no change ✅

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
test-vr/tests/RadialBarChart.spec-vr.tsx (1)

34-55: Consider importing ringsData from test/_data.ts.

The ringsData constant is duplicated from test/_data.ts (lines 273-294). While the LOTR comment adds nice context, you could reduce duplication by importing the data and adding the comment separately.

If you prefer to keep the data local for test readability, that's reasonable too.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e8e9f06 and 2e4ddd6.

⛔ Files ignored due to path filters (3)
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Both-Angles-And-Reverse-Axis-1-chromium-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Both-Angles-And-Reverse-Axis-1-firefox-linux.png is excluded by !**/*.png
  • test-vr/__snapshots__/tests/RadialBarChart.spec-vr.tsx-snapshots/Chart-Reversed-By-Both-Angles-And-Reverse-Axis-1-webkit-linux.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • test-vr/tests/RadialBarChart.spec-vr.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-10-25T07:34:46.558Z
Learning: Applies to storybook/** : Use Storybook for high-fidelity examples intended for publication; prefer unit or VR tests for low-fidelity cases due to Chromatic limits
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : Mock getBoundingClientRect using test/helper/MockGetBoundingClientRect.ts when rendering Recharts components (e.g., Tooltip, Legend, charts)

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:34:46.558Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-10-25T07:34:46.558Z
Learning: Applies to test-vr/__snapshots__/** : Commit newly recorded or updated visual regression snapshot files under test-vr/__snapshots__ to the repository

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:36:02.229Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-10-25T07:36:02.229Z
Learning: Recharts aims for simple, declarative, and composable charts; prioritize consistency, usability, performance, and accessibility

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:34:46.558Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: DEVELOPING.md:0-0
Timestamp: 2025-10-25T07:34:46.558Z
Learning: Applies to storybook/** : Use Storybook for high-fidelity examples intended for publication; prefer unit or VR tests for low-fidelity cases due to Chromatic limits

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
📚 Learning: 2025-10-25T07:35:46.188Z
Learnt from: CR
Repo: recharts/recharts PR: 0
File: test/README.md:0-0
Timestamp: 2025-10-25T07:35:46.188Z
Learning: Applies to test/**/*.test.{ts,tsx} : When testing selectors, verify render counts using the spy and rerenderSameComponent from createSelectorTestCase

Applied to files:

  • test-vr/tests/RadialBarChart.spec-vr.tsx
🧬 Code graph analysis (1)
test-vr/tests/RadialBarChart.spec-vr.tsx (2)
storybook/stories/data/Page.ts (1)
  • pageData (259-259)
test/_data.ts (1)
  • ringsData (274-295)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build, Test, Pack
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (4)
test-vr/tests/RadialBarChart.spec-vr.tsx (4)

1-5: LGTM! Imports are appropriate for VR tests.

The imports correctly include Playwright CT utilities, Recharts components, and test data sources.


7-20: Well-structured VR test for stacked radial bars.

The test correctly configures stacked RadialBar components and validates the visual output.


57-220: Excellent progressive test coverage of axis configurations.

The test suite systematically covers implicit axes, explicit axes, data keys, types, custom domains, orientations, and reversals. Each test validates a distinct configuration without duplication.


222-250: Previous critical issue resolved - tests now correctly differentiate angle vs. axis reversal.

The "Chart Reversed By Both Angles And Reverse Axis" test (lines 237-250) now correctly includes reversed props on both PolarAngleAxis (line 243) and PolarRadiusAxis (line 244), distinguishing it from the "Chart Reversed By Angles" test (lines 222-235) which only uses reversed angles without the reversed props. This properly validates both reversal mechanisms.

@ckifer
ckifer merged commit e0e64f5 into main Nov 2, 2025
27 of 29 checks passed
@ckifer
ckifer deleted the radialbar-stories branch November 2, 2025 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants