Skip to content

Playwright

Playwright is used for two purposes in UpDoc:

  1. End-to-end testing — automating browser interactions to test the Create from Source workflow and workflow editor
  2. Figma capture — logging into the Umbraco backoffice to capture authenticated pages for design iteration (via Playwright MCP)

For detailed test documentation, see the Testing section.

Playwright tests live alongside the extension code at:

src/UpDoc/wwwroot/App_Plugins/UpDoc/
├── playwright.config.ts
└── tests/e2e/
├── .auth/ # Stored auth state
├── auth.setup.ts # Login setup project
├── create-from-source.spec.ts
├── document-verification.spec.ts
├── transformed-view.spec.ts
└── blockkey-reconciliation.spec.ts
SettingValue
Test directorytests/e2e
Timeout60 seconds per test
Expect timeout10 seconds
ParallelDisabled (fullyParallel: false, workers: 1)
BrowserDesktop Chrome
Base URLprocess.env.UMBRACO_URL or https://localhost:44390
Test ID attributedata-mark (Umbraco convention)
AuthSetup project stores state, spec projects depend on it
VariablePurpose
UMBRACO_URLThe Umbraco site URL (e.g., https://localhost:44390)
Terminal window
# Run all tests
cd src/UpDoc/wwwroot/App_Plugins/UpDoc
npx playwright test
# Run a specific spec file
npx playwright test create-from-source
# Run with UI mode (interactive)
npx playwright test --ui
# Run with headed browser (visible)
npx playwright test --headed

Umbraco’s backoffice uses Shadow DOM extensively. This affects how Playwright selects elements:

  • Use page-level queriespage.locator() rather than scoped queries that can’t cross shadow boundaries
  • Avoid strict shadow DOM selectors — Playwright’s >> shadow piercing syntax can be fragile with Umbraco’s nested shadow roots
  • Test UUI componentsuui-button, uui-input, etc. are custom elements inside shadow roots

A dedicated Umbraco user account exists for Playwright automation. This user is used both by E2E tests and by the Playwright MCP server for Figma captures of authenticated backoffice pages.

The Playwright MCP server can log into the Umbraco backoffice and capture authenticated pages directly — bypassing the html.to.design plugin and its Shadow DOM limitations.

ApproachBest for
HTML MockupsDesigning individual components without the site running
html.to.design pluginCapturing complex backoffice pages with full Shadow DOM fidelity
Playwright MCP captureAutomated capture of authenticated pages — no manual plugin step

How it works:

  1. Playwright MCP navigates to the Umbraco login page
  2. Logs in with the dedicated Playwright user
  3. Navigates to the target backoffice page
  4. Injects the Figma capture script (stripping CSP headers)
  5. Submits the capture to the Figma file

Before writing new Playwright tests, invoke the relevant Claude Code skills:

  • umbraco-e2e-testing — E2E patterns for Umbraco backoffice
  • umbraco-playwright-testhelpers@umbraco/playwright-testhelpers fixtures and helpers
  • umbraco-testing — router skill for choosing the right testing approach