Set up Playwright in a project using `@jabraf/dev`'s `basePlaywrightConfig` factory. Load when the user asks to add Playwright, set up end-to-end / functional / visual-regression tests, configure `playwright.config.ts`, or wire up `@jabraf/dev` Playwright specifically. Do not load for Cypress, WebdriverIO, or general browser-testing questions unrelated to `@jabraf/dev`.
Ships in jabraf-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
jabraf-playwrightAdds Playwright to the current project via the basePlaywrightConfig factory
from @jabraf/dev. The factory
covers test location (testDir, testMatch), target URLs (baseURL,
devServerURL, isFunctional), CI behaviour (isCI, retries, workers,
fullyParallel), reporting (reporter), browser projects, use options, and
the auto web server (webServerCommand, webServerEnv, webServerTimeout,
webServer). An extend escape hatch merges arbitrary Playwright config last.
It ships sensible defaults for CI behaviour and browser projects (Chromium /
Desktop Chrome by default).
Canonical setup lives in
packages/jabraf-dev/README.md.
Load when the user's prompt mentions any of:
@jabraf/dev playwright", "jabraf playwright"Do not load for unit tests (use jabraf-vitest), API tests, or Cypress /
WebdriverIO requests. Do not load alongside jabraf-dev-setup — the umbrella
will invoke this one.
Project-shape gate. Determine whether Playwright is appropriate:
react, vue, svelte, next, vite, astro, remix, nuxt — proceed.Brief acknowledge + URL detection. Scan package.json homepage, README.md, and any wrangler.toml/vite.config/next.config for a production hostname. Default devServerURL to http://localhost:3000 for Next/Vite, http://localhost:5173 for plain Vite, or ask. One sentence: "I'll add Playwright via @jabraf/dev. I'll target <detected dev URL> for functional tests and <detected prod URL or none> for production. OK?" [wait for user]
Detect package manager. Standard logic.
Detect existing config. Check for playwright.config.{ts,js,mts,mjs}. If found, show contents and ask: "Replace with the @jabraf/dev factory call, leave alone, or merge?" [wait for user] Never overwrite silently.
Install @jabraf/dev if missing. Dev dep, at latest. Playwright itself comes transitively.
Write playwright.config.ts. Default body — adjust to the user's chosen setup:
import { basePlaywrightConfig } from '@jabraf/dev/playwright';
export default basePlaywrightConfig();
With options:
export default basePlaywrightConfig({
testDir: './e2e',
isFunctional: process.env.TEST_ENV === 'functional',
isCI: Boolean(process.env.CI),
baseURL: 'https://example.com',
devServerURL: 'http://localhost:3000',
});
Option summary:
| Option | Default | Notes |
|---|---|---|
testDir | './integration' | Where tests live |
testMatch | Playwright default | Glob(s) selecting spec files within testDir |
isFunctional | TEST_ENV === 'functional' | When true, starts dev/build server |
isCI | Boolean(process.env.CI) | Forbids .only; drives retries / workers defaults |
baseURL | 'https://jabran.dev' | Used when isFunctional is false |
devServerURL | 'http://localhost:5231' | Used when isFunctional is true |
projects | Chromium (Desktop Chrome) | Override to add Firefox / WebKit / mobile |
reporter | list + non-opening html | Playwright reporter(s) |
fullyParallel | true | Toggle full parallelism |
retries | 2 on CI, else 0 | Retry count |
workers | 1 on CI, else unset | Worker count |
use | {} | Merged over computed use defaults (baseURL, trace) |
webServerCommand | build+start on CI, else dev | Override the auto web-server command |
webServerEnv | — | Extra env vars for the auto web-server |
webServerTimeout | 60000 | Timeout (ms) for the auto web-server |
webServer | derived (functional only) | Fully override the web server; takes precedence |
extend | {} | Escape hatch: extra config merged last, overriding all |
The web-server options only take effect for the functional suite unless you
pass a full webServer object. Ask which directory the user wants for tests
(e2e, tests/e2e, integration) and use that for testDir. [wait for
user if ambiguous]
Install Playwright browsers. Run npx playwright install (or --with-deps if on Linux/CI). Mention that this downloads ~hundreds of MB. [wait for user] Skip if browsers are already installed.
Add scripts. Add to package.json scripts, only if absent. The README's three-script pattern, gated on tags:
{
"scripts": {
"test:functional": "TEST_ENV=functional playwright test --grep-invert @non-functional",
"test:e2e": "playwright test --grep @e2e",
"test:vr": "playwright test --grep @vr",
},
}
Offer the simpler "test:e2e": "playwright test" if the user doesn't want tag-based separation. [wait for user if conflict]
Validate. Run npx playwright test --list (lists discovered tests without running them). Report:
*.spec.ts under <testDir>/ and re-run."Final report. Summarize: project type, URLs, package manager, install status, config written, browsers installed, scripts added, validation outcome.
package.json scripts without confirmation.@jabraf/dev (or @playwright/test) to a specific version — install at latest.*.spec.ts files unless the user asks.| Situation | Action |
|---|---|
Project has no package.json | Stop. Ask the user to initialise the project first. |
| Pure-Node lib with no browser surface | Stop per step 1. Suggest jabraf-vitest if they need unit tests instead. |
playwright already installed at a different major | Surface the version. Ask whether to align with @jabraf/dev. [wait for user] Do not auto-upgrade. |
| Existing test runner (Cypress, WebdriverIO) | Do not migrate. Ask the user to decide before proceeding. |
| User on Windows, asks to install browsers | npx playwright install works the same; skip --with-deps (Linux-only). |
User wants component testing (@playwright/experimental-ct-*) | Out of scope for the base factory. Point them at the extend option to merge extra config, or extend manually. |
| Monorepo | Apply per-package. The factory is per-config-file; a workspace-level Playwright config is rare and out of scope. |
@jabraf/dev Playwright docs: packages/jabraf-dev/README.md#playwright@jabraf/dev/playwright → ./dist/config/playwright/base-config.js (see packages/jabraf-dev/package.json exports map)basePlaywrightConfig (factory) and the CustomPlaywrightTestConfig options type.What SKILL.md sets; muted values are Claude Code's defaults
/jabraf-skills:jabraf-playwrightfrom jabraf-skills
npx claudepluginhub jabranr/skills --plugin jabraf-skills17 skills in this plugin
/jabraf-app-config-setupSet up `@jabraf/app-config` end-to-end in a project — install the runtime dep, scaffold `config/make-config.ts`, augment the `FeatureMap`, gitignore the generated artifact, add `prebuild`/`predev` scripts, wire the bootstrap `setConfig` call, and (React apps) mount the in-app `FeatureFlagsPanel` toggle UI. Load when the user asks to add app config, set up feature flags, configure `@jabraf/app-config`, wire `jabraf-config build`, or add a feature flags toggle panel / floating button./jabraf-commitlintSet up commitlint in a project using `@jabraf/dev`'s shared base (conventional commits). Load when the user asks to add commitlint, enforce conventional commits, configure `commitlint.config.js`, or wire up `@jabraf/dev` commitlint specifically. Do not load for general commit-message-quality questions unrelated to `@jabraf/dev`./jabraf-Other plugins' skills for the same job