Skip to content

[ENHANCEMENT] Add shared VS Code message capture to Playwright gallery #517

Description

@edelauna

Problem

The Story Gallery now provides shared extension state, translations, React Query, tooltips, deterministic themes, and fresh provider state. Outbound VS Code messages are still captured ad hoc: Announcement.links.visual.tsx parses the plain-browser console.log fallback instead of using a typed shared test channel.

Desired behavior

Provide a reusable browser-side message capture helper for Story Gallery tests. Tests should read typed outbound vscode.postMessage payloads without starting the Extension Host, parsing console output, or duplicating setup.

Current state

PR #1426 superseded the original provider-harness scope:

  • playwright/AppProviders.tsx supplies extension state, i18n, React Query, and tooltips.
  • Stories can override a typed subset of extension state.
  • Providers and query clients are recreated for each mounted story.
  • The gallery runs in the pinned Docker/CI rendering environment.

The remaining gap is shared host-message capture.

Acceptance criteria

  • A browser-side helper captures outbound VS Code messages with a typed payload shape.
  • Captured messages are reset for every test or mount so state cannot leak.
  • Tests can inspect messages without parsing console output or requiring the real Extension Host.
  • Announcement.links.visual.tsx uses the shared capture path and still proves one host message per external link.
  • The helper remains opt-in and does not obscure ordinary story setup.
  • Story Gallery tests, Docker visual comparison, type checking, lint, and existing webview unit tests pass.

Constraints

  • Keep real Extension Host behavior in apps/vscode-e2e; this helper only captures the browser-side message boundary.
  • Preserve AppProviders as the shared provider harness rather than introducing a second wrapper.
  • Keep Vitest as the primary behavioral test layer.

Related: #515, #1358, PR #1426

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions