← ClaudeAtlas

initlisted

Set up Playwright in a project. Use when user says "set up playwright", "add e2e tests", "configure playwright", "testing setup", "init playwright", or "add test infrastructure".
adriannoes/awesome-vibe-coding · ★ 38 · AI & Automation · score 83
Install: claude install-skill adriannoes/awesome-vibe-coding
# Initialize Playwright Project Set up a production-ready Playwright testing environment. Detect the framework, generate config, folder structure, example test, and CI workflow. ## Steps ### 1. Analyze the Project Use the `Explore` subagent to scan the project: - Check `package.json` for framework (React, Next.js, Vue, Angular, Svelte) - Check for `tsconfig.json` → use TypeScript; otherwise JavaScript - Check if Playwright is already installed (`@playwright/test` in dependencies) - Check for existing test directories (`tests/`, `e2e/`, `__tests__/`) - Check for existing CI config (`.github/workflows/`, `.gitlab-ci.yml`) ### 2. Install Playwright If not already installed: ```bash npm init playwright@latest -- --quiet ``` Or if the user prefers manual setup: ```bash npm install -D @playwright/test npx playwright install --with-deps chromium ``` ### 3. Generate `playwright.config.ts` Adapt to the detected framework: **Next.js:** ```typescript import { defineConfig, devices } from '@playwright/test'; export default defineConfig({ testDir: './e2e', fullyParallel: true, forbidOnly: !!process.env.CI, retries: process.env.CI ? 2 : 0, workers: process.env.CI ? 1 : undefined, reporter: [ ['html', { open: 'never' }], ['list'], ], use: { baseURL: 'http://localhost:3000', trace: 'on-first-retry', screenshot: 'only-on-failure', }, projects: [ { name: "chromium", use: { ...devices['Desktop Chrome'] } }, { name: "firefox", use: {