Problem
The gravity-charts visual regression tests are flaky in CI (toMatchScreenshot mismatch) — they pass on fast machines / some CI runs and fail on others:
src/plugins/gravity-charts/__tests__/Base.visual.test.tsx → "should render chart with valid data"
src/plugins/gravity-charts/__tests__/SplitTooltip.visual.test.tsx → "should render tooltip in album orientation" / "should render tooltip in portrait orientation"
Root cause (test timing)
The tests call await render(<ChartTestStory .../>) and immediately toMatchScreenshot(), but @gravity-ui/charts renders asynchronously. On slower/loaded CI runners the screenshot captures a blank/partial canvas.
Evidence:
Related product bug (reflow in withSplitPane)
While regenerating baselines, a real regression surfaced: in the HORIZONTAL split (portrait) the initial hover highlight on the split tooltip is lost. withSplitPane seeds data.defaultState.hoveredPosition to show an initial tooltip, but gravity-charts applies defaultState only once per mount. When the tooltip appears, the chart-pane resize calls chartRef.reflow({immediate: true}), which re-renders the chart and drops that one-shot highlight — desyncing the chart from the still-shown tooltip. (VERTICAL/album split has no such reflow, so it keeps the highlight.)
Existing attempt & decision
PR #895 attempts a fix (wait for render in tests + remount the chart via a key bump to re-apply defaultState). It is on hold — we decided the proper fix should address the reflow itself (so a reflow preserves / re-applies the hover highlight at the new pane size), rather than working around it with a chart remount.
Temporary mitigation
These tests are skipped in #894 via test.skip(...) referencing this issue, so unrelated PRs aren't blocked by the flake.
Fix direction
- Tests: wait for the widget's render-complete signal (
GravityChartsWidget exposes onReady → onRender/onLoad via afterFrame) before toMatchScreenshot.
- Product: fix
reflow in withSplitPane so the initial hover highlight survives the pane resize (don't rely on a remount).
- Regenerate the linux baselines under charts 1.56.0 once the above are in.
Problem
The gravity-charts visual regression tests are flaky in CI (
toMatchScreenshotmismatch) — they pass on fast machines / some CI runs and fail on others:src/plugins/gravity-charts/__tests__/Base.visual.test.tsx→ "should render chart with valid data"src/plugins/gravity-charts/__tests__/SplitTooltip.visual.test.tsx→ "should render tooltip in album orientation" / "should render tooltip in portrait orientation"Root cause (test timing)
The tests call
await render(<ChartTestStory .../>)and immediatelytoMatchScreenshot(), but@gravity-ui/chartsrenders asynchronously. On slower/loaded CI runners the screenshot captures a blank/partial canvas.Evidence:
@gravity-ui/charts1.55.2 → 1.56.0 bump (feat(deps): Update@gravity-ui/charts1.55.2->1.56.0#892): https://github.com/gravity-ui/chartkit/actions/runs/27338492635/job/80768842932/update-screenshotsrun once committed a 1001-byte (blank) Base baseline.@gravity-ui/charts1.55.2->1.56.0#892 and on fix(highcharts): keep tooltip formatter override stable across re-renders #894 — classic flake.Related product bug (
reflowinwithSplitPane)While regenerating baselines, a real regression surfaced: in the HORIZONTAL split (portrait) the initial hover highlight on the split tooltip is lost.
withSplitPaneseedsdata.defaultState.hoveredPositionto show an initial tooltip, but gravity-charts appliesdefaultStateonly once per mount. When the tooltip appears, the chart-pane resize callschartRef.reflow({immediate: true}), which re-renders the chart and drops that one-shot highlight — desyncing the chart from the still-shown tooltip. (VERTICAL/album split has no such reflow, so it keeps the highlight.)Existing attempt & decision
PR #895 attempts a fix (wait for render in tests + remount the chart via a
keybump to re-applydefaultState). It is on hold — we decided the proper fix should address thereflowitself (so a reflow preserves / re-applies the hover highlight at the new pane size), rather than working around it with a chart remount.Temporary mitigation
These tests are skipped in #894 via
test.skip(...)referencing this issue, so unrelated PRs aren't blocked by the flake.Fix direction
GravityChartsWidgetexposesonReady→onRender/onLoadviaafterFrame) beforetoMatchScreenshot.reflowinwithSplitPaneso the initial hover highlight survives the pane resize (don't rely on a remount).