JPeetz/agent-skills / skills/qa-testing/playwright-e2e-testing
playwright-e2e-testing
VerifiedUse this skill when writing, debugging, or maintaining Playwright end-to-end tests in TypeScript, JavaScript, or Python. Covers test structure and architecture (Page Object Model, fixtures, custom matchers), locator strategy (role-based, test-ID, accessible selectors), auto-waiting and retry, API/network mocking, visual regression, component testing (React, Vue, Svelte), accessibility audits (axe-core), device emulation, authentication and session management (multi-profile, OAuth, 2FA), performance testing (Web Vitals, Lighthouse), CI/CD configuration (GitHub Actions, GitLab CI, sharding), flaky test detection and auto-healing, test data/fixtures, i18n testing, Electron and browser extension testing, security testing (XSS, CSRF, CSP), and WebSocket testing. Designed for agentic platforms — Claude Code, Codex, Cursor, Gemini CLI, OpenClaw, GitHub Copilot, Windsurf, OpenCode, and all SKILL.md-compatible agents.
| File | Kind | Size |
|---|---|---|
| CHANGELOG.md | markdown | 2.2 KB |
| LICENSE | other | 1.0 KB |
| SKILL.md | skill md | 23.4 KB |
| evals/evals.json | config | 5.3 KB |
| references/ci-cd-patterns.md | markdown | 2.5 KB |
| references/locator-strategies.md | markdown | 3.0 KB |
| references/testing-types-matrix.md | markdown | 3.2 KB |
| scripts/flake-detector.shexecutable | script | 2.0 KB |
| scripts/generate-auth-profile.ts | script | 3.4 KB |
| scripts/validate-playwright-setup.shexecutable | script | 2.2 KB |
scripts/generate-auth-profile.ts
View on GitHub#!/usr/bin/env node
/**
* generate-auth-profile.ts — Generates and saves Playwright authentication profiles
* Usage: npx tsx generate-auth-profile.ts [--role=admin|customer] [--output=path]
*
* Environment variables:
* BASE_URL — Application base URL
* TEST_USER_EMAIL — Login email
* TEST_USER_PASSWORD — Login password
* AUTH_OUTPUT_DIR — Output directory for storage state files
*/
import { chromium } from '@playwright/test';
interface AuthConfig {
role: string;
email: string;
password: string;
loginUrl: string;
successUrl: string;
outputPath: string;
}
async function generateAuthProfile(config: AuthConfig): Promise<void> {
console.log(`🔐 Generating auth profile for role: ${config.role}`);
const browser = await chromium.launch({ headless: true });
const context = await browser.newContext();
const page = await context.newPage();
try {
await page.goto(config.loginUrl);
console.log(` Loaded login page: ${config.loginUrl}`);
await page.getByLabel(/email/i).fill(config.email);
await page.getByLabel(/password/i).fill(config.password);
await page.getByRole('button', { name: /sign in|log in|login/i }).click();
await page.waitForURL(new RegExp(config.successUrl));
console.log(` Authentication successful`);
await context.storageState({ path: config.outputPath });
console.log(` Profile saved: ${config.outputPath}`);
} catch (error) {
console.error(`❌ Auth failed for ${config.role}:`, error);
// Take a screenshot for debugging
await page.screenshot({ path: `auth-debug-${config.role}.png` });
throw error;
} finally {
await browser.close();
}
}
async function main() {
const args = process.argv.slice(2);
const role = args.find(a => a.startsWith('--role='))?.split('=')[1] || 'admin';
const outputDir = process.env.AUTH_OUTPUT_DIR || 'playwright/.auth';
const baseUrl = process.env.BASE_URL || 'http://localhost:3000';
const email = process.env.TEST_USER_EMAIL;
const password = process.env.TEST_USER_PASSWORD;
if (!email || !password) {
console.error('❌ TEST_USER_EMAIL and TEST_USER_PASSWORD must be set');
process.exit(1);
}
// Ensure output directory exists
const fs = await import('fs');
if (!fs.existsSync(outputDir)) {
fs.mkdirSync(outputDir, { recursive: true });
}
const configs: AuthConfig[] = [];
switch (role) {
case 'all':
case 'admin':
configs.push({
role: 'admin',
email,
password,
loginUrl: `${baseUrl}/login`,
successUrl: 'dashboard',
outputPath: `${outputDir}/admin.json`,
});
break;
case 'all':
case 'customer':
configs.push({
role: 'customer',
email: process.env.TEST_CUSTOMER_EMAIL || email,
password: process.env.TEST_CUSTOMER_PASSWORD || password,
loginUrl: `${baseUrl}/login`,
successUrl: 'dashboard',
outputPath: `${outputDir}/customer.json`,
});
break;
default:
configs.push({
role,
email,
password,
loginUrl: `${baseUrl}/login`,
successUrl: 'dashboard',
outputPath: `${outputDir}/${role}.json`,
});
}
for (const config of configs) {
await generateAuthProfile(config);
}
console.log(`\n✅ All auth profiles generated in ${outputDir}/`);
}
main().catch((error) => {
console.error('Fatal error:', error);
process.exit(1);
});
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 469k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |