Playwright Best Practices
Playwright test guidance that enforces role-based locators, web-first assertions, and isolated, auth-reused tests.
- CCM score
- 46 of 100
- skills.sh installs
- 380
- GitHub stars
- 49
- last updated
- Jun 3, 2026
Own this skill? Claim it
What it does
- Covers locator priority from accessibility roles down to CSS and XPath, with CSS and XPath treated as last resort
- Includes core rules for web-first assertions, per-test data isolation, storageState auth reuse, and fixtures over beforeEach
- Enforces a minimal
lineordotreporter for CLI and CI runs to keep test output from overflowing agent context - Designed for writing or modifying Playwright
.spec.tsand.test.tsfiles that import@playwright/test
Install
$ npx -y skills add alleneubank/claude-code --skill playwright-best-practices -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Playwright Best Practices
CLI Context: Prevent Context Overflow
When running Playwright tests from Claude Code or any CLI agent, always use minimal reporters to prevent verbose output from consuming the context window.
Use --reporter=line or --reporter=dot for CLI test runs. Configure playwright.config.ts to default to minimal reporters when CI or CLAUDE env vars are set — see playwright-patterns.md for the config snippet.
Locator Priority (Most to Least Resilient)
Always prefer user-facing attributes:
page.getByRole('button', { name: 'Submit' })— accessibility rolespage.getByLabel('Email')— form control labelspage.getByPlaceholder('Search...')— input placeholderspage.getByText('Welcome')— visible text (non-interactive)page.getByAltText('Logo')— image alt textpage.getByTitle('Settings')— title attributespage.getByTestId('submit-btn')— explicit test contracts- CSS/XPath — last resort, avoid
Core Rules
Details
- Repository
- github.com/alleneubank/claude-code
- Categories
- Testing & QA, Browser Automation & Scraping
- First seen
- Jun 3, 2026
Questions
What does the playwright-best-practices skill do?
playwright-best-practices guides an agent when it writes or modifies Playwright tests in .spec.ts or .test.ts files that import @playwright/test. It steers locator choice toward role, label and test id selectors, prefers web-first assertions, and reuses saved auth state through a setup project and storageState.
How do I install playwright-best-practices?
Run npx -y skills add alleneubank/claude-code --skill playwright-best-practices -y in your project. Once installed, playwright-best-practices loads when the agent edits Playwright test files, and its checklist covers isolation, fixtures and minimal reporters for CLI runs.
Where does playwright-best-practices fit among Testing & QA skills?
playwright-best-practices is listed in the Testing & QA category with tdd, webapp-testing and break-ui. Its focus is narrower than general test-driven development: it targets Playwright specifically, covering selector priority, anti-patterns such as waitForTimeout, and reporter settings that keep agent output short.
Does playwright-best-practices need any tools or accounts?
playwright-best-practices needs an agent that can read and edit Playwright test files, and a project where Playwright is set up. Its own SKILL.md references a playwright-patterns.md file for configuration and Page Object examples.
More from alleneubank/claude-code
All 8Similar to Playwright Best Practices
More Testing & QAplaywright-cursor-rulesmindrally/skills743 installsExpert Playwright end-to-end testing guidance for TypeScript and JavaScript with role-based locators and web-first assertions.
playwright-skilltestdino-hq/playwright-skill6.2K installsCurrent Playwright 1.64 guidance for writing, debugging, and scaling E2E, API, visual, and accessibility test suites.
playwrightmindrally/skills1.2K installsBest-practice guide for Playwright end-to-end tests, covering test structure, locators, assertions, and configuration.
playwright-coretestdino-hq/playwright-skill1.2K installsOpinionated Playwright testing guide spanning 50 references for E2E, API, visual, accessibility, and debugging work.
playwright-testingalinaqi/maggy3.4K installsPlaywright E2E testing skill covering page objects, locator strategy, auth setup, and cross-browser CI configuration.
playwright-e2e-testingfugazi/test-automation-skills-agents653 installsAuthoring and maintaining versioned Playwright TypeScript UI specs for browser user flows, with API-setup and mocking.