#3041·midscene

[Bug]: HTML report shows Playground demo data (SauceDemo) instead of real UI context after aiAssert

Author: ManshawarCreated Aug 26, 2026Updated Sep 8, 2026

Version

  • @midscene/core: 1.12.0
  • @midscene/web: 1.12.0
  • Playwright: 1.62.1
  • Node.js: 24.12.0
  • macOS (darwin)

Describe the bug

When running Midscene.js with Playwright (via @midscene/web/playwright PlaywrightAiFixture), AI actions (aiAssert) execute correctly against the real page — the AI model's analysis text is correct (e.g. "a gray toast ... displayed in the center of the page" → StatementIsTruthy: true). The screenshot is also captured successfully at runtime (screenshotBase64 begin/end in web-page.log).

However, the generated HTML report does not contain the real UI context (screenshot + DOM). Instead, the report shows Playground demo data — a SauceDemo page (Swag Labs, Username, Login, etc.) as the UI context preview.

Steps to reproduce

  1. Set up Playwright + Midscene (PlaywrightAiFixture).
  2. Write a test that calls aiAssert(...) on any page (e.g. mobile dispatch page).
  3. Run the test, let aiAssert execute successfully.
  4. Open the generated HTML report under midscene_run/report/.

Expected behavior

The report should show the real screenshot + DOM context captured at runtime.

Actual behavior

The report shows SauceDemo demo data instead of the real page context.

Root cause analysis (from source)

  • packages/visualizer/src/component/context-preview/index.tsx renders No UI context + demo data when no real UI context is provided to the report.
  • The demo data is packages/visualizer/src/component/playground/playground-demo-ui-context.json (SauceDemo Swag Labs).
  • AI runtime DOES capture the screenshot (confirmed in midscene_run/log/web-page.log: screenshotBase64 begin/end), and the model's analysis text references the real screenshot correctly (midscene_run/log/ai-call.log).
  • But the report data pipeline seems to lose the UI context (screenshot) before it reaches the HTML reporter, so the report falls back to demo data.

Additional notes

  • midscene_run/log/cache.log shows no cache file found every run — cache is not the cause.
  • The report file is freshly generated (current timestamp), not stale.
  • This affects @midscene/web/playwright playwright reporter separate mode with default single-html output.