Files
superset2/tests/unit_tests/utils
Elizabeth Thompson bfc1debb6a feat(reports): per-chart dashboard report capture behind feature flag (POC)
Add PER_CHART_DASHBOARD_REPORTS feature flag (default off). When enabled,
dashboard reports capture each chart individually and stack the images in
a single column, instead of one monolithic full-dashboard screenshot.

The report scheduler navigates to the dashboard permalink once — so tab
state and dashboard filters apply to every chart — then iterates over each
chart holder, waiting only for that chart's own loading spinner before
capturing it. One slow chart can no longer block or blank the entire
report; charts that never finish loading are skipped with a warning while
the rest are still delivered.

This mirrors the per-component delivery model used by Metabase (per-card
subscriptions) and Looker ("arrange dashboard tiles in a single column").

- take_per_chart_screenshots() in screenshot_utils.py: per-chart iteration,
  scroll-into-view for lazy loading, per-chart spinner wait, skip-on-timeout
- WebDriverPlaywright.get_per_chart_screenshots(): single navigation with
  auth and permalink context, Playwright-only
- DashboardScreenshot.get_per_chart_screenshots(): returns None on Selenium
  so callers fall back to the full-dashboard screenshot
- _get_screenshots() in execute.py: uses per-chart capture for dashboard
  reports when the flag is on; falls back to the full screenshot if no
  charts were captured
- Existing build_pdf_from_screenshots() stacks the per-chart images as PDF
  pages; PNG/Slack formats already accept image lists

POC for sc-113551. Not yet included: per-report-schedule toggle in the UI,
chart title/header treatment, placeholder for skipped charts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-15 18:47:27 +00:00
..