Playwright Integration Skill
Dynamic, framework-agnostic Playwright assistant for any web project.
Command
/playwright-integration
What It Does
Auto-detects your web framework and provides tailored Playwright setup:
- Framework Detection: React, Vue, Angular, Svelte, Next.js, Nuxt, Solid, Qwik
- Build Tool Detection: Vite, Webpack, Rspack, Angular CLI, Next.js CLI, Nuxt CLI
- Routing Detection: React Router, Vue Router, Angular Router, file-based routing
- Auth Pattern Detection: OIDC, JWT, NextAuth, session-based, custom
- UI Library Detection: MUI, AntD, Tailwind, Bootstrap, Element Plus, etc.
Pre-Generation Validation Phase (MANDATORY)
Before generating ANY test code, you MUST gather:
- Environment: dev / staging / prod
- Base URL: Full application URL (e.g.,
http://localhost:4200, https://app-dev.example.com)
- Credentials: Valid username/password (or API keys) for authentication tests
- ASK: "Please provide a valid username and password for the [ENVIRONMENT] environment"
- NEVER use placeholder values like 'test@example.com' or 'password123'
- Auth bypass: Does your backend provide test auth endpoints (e.g.,
/api/auth/test-login)?
- Test data: Are seeded test users/data available?
Validation Checklist (complete before code generation):
Usage
# Basic setup (auto-detects framework)
/playwright-integration setup
# Specific focus
/playwright-integration configure for React Next.js
/playwright-integration auth handling
/playwright-integration selectors
/playwright-integration debug flaky tests
# Override detection if needed
/playwright-integration --framework=react setup
Example Responses
React + Vite Project
📦 Detected: React 18 + TypeScript + Vite + MUI + React Router
Config recommendations:
- webServer.command: npm run dev (port 5173)
- Use RTL selectors: getByRole, getByTestId
- Add data-testid to MUI components
- Handle React StrictMode double renders
Vue 3 + Nuxt
📦 Detected: Vue 3 + Nuxt 3 + Pinia + Vue Router
Config recommendations:
- webServer.command: nuxi dev
- Wait for Vue reactive updates
- Use Vue Test Utils patterns
- Handle file-based routes: pages/ → /
Angular
📦 Detected: Angular 17 + Material + Router
Config recommendations:
- webServer.command: ng serve
- Prefer CSS selectors over RTL
- Handle change detection strategies
- Use Angular Material test IDs
Parameters
action: setup, configure, auth, selectors, debug, optimize
framework: Override auto-detection (react, vue, angular, svelte, next, nuxt, other)
focus: Area of focus (auth, routing, selectors, state, performance, ci)
Benefits
✅ Works with ANY web framework
✅ Adapts to your existing setup
✅ Framework-specific best practices
✅ Mandatory URL/credential validation
✅ Never uses hardcoded credentials
✅ Practical, runnable examples
Authentication Test Generation Rules
HARD RULES (Non-negotiable):
❌ NEVER use hardcoded credentials like:
'test@example.com'
'password123'
'admin' / 'admin123'
✅ ALWAYS ask user for:
- Environment (dev/staging/prod)
- Base URL (full application URL)
- Valid credentials (username/password)
- Auth bypass endpoint availability
- Test user details
✅ Replace all placeholders with {{VARIABLE}} markers:
const EMAIL = '{{USER_EMAIL}}'; // ASK USER
const PASSWORD = '{{USER_PASSWORD}}'; // ASK USER
✅ Include security warning: "Never commit real credentials"
✅ Suggest environment variables or global setup for CI
What to ask the user:
To generate authentication tests, I need:
1. What environment? (dev/staging/prod)
2. Base URL? (e.g., http://localhost:4200)
3. Valid credentials? (email/username and password)
4. Test auth bypass endpoint? (y/n - if yes, provide path)
5. Seeded test users available? (y/n)
If user cannot provide credentials:
- Do NOT generate fake placeholder values
- Explain that tests will fail without valid credentials
- Offer to generate test structure without actual credential values
- Suggest implementing test auth bypass endpoint
For detailed documentation, see: references/playwright-integration-detailed.md
1---2name: playwright-integration3description: Playwright Integration Skill4---56# Playwright Integration Skill78Dynamic, framework-agnostic Playwright assistant for any web project.910## Command1112```13/playwright-integration14```1516## What It Does1718Auto-detects your web framework and provides tailored Playwright setup:1920- **Framework Detection**: React, Vue, Angular, Svelte, Next.js, Nuxt, Solid, Qwik21- **Build Tool Detection**: Vite, Webpack, Rspack, Angular CLI, Next.js CLI, Nuxt CLI22- **Routing Detection**: React Router, Vue Router, Angular Router, file-based routing23- **Auth Pattern Detection**: OIDC, JWT, NextAuth, session-based, custom24- **UI Library Detection**: MUI, AntD, Tailwind, Bootstrap, Element Plus, etc.2526## Pre-Generation Validation Phase (MANDATORY)2728**Before generating ANY test code, you MUST gather:**29301. **Environment**: dev / staging / prod312. **Base URL**: Full application URL (e.g., `http://localhost:4200`, `https://app-dev.example.com`)323. **Credentials**: Valid username/password (or API keys) for authentication tests33 - ASK: "Please provide a valid username and password for the [ENVIRONMENT] environment"34 - NEVER use placeholder values like 'test@example.com' or 'password123'354. **Auth bypass**: Does your backend provide test auth endpoints (e.g., `/api/auth/test-login`)?365. **Test data**: Are seeded test users/data available?3738**Validation Checklist** (complete before code generation):39- [ ] Base URL is reachable and correct for the target environment40- [ ] User-provided credentials work for manual login41- [ ] Authentication flow verified manually42- [ ] Test data/seeding strategy confirmed43- [ ] API bypass endpoints identified (if applicable)4445## Usage4647```bash48# Basic setup (auto-detects framework)49/playwright-integration setup5051# Specific focus52/playwright-integration configure for React Next.js53/playwright-integration auth handling54/playwright-integration selectors55/playwright-integration debug flaky tests5657# Override detection if needed58/playwright-integration --framework=react setup59```6061## Example Responses6263### React + Vite Project64```65📦 Detected: React 18 + TypeScript + Vite + MUI + React Router6667Config recommendations:68- webServer.command: npm run dev (port 5173)69- Use RTL selectors: getByRole, getByTestId70- Add data-testid to MUI components71- Handle React StrictMode double renders72```7374### Vue 3 + Nuxt75```76📦 Detected: Vue 3 + Nuxt 3 + Pinia + Vue Router7778Config recommendations:79- webServer.command: nuxi dev80- Wait for Vue reactive updates81- Use Vue Test Utils patterns82- Handle file-based routes: pages/ → /83```8485### Angular86```87📦 Detected: Angular 17 + Material + Router8889Config recommendations:90- webServer.command: ng serve91- Prefer CSS selectors over RTL92- Handle change detection strategies93- Use Angular Material test IDs94```9596## Parameters9798- `action`: `setup`, `configure`, `auth`, `selectors`, `debug`, `optimize`99- `framework`: Override auto-detection (react, vue, angular, svelte, next, nuxt, other)100- `focus`: Area of focus (`auth`, `routing`, `selectors`, `state`, `performance`, `ci`)101102## Benefits103104✅ Works with ANY web framework105✅ Adapts to your existing setup106✅ Framework-specific best practices107✅ **Mandatory URL/credential validation**108✅ **Never uses hardcoded credentials**109✅ Practical, runnable examples110111---112113## Authentication Test Generation Rules114115**HARD RULES (Non-negotiable):**1161171. ❌ **NEVER** use hardcoded credentials like:118 - `'test@example.com'`119 - `'password123'`120 - `'admin' / 'admin123'`1211222. ✅ **ALWAYS** ask user for:123 - Environment (dev/staging/prod)124 - Base URL (full application URL)125 - Valid credentials (username/password)126 - Auth bypass endpoint availability127 - Test user details1281293. ✅ **Replace** all placeholders with `{{VARIABLE}}` markers:130 ```typescript131 const EMAIL = '{{USER_EMAIL}}'; // ASK USER132 const PASSWORD = '{{USER_PASSWORD}}'; // ASK USER133 ```1341354. ✅ **Include** security warning: "Never commit real credentials"1361375. ✅ **Suggest** environment variables or global setup for CI138139**What to ask the user:**140```141To generate authentication tests, I need:1421. What environment? (dev/staging/prod)1432. Base URL? (e.g., http://localhost:4200)1443. Valid credentials? (email/username and password)1454. Test auth bypass endpoint? (y/n - if yes, provide path)1465. Seeded test users available? (y/n)147```148149**If user cannot provide credentials:**150- Do NOT generate fake placeholder values151- Explain that tests will fail without valid credentials152- Offer to generate test structure without actual credential values153- Suggest implementing test auth bypass endpoint154155---156157For detailed documentation, see: `references/playwright-integration-detailed.md`