Skip to content

Add Playwright E2E tests for Visual Designer#19689

Open
shenglol wants to merge 1 commit into
mainfrom
shenglol/visualizer-e2e-testing
Open

Add Playwright E2E tests for Visual Designer#19689
shenglol wants to merge 1 commit into
mainfrom
shenglol/visualizer-e2e-testing

Conversation

@shenglol
Copy link
Copy Markdown
Contributor

@shenglol shenglol commented May 19, 2026

Summary

Adds end-to-end test coverage for the Bicep Visual Designer React app using Playwright (Chromium), and wires it into CI.

Changes

Playwright infrastructure

  • New playwright.config.ts: Chromium-only project, auto-boots the Vite dev server at 127.0.0.1:5173, CI-aware (retries=2, workers=1, forbidOnly=true), HTML report to e2e/.report, artifacts to e2e/.results.
  • New e2e/fixtures.ts: shared helpers — SAMPLE_GRAPHS, openVisualDesigner, loadSampleGraph, waitForAnyNode, nodeCount, getGraphTransform.
  • 4 spec files, 21 tests total:
    • app-loads.spec.ts — shell loads, no unexpected console errors, default graph auto-received.
    • graph-rendering.spec.ts — flat/module/complex/empty sample graphs, graph swap.
    • controls.spec.ts — status bar states, control enable/disable, zoom/fit-view transforms, export overlay open/close.
    • node-interactions.spec.ts — focus on click, blur on empty click, revealFileRange on dblclick, focus survival across graph swaps.

Test instrumentation

Added stable data-testid (and related data attributes) to:

  • App.tsx (app-root)
  • lib/graph/components/Canvas.tsx (graph-canvas)
  • lib/graph/components/BaseNode.tsx / AtomicNode.tsx / CompoundNode.tsx (graph-node + data-node-id + data-node-kind)
  • features/controls/ControlBar.tsx (control-bar, control-zoom-in, control-zoom-out, control-fit-view, control-reset-layout, control-export)
  • features/status/StatusBar.tsx (status-bar + data-status + data-error-count, status-indicator, status-error-link, status-empty-message)
  • features/devtools/DevToolbar.tsx (dev-toolbar, dev-graph-*, dev-mutation-*)
  • features/export/ExportOverlay.tsx (export-overlay)

TypeScript project references

  • Root tsconfig.json is now solution-style and references tsconfig.app.json (src) and tsconfig.e2e.json (playwright.config.ts + e2e/**, types: ["node"]).
  • build script: tsc -b && vite build.
  • Removes deprecated baseUrl from the app tsconfig (TS 4.1+ resolves paths relative to the tsconfig).

Scripts

  • e2e, e2e:ui, e2e:report, e2e:install in apps/visual-designer/package.json.
  • The e2e:* namespace (instead of test:e2e:*) keeps Playwright out of the unit-test turbo test pipeline used elsewhere in the monorepo.

CI (.github/workflows/build.yml)

In the test-vscode-bicep-ui job, after Run tests, gated on Linux:

  1. npm run e2e:install (installs Chromium + deps)
  2. npm run e2e (CI=true)
  3. Upload e2e/.report as visual-designer-playwright-report artifact (if: always(), 7-day retention).

Hygiene

  • .gitignore: ignore *.tsbuildinfo, **/e2e/.report/, **/e2e/.results/, plus Playwright defaults.
  • eslint.config.mjs: ignore **/e2e/.results/ and **/e2e/.report/.

Validation

  • tsc -b → exit 0
  • npm run lint → clean
  • npm run e2e locally → 21 passed in ~34s.
Microsoft Reviewers: Open in CodeFlow

- Add Playwright (Chromium) infrastructure with 4 spec files covering app
  shell, graph rendering, controls/status bar, and node interactions.
- Instrument core components with stable data-testid attributes.
- Split tsconfig into composite app/e2e projects so playwright.config.ts
  picks up @types/node; switch build to tsc -b && vite build.
- Wire e2e/e2e:install scripts into the test-vscode-bicep-ui CI job
  (Linux only) and upload the Playwright HTML report as an artifact.
- Ignore .tsbuildinfo, e2e/.report, and e2e/.results in git/eslint.
@github-actions
Copy link
Copy Markdown
Contributor

Test this change out locally with the following install scripts (Action run 26075134651)

VSCode
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-vsix.sh) --run-id 26075134651
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-vsix.ps1) } -RunId 26075134651"
Azure CLI
  • Mac/Linux
    bash <(curl -Ls https://aka.ms/bicep/nightly-cli.sh) --run-id 26075134651
  • Windows
    iex "& { $(irm https://aka.ms/bicep/nightly-cli.ps1) } -RunId 26075134651"

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant