Playwright
Playwright is used for two purposes in UpDoc:
- End-to-end testing — automating browser interactions for the Create from Source workflow
- Figma capture — logging into the Umbraco backoffice to capture authenticated pages for design iteration (via Playwright MCP)
Playwright tests live in the UpDoc project alongside the extension code. The test configuration targets the local UpDoc.TestSite.
Environment
Section titled “Environment”| Variable | Purpose |
|---|---|
URL | The Umbraco site URL (e.g., https://localhost:44391) |
Note: The environment variable is URL, not UMBRACO_URL.
Test PDFs
Section titled “Test PDFs”Test PDFs are stored in the Umbraco media library:
| Purpose | |
|---|---|
updoc-test-01 | Primary test document |
updoc-test-02 | Secondary test document |
updoc-test-03 | Third test document |
Shadow DOM Considerations
Section titled “Shadow DOM Considerations”Umbraco’s backoffice uses Shadow DOM extensively. This affects how Playwright selects elements:
- Use page-level queries —
page.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 components —
uui-button,uui-input, etc. are custom elements inside shadow roots
Test Coverage
Section titled “Test Coverage”Four tests cover the Create from Source workflow:
- Visibility — the “Create from Source” button appears in the collection toolbar
- Blueprint picker — clicking the button opens the blueprint picker modal
- Full flow — complete flow from button click through blueprint selection, PDF upload, extraction, and document creation
- Preview — extraction preview renders correctly before document creation
Backoffice User for Playwright
Section titled “Backoffice User for Playwright”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.
Figma Capture via Playwright MCP
Section titled “Figma Capture via Playwright MCP”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. This is useful for capturing the live backoffice state (not just static mockups).
When to use:
| Approach | Best for |
|---|---|
| HTML Mockups | Designing individual components without the site running |
| html.to.design plugin | Capturing complex backoffice pages with full Shadow DOM fidelity |
| Playwright MCP capture | Automated capture of authenticated pages — no manual plugin step |
How it works:
- Playwright MCP navigates to the Umbraco login page
- Logs in with the dedicated Playwright user
- Navigates to the target backoffice page
- Injects the Figma capture script (stripping CSP headers)
- Submits the capture to the Figma file
Known Issues
Section titled “Known Issues”- Cleanup: tests currently do not delete created test documents. A cleanup step is needed to prevent test data accumulation.
- Site must be running: Playwright tests require the UpDoc.TestSite to be running before execution.
Running Tests
Section titled “Running Tests”npx playwright testUmbraco Testing Skills
Section titled “Umbraco Testing Skills”Before writing new Playwright tests, invoke the relevant Claude Code skills:
umbraco-e2e-testing— E2E patterns for Umbraco backofficeumbraco-playwright-testhelpers—@umbraco/playwright-testhelpersfixtures and helpersumbraco-testing— router skill for choosing the right testing approach
References
Section titled “References”- Playwright documentation
@umbraco/playwright-testhelpers— Umbraco’s official test helpers- planning/PLAYWRIGHT_TESTING.md — original test planning document