CtrlK
BlogDocsLog inGet started
Tessl Logo

playwright-best-practices

Provides comprehensive guidance for writing, debugging, and maintaining Playwright tests in TypeScript. Use when writing Playwright tests, fixing flaky tests, debugging failures, implementing Page Object Model, configuring CI/CD, optimizing performance, mocking APIs, handling authentication or OAuth, testing accessibility (axe-core), file uploads/downloads, date/time mocking, WebSockets, geolocation, permissions, multi-tab/popup flows, mobile/responsive layouts, touch gestures, GraphQL, error handling, offline mode, multi-user collaboration, third-party services (payments, email verification), console error monitoring, global setup/teardown, test annotations (skip, fixme, slow), project dependencies, security testing (XSS, CSRF, auth), performance budgets (Web Vitals, Lighthouse), iframes, component testing, canvas/WebGL, service workers/PWA, test coverage, i18n/localization, Electron apps, or browser extension testing. Covers E2E, component, API, visual, accessibility, security, Electron, and extension testing.

Install with Tessl CLI

npx tessl i github:currents-dev/playwright-best-practices-skill --skill playwright-best-practices
What are skills?

Overall
score

18%

Does it follow best practices?

Validation for skill structure

Validation failed for this skill
This skill has errors that need to be fixed before it can move to Implementation and Discovery review.
SKILL.md
Review
Evals

Playwright Best Practices

This skill provides comprehensive guidance for all aspects of Playwright test development, from writing new tests to debugging and maintaining existing test suites.

Activity-Based Reference Guide

Consult these references based on what you're doing:

Writing New Tests

When to use: Creating new test files, writing test cases, implementing test scenarios

ActivityReference Files
Writing E2E teststest-organization.md, locators.md, assertions-waiting.md
Writing component testscomponent-testing.md, test-organization.md
Writing API teststest-organization.md, assertions-waiting.md
Writing visual regression teststest-organization.md, canvas-webgl.md
Structuring test code with POMpage-object-model.md, test-organization.md
Setting up test data/fixturesfixtures-hooks.md, test-data.md
Handling authenticationfixtures-hooks.md, third-party.md
Testing date/time featuresclock-mocking.md
Testing file upload/downloadfile-operations.md
Testing accessibilityaccessibility.md
Testing security (XSS, CSRF)security-testing.md
Using test annotationsannotations.md
Testing iframesiframes.md
Testing canvas/WebGLcanvas-webgl.md
Internationalization (i18n)i18n.md
Testing Electron appselectron.md
Testing browser extensionsbrowser-extensions.md

Mobile & Responsive Testing

When to use: Testing mobile devices, touch interactions, responsive layouts

ActivityReference Files
Device emulationmobile-testing.md
Touch gestures (swipe, tap)mobile-testing.md
Viewport/breakpoint testingmobile-testing.md
Mobile-specific UImobile-testing.md, locators.md

Real-Time & Browser APIs

When to use: Testing WebSockets, geolocation, permissions, multi-tab flows

ActivityReference Files
WebSocket/real-time testingwebsockets.md
Geolocation mockingbrowser-apis.md
Permission handlingbrowser-apis.md
Clipboard testingbrowser-apis.md
Camera/microphone mockingbrowser-apis.md
Multi-tab/popup flowsmulti-context.md
OAuth popup handlingthird-party.md, multi-context.md

Debugging & Troubleshooting

When to use: Test failures, element not found, timeouts, unexpected behavior

ActivityReference Files
Debugging test failuresdebugging.md, assertions-waiting.md
Fixing flaky testsflaky-tests.md, debugging.md, assertions-waiting.md
Debugging flaky parallel runsflaky-tests.md, performance.md, fixtures-hooks.md
Ensuring test isolation / avoiding state leakflaky-tests.md, fixtures-hooks.md, performance.md
Fixing selector issueslocators.md, debugging.md
Investigating timeout issuesassertions-waiting.md, debugging.md
Using trace viewerdebugging.md
Debugging race conditionsflaky-tests.md, debugging.md, assertions-waiting.md
Debugging console/JS errorsconsole-errors.md, debugging.md

Error & Edge Case Testing

When to use: Testing error states, offline mode, network failures, validation

ActivityReference Files
Error boundary testingerror-testing.md
Network failure simulationerror-testing.md, network-advanced.md
Offline mode testingerror-testing.md, service-workers.md
Service worker testingservice-workers.md
Loading state testingerror-testing.md
Form validation testingerror-testing.md

Multi-User & Collaboration Testing

When to use: Testing features involving multiple users, roles, or real-time collaboration

ActivityReference Files
Multiple users in one testmulti-user.md
Real-time collaborationmulti-user.md, websockets.md
Role-based access testingmulti-user.md
Concurrent action testingmulti-user.md

Refactoring & Maintenance

When to use: Improving existing tests, code review, reducing duplication

ActivityReference Files
Refactoring to Page Object Modelpage-object-model.md, test-organization.md
Improving test organizationtest-organization.md, page-object-model.md
Extracting common setup/teardownfixtures-hooks.md
Replacing brittle selectorslocators.md
Removing explicit waitsassertions-waiting.md
Creating test data factoriestest-data.md

Infrastructure & Configuration

When to use: Setting up projects, configuring CI/CD, optimizing performance

ActivityReference Files
Configuring Playwright projecttest-organization.md, projects-dependencies.md
Setting up CI/CD pipelinesci-cd.md, performance.md
Global setup & teardownglobal-setup.md
Project dependenciesprojects-dependencies.md
Optimizing test performanceperformance.md, test-organization.md
Configuring parallel executionperformance.md
Isolating test data between workersfixtures-hooks.md, performance.md
Test coveragetest-coverage.md

Advanced Patterns

When to use: Complex scenarios, API mocking, network interception

ActivityReference Files
Mocking API responsestest-organization.md, network-advanced.md
Network interceptionnetwork-advanced.md, assertions-waiting.md
GraphQL mockingnetwork-advanced.md
HAR recording/playbacknetwork-advanced.md
Custom fixturesfixtures-hooks.md
Advanced waiting strategiesassertions-waiting.md
OAuth/SSO mockingthird-party.md, multi-context.md
Payment gateway mockingthird-party.md
Email/SMS verification mockingthird-party.md
Failing on console errorsconsole-errors.md
Security testing (XSS, CSRF)security-testing.md
Performance budgets & Web Vitalsperformance-testing.md
Lighthouse integrationperformance-testing.md
Test annotations (skip, fixme)annotations.md
Test steps for reportingannotations.md

Quick Decision Tree

What are you doing?
│
├─ Writing a new test?
│  ├─ E2E test → test-organization.md, locators.md, assertions-waiting.md
│  ├─ Component test → component-testing.md
│  ├─ API test → test-organization.md, assertions-waiting.md
│  ├─ Visual/canvas test → canvas-webgl.md, test-organization.md
│  ├─ Accessibility test → accessibility.md
│  ├─ Mobile/responsive test → mobile-testing.md
│  ├─ i18n/locale test → i18n.md
│  ├─ Electron app test → electron.md
│  ├─ Browser extension test → browser-extensions.md
│  └─ Multi-user test → multi-user.md
│
├─ Testing specific features?
│  ├─ File upload/download → file-operations.md
│  ├─ Date/time dependent → clock-mocking.md
│  ├─ WebSocket/real-time → websockets.md
│  ├─ Geolocation/permissions → browser-apis.md
│  ├─ OAuth/SSO mocking → third-party.md, multi-context.md
│  ├─ Payments/email/SMS → third-party.md
│  ├─ iFrames → iframes.md
│  ├─ Canvas/WebGL/charts → canvas-webgl.md
│  ├─ Service workers/PWA → service-workers.md
│  ├─ i18n/localization → i18n.md
│  ├─ Security (XSS, CSRF) → security-testing.md
│  └─ Performance/Web Vitals → performance-testing.md
│
├─ Test is failing/flaky?
│  ├─ Flaky test investigation → flaky-tests.md
│  ├─ Element not found → locators.md, debugging.md
│  ├─ Timeout issues → assertions-waiting.md, debugging.md
│  ├─ Race conditions → flaky-tests.md, debugging.md
│  ├─ Flaky only with multiple workers → flaky-tests.md, performance.md
│  ├─ State leak / isolation → flaky-tests.md, fixtures-hooks.md
│  ├─ Console/JS errors → console-errors.md, debugging.md
│  └─ General debugging → debugging.md
│
├─ Testing error scenarios?
│  ├─ Network failures → error-testing.md, network-advanced.md
│  ├─ Offline (unexpected) → error-testing.md
│  ├─ Offline-first/PWA → service-workers.md
│  ├─ Error boundaries → error-testing.md
│  └─ Form validation → error-testing.md
│
├─ Refactoring existing code?
│  ├─ Implementing POM → page-object-model.md
│  ├─ Improving selectors → locators.md
│  ├─ Extracting fixtures → fixtures-hooks.md
│  └─ Creating data factories → test-data.md
│
├─ Setting up infrastructure?
│  ├─ CI/CD → ci-cd.md
│  ├─ Global setup/teardown → global-setup.md
│  ├─ Project dependencies → projects-dependencies.md
│  ├─ Test performance → performance.md
│  ├─ Test coverage → test-coverage.md
│  └─ Project config → test-organization.md, projects-dependencies.md
│
└─ Organizing tests?
   ├─ Skip/fixme/slow tests → annotations.md
   ├─ Test steps → annotations.md
   └─ Conditional execution → annotations.md

Test Validation Loop

After writing or modifying tests:

  1. Run tests: npx playwright test --reporter=list
  2. If tests fail:
    • Review error output and trace (npx playwright show-trace)
    • Fix locators, waits, or assertions
    • Re-run tests
  3. Only proceed when all tests pass
  4. Run multiple times for critical tests: npx playwright test --repeat-each=5
Repository
github.com/currents-dev/playwright-best-practices-skill
Last updated
Created

Is this your skill?

If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.