
Playwright E2e Init
- 312 installs
- 31 repo stars
- Updated August 2, 2026
- shipshitdev/library
playwright-e2e-init is an agent skill that bootstraps Playwright end-to-end test suites with configs, fixtures, and smoke specs for developers who need CI-ready browser automation on Next.js and React projects.
About
playwright-e2e-init is a version 1.0.0 agent skill from shipshitdev/library that initializes Playwright E2E testing for Next.js and React applications. It performs six setup steps: install @playwright/test and Chromium browsers, create playwright.config.ts with baseURL localhost:3000, CI retries, trace on-first-retry, and a bun run dev webServer; scaffold an e2e/ directory with home.spec.ts, auth.spec.ts, navigation.spec.ts, and fixtures/test-data.ts; add five bun scripts (e2e, e2e:ui, e2e:headed, e2e:debug, e2e:report); and patch GitHub Actions to install browsers, run tests, and upload playwright-report artifacts for 7 days. Best practices recommend data-testid selectors, page objects under e2e/pages/, independent tests, and test.extend fixtures. The library lists playwright-e2e-init among eight Testing-category skills. Use it when a frontend project has unit tests but lacks browser coverage for auth, checkout, or navigation flows.
- Scaffolds Playwright project structure and config
- Adds starter specs and fixture patterns
- Wires CI-friendly headless runs
- Covers cross-browser smoke coverage
- Accelerates regression suites before launch
Playwright E2e Init by the numbers
- 312 all-time installs (skills.sh)
- +5 installs in the week ending Jul 27, 2026 (Skillselion tracking)
- Ranked #692 of 2,153 Testing & QA skills by installs in the Skillselion catalog
- Data as of Aug 3, 2026 (Skillselion catalog sync)
npx skills add https://github.com/shipshitdev/library --skill playwright-e2e-initAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 312 |
|---|---|
| repo stars | ★ 31 |
| Last updated | August 2, 2026 |
| Repository | shipshitdev/library ↗ |
How do you initialize Playwright E2E tests in Next.js?
Bootstrap Playwright end-to-end test suites with configs, fixtures, and first smoke specs so web and hybrid apps get reliable CI-ready browser automation fast.
Who is it for?
Frontend developers adding first Playwright E2E coverage to Next.js or React apps who need working config, example specs, and CI integration in one pass.
Skip if: Backend-only APIs without a browser UI, projects already fully covered by an existing Playwright suite, or teams standardized on Cypress without migration intent.
When should I use this skill?
User asks to add Playwright E2E tests, set up browser automation, scaffold e2e specs, or integrate Playwright into CI for a Next.js or React project.
What you get
playwright.config.ts, e2e/*.spec.ts files, bun/npm test scripts, installed Chromium browsers, and CI workflow steps running Playwright with HTML reports.
- playwright.config.ts
- e2e test specs
- CI workflow Playwright steps
By the numbers
- Skill version 1.0.0 with 6 documented setup steps from install through CI integration
- Scaffolds 3 example spec files: home, auth, and navigation
- Adds 5 bun/npm scripts for running and debugging Playwright tests
Files
Playwright E2E Testing Initialization
Sets up Playwright for end-to-end testing in Next.js and React applications.
When to Use
This skill should be used when:
- Adding E2E tests to a Next.js project
- Setting up browser automation testing
- Creating user flow tests for critical paths
- Integrating E2E tests with CI/CD pipeline
What It Does
1. Installs Playwright and browsers 2. Creates configuration (playwright.config.ts) 3. Sets up test directory (e2e/) 4. Creates example tests for common flows 5. Adds Bun scripts for running tests 6. Updates CI/CD to run E2E tests
Quick Start
Example prompt:
Add Playwright E2E tests to this projectOr be specific:
Set up E2E tests for the authentication flowInstallation
bun add -D @playwright/test
bunx playwright install chromiumConfiguration
playwright.config.ts
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"] } },
],
webServer: {
command: "bun run dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
});Test Structure
e2e/
├── home.spec.ts # Homepage tests
├── auth.spec.ts # Authentication flow
├── navigation.spec.ts # Navigation tests
└── fixtures/
└── test-data.ts # Shared test dataExample Tests
Generate project-specific tests for the actual routes in the codebase. Standard Playwright test patterns (navigation, auth flows, form submission, fixtures) are well-documented at https://playwright.dev/docs/writing-tests — focus inline tests on the project's concrete pages and critical user flows rather than generic examples.
Bun Scripts
Add to package.json:
{
"scripts": {
"e2e": "playwright test",
"e2e:ui": "playwright test --ui",
"e2e:headed": "playwright test --headed",
"e2e:debug": "playwright test --debug",
"e2e:report": "playwright show-report"
}
}CI/CD Integration
GitHub Actions
Add to your CI workflow:
- name: Install Playwright Browsers
run: bunx playwright install --with-deps chromium
- name: Run E2E tests
run: bun run e2e
env:
CI: true
- name: Upload Playwright Report
uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 7Best Practices
- Focus E2E tests on critical user flows: auth, core features, payment/checkout, error handling.
- Use
data-testidattributes for selectors — do not rely on CSS classes or text content. - Use Page Object Model for reusable page interactions (
e2e/pages/). - Keep tests independent: each test sets up and cleans up its own state.
- Use
test.extendfixtures for shared setup (authenticated sessions, seeded data).
Troubleshooting
Tests timing out
Increase timeout in config:
timeout: 60000, // 60 secondsElements not found
Use waitFor:
await page.waitForSelector('[data-testid="element"]');Flaky tests
Add retries and use toPass:
await expect(async () => {
await expect(page.locator("text=Success")).toBeVisible();
}).toPass({ timeout: 10000 });Integration with Other Skills
| Skill | Integration |
|---|---|
testing-cicd-init | Sets up unit tests first |
testing-expert | Provides testing patterns |
debug | Investigates flaky tests and failing browser flows |
{
"name": "playwright-e2e-init",
"version": "1.0.0",
"description": "Initialize Playwright end-to-end testing for Next.js and React projects. Sets up configuration, crea",
"author": {
"name": "Ship Shit Dev",
"email": "hello@shipshit.dev",
"url": "https://shipshit.dev"
},
"license": "MIT",
"skills": "."
}
import { test, expect } from "@playwright/test";
test.describe("Homepage", () => {
test("should load successfully", async ({ page }) => {
await page.goto("/");
// Check that the page has a title
await expect(page).toHaveTitle(/.+/);
// Check that the main content is visible
await expect(page.locator("main")).toBeVisible();
});
test("should have working navigation", async ({ page }) => {
await page.goto("/");
// Find all navigation links
const navLinks = page.locator("nav a");
const count = await navLinks.count();
// Verify navigation exists
expect(count).toBeGreaterThan(0);
});
test("should be responsive", async ({ page }) => {
// Test mobile viewport
await page.setViewportSize({ width: 375, height: 667 });
await page.goto("/");
await expect(page.locator("main")).toBeVisible();
// Test desktop viewport
await page.setViewportSize({ width: 1920, height: 1080 });
await page.goto("/");
await expect(page.locator("main")).toBeVisible();
});
});
test.describe("Accessibility", () => {
test("should have no accessibility violations on homepage", async ({
page,
}) => {
await page.goto("/");
// Check for basic accessibility
// Images should have alt text
const images = page.locator("img");
const imageCount = await images.count();
for (let i = 0; i < imageCount; i++) {
const img = images.nth(i);
const alt = await img.getAttribute("alt");
expect(alt).not.toBeNull();
}
// Buttons should have accessible names
const buttons = page.locator("button");
const buttonCount = await buttons.count();
for (let i = 0; i < buttonCount; i++) {
const button = buttons.nth(i);
const name = await button.getAttribute("aria-label");
const text = await button.textContent();
expect(name || text).toBeTruthy();
}
});
});
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"]],
timeout: 30000,
expect: {
timeout: 5000,
},
use: {
baseURL: "http://localhost:3000",
trace: "on-first-retry",
screenshot: "only-on-failure",
video: "on-first-retry",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},
],
webServer: {
command: "bun run dev",
url: "http://localhost:3000",
reuseExistingServer: !process.env.CI,
timeout: 120 * 1000,
},
});
Related skills
How it compares
Pick playwright-e2e-init over manual Playwright docs when you want opinionated Next.js defaults, example specs, and CI YAML in one bootstrap pass rather than piecemeal setup.
FAQ
What files does playwright-e2e-init create?
playwright-e2e-init creates playwright.config.ts, an e2e/ folder with home, auth, and navigation spec files plus fixtures/test-data.ts, bun/npm scripts for five test commands, and GitHub Actions steps to install browsers and upload reports.
Which frameworks does playwright-e2e-init target?
playwright-e2e-init targets Next.js and React frontend projects. The default config sets baseURL http://localhost:3000 and starts bun run dev as the webServer before tests execute.
What CI settings does playwright-e2e-init recommend?
The skill enables forbidOnly in CI, sets retries to 2, uses one worker, installs Chromium with deps via bunx playwright install --with-deps, and uploads the HTML playwright-report artifact with 7-day retention.