skills/playwright/SKILL.md
# Skill: playwright (project-local) Extends the global Playwright skill with project-specific setup, browser install, and MF dev server orchestration for this monorepo. --- ## Browser Installation in AI Agents (OpenCode / Claude) The MCP Playwright server looks for `chrome` at `/opt/google/chrome/chrome` by default. That binary is **not available** in this environment. ### Fix 1 — Configure MCP to use chromium (preferred, one-time) In `~/.config/opencode/opencode.json`, add `--browser chro
npx skillsauth add Hyperxq/modular-frontend-architecture skills/playwrightInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Extends the global Playwright skill with project-specific setup, browser install, and MF dev server orchestration for this monorepo.
The MCP Playwright server looks for chrome at /opt/google/chrome/chrome by default.
That binary is not available in this environment.
In ~/.config/opencode/opencode.json, add --browser chromium to the Playwright MCP command:
"playwright": {
"command": ["npx", "@playwright/mcp@latest", "--browser", "chromium"],
"enabled": true,
"type": "local"
}
Then install Chromium once:
bunx playwright install chromium
# installs to ~/.cache/ms-playwright/chromium-XXXX/
Restart OpenCode after editing the config — the MCP server relaunches with the new flag.
If you can't edit the MCP config:
PLAYWRIGHT_BROWSERS_PATH=0 bunx playwright install chromium
Puts the binary inside the bunx temp cache. No system permissions required.
If you get Chromium distribution 'chrome' is not found, apply Fix 1 above.
Tests run against the shell host on :3002. The MF remote (ui-components) must
be on :3001 first.
| Server | Port | Command |
|--------|------|---------|
| ui-components MF remote | 3001 | nx run @modular-frontend/ui-components:dev |
| shell host | 3002 | nx run @modular-frontend/shell:dev |
playwright.config.ts has webServer configured with reuseExistingServer: true
for local dev — if both servers are already running, Playwright reuses them and
skips startup. In CI (process.env.CI=true) it always starts fresh.
Start both servers (correct order, readyWhen gated):
bun run dev # from repo root — orchestrates order via web:dev:remote → web:dev
# From repo root
bun run e2e # headless, all browsers
bun run e2e:ui # interactive UI mode
bun run e2e:debug # debug mode (headed, step-by-step)
bun run e2e:report # open last HTML report
# From automation_test/
bunx playwright test
bunx playwright test --grep "Button" # filter by name
bunx playwright test --project=chromium # single browser
automation_test/
base-page.ts # BasePage — all page objects extend this
helpers.ts # shared utilities and data generators
playwright.config.ts # config — baseURL, webServer, projects
{feature}/
{feature}-page.ts # Page Object Model
{feature}.spec.ts # ALL tests for this feature (one file only)
{feature}.md # test documentation
automation_test/playwright.config.ts
Key values:
baseURL: http://localhost:3002 (overridable via PLAYWRIGHT_BASE_URL)testDir: ./ (relative to automation_test/)testMatch: **/*.spec.tschromium, firefox, mobile-chrome (Pixel 5)bun run dev from repo root)PLAYWRIGHT_BROWSERS_PATH=0 installhttp://localhost:3002browser_snapshot (NOT screenshot) to inspect the DOMgetByRole > getByLabel > getByText > getByTestIdspec.ts per feature — never split into multiple filesBasePage from automation_test/base-page.ts@playwright/test, never from vitest or jestdevelopment
Rstest patterns for Rspack-native unit testing with Preact. Trigger: When writing tests with @rstest/core, testing-library/preact, or configuring rstest.config.ts.
tools
Rspack bundler patterns for Rsbuild/Rslib config customization. Trigger: When customizing rspack config via tools.rspack, adding plugins, aliases, or Module Federation setup.
tools
Rslib library build tool patterns for Rspack-based component libraries. Trigger: When configuring rslib.config.ts, library builds, Module Federation remotes, or dynamic entry discovery.
development
Preact 10 patterns with React-compat and Module Federation singleton setup. Trigger: When writing Preact components, hooks, types, or configuring Preact in Rsbuild/Rslib/Rstest.