playwright-skill

Automates browser testing and E2E validation of web applications using Playwright.

Updated Apr 4, 2026
One-click install
npx skills add https://github.com/SleyiW/iWana-neXt --skill playwright-skill-sleyiw
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: playwright-skill
Source: https://github.com/SleyiW/iWana-neXt/tree/main/.agents/skills/playwright-skill
Command: npx skills add https://github.com/SleyiW/iWana-neXt --skill playwright-skill-sleyiw

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires playwright, and includes scripts (resource) and references (resource) components.

What problem does it solve? Writing and running reliable browser automation and end-to-end tests is time-consuming, and fragile selectors or hard-coded waits cause flaky results. This Skill provides a ready-to-use Playwright executor, reusable helper utilities, and repo-aligned testing guidance so you can validate web interfaces, forms, navigation, and regressions without building the tooling from scratch. ## Core Features & Use Cases - Universal Playwright Executor: Run automation code from a file, inline argument, or stdin via run.js, with automatic Playwright installation and code wrapping. - Reusable Helper Library: Use lib/helpers.js for browser launching, safe clicks and typing with retries, authentication, table extraction, screenshots, cookie banner handling, and dev server detection. - E2E Testing Guidance: Follow repo-specific conventions for selectors, waits, authentication with storageState, and tenant context verification in Next.js applications. - Use Case: Verify a login flow in a Next.js app by writing a short Playwright script that authenticates via API, navigates to the dashboard, and asserts the tenant name is visible. ## Quick Start Ask the AI to run a Playwright script that opens your local dev server, logs in, and verifies the dashboard page loads correctly.

Frequently Asked Questions about playwright-skill

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run a Playwright script from the command line?

Use node run.js followed by a file path, inline code, or piped stdin input. The executor auto-installs Playwright if missing, wraps bare commands in an async template, and runs the code from the skill directory for correct module resolution.

How do I write stable Playwright selectors for E2E tests?

Prefer getByRole and getByLabel first, then getByText for stable text, and data-testid only as a fallback. Avoid CSS classes and IDs tied to visual structure, since they change frequently and cause flaky tests.

How do I avoid logging in before every Playwright test?

Authenticate programmatically via the API using page.request.post, store the token in localStorage, and reuse it through a custom fixture or storageState. This skips the UI login flow and significantly reduces suite execution time.

Does Playwright support custom HTTP headers for all requests?

Yes, set PW_HEADER_NAME and PW_HEADER_VALUE environment variables for a single header, or PW_EXTRA_HEADERS as a JSON object for multiple headers. The helpers.createContext function merges these into every browser context automatically.

Why are my Playwright tests flaky and how do I fix them?

Flakiness usually comes from hard-coded waitForTimeout delays, fragile selectors, or uncontrolled test data. Replace fixed waits with expect assertions like toBeVisible and waitForURL, use role-based selectors, and ensure test data and authentication state are controlled.