qwen-code/packages/web-shell/client/e2e/utils
Shaojin Wen 0d9a675c7c
test(web-shell): add extensions-manager visual scenario (#6997)
* test(web-shell): add extensions-manager visual scenario

Add a full-page Extensions manager scenario to the web-shell visual
suite, proving a manager PAGE (not just a transcript or dialog) is
reachable in the mock-daemon harness and captured in both themes.

- Make the mocked workspace extensions scenario-driven: empty by
  default (mirroring skills/settings/tools), so a scenario can seed
  sample extensions via createWebShellDaemonScenario({ extensions }).
- Mock the two endpoints the manager fires on mount so the captured
  page renders without a spurious error banner:
  GET /workspace/extensions/operations (idle poll) and
  POST /workspace/extensions/check-updates (no updates available).
- Seed three extensions (enabled/disabled, marketplace/local, with
  varied capability counts) so the manager renders real cards.

* test(web-shell): structural locators + scenario-driven extension routes

Address review feedback on the extensions-manager visual scenario:

- Gate the scenario on the page heading (a stable `heading` role) and
  assert the seeded card via its `button` role, instead of a bare
  getByText('Context7') that a card-heading refactor or a toast/sidebar
  match could break.
- Wire the /operations and /check-updates mock routes through the
  scenario (new extensionOperations / extensionUpdateCheck fields with
  idle defaults) so a future test can preview an in-flight install or a
  pending update, matching how every other workspace route delegates to
  the scenario rather than returning a hardcoded inline object.

* test(web-shell): serve mocked extensions directly from the scenario

Address review: inline the trivial `workspaceExtensions()` pass-through
at its one call site (`await json(route, scenario.extensions)`) and drop
the function. This matches how the other full-object scenario fields
(providers/skills/settings) are served directly, rather than the
synthesizing helpers (workspaceTools/workspaceMcp) that build a fresh
object each call.

* test(web-shell): assert the disabled, local-source extension renders

Address review: the scenario seeds a disabled/local extension but only
asserted the enabled one, so a regression that hides `isActive: false`
or local-source rows would pass here and only differ in the (visually
reviewed) screenshot. Also assert the "Local Notes" card is visible.

---------

Co-authored-by: wenshao <wenshao@example.com>
2026-07-16 12:43:26 +00:00
..
mockDaemon.ts test(web-shell): add extensions-manager visual scenario (#6997) 2026-07-16 12:43:26 +00:00
sseTransport.ts Add harness infrastructure for web-shell package (#6517) 2026-07-09 08:11:58 +00:00