Playwright Best Practices
SkillWeb & browsingUse 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), test tags (@smoke, @fast, @critical, filtering with --grep), 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.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Playwright Best Practices skill
What this skill tells your AI
The instructions your AI receives, as published by teknokomo/universo-platformo-react in .agents/skills/playwright-best-practices/SKILL.md and read by ahel’s review.
This skill provides comprehensive guidance for all aspects of Playwright test development, from writing new tests to debugging and maintaining existing test suites.
Universo Platformo Repository Rules
These repository-specific rules override the generic Playwright guidance below when working in upstream-universo-platformo-react.
- Use Playwright CLI wrapper commands by default; do not run
pnpm devfor browser E2E testing. - Before running E2E wrappers, verify the shell uses the repository-supported Node runtime. If the non-interactive shell can resolve an older system Node, activate Node 22 explicitly, for example:
export NVM_DIR="$HOME/.nvm"; . "$NVM_DIR/nvm.sh"; nvm use --silent 22; node -v. - The E2E application runs on
http://127.0.0.1:3100, not port3000. - The normal manual application can run on port
3000; do not confuse it with E2E. - For screenshots and browser CLI checks, target
http://127.0.0.1:3100unless the user explicitly asks for the manual app. - Use hosted dedicated Supabase by default through
packages/universo-react-core-backend/.env.e2eor.env.e2e.local. - Use local Supabase only when the user asks for it, when hosted Supabase is unavailable, or when the local-Supabase workflow is the target of the task.
- For local Supabase E2E, use the dedicated E2E Supabase instance and the minimal stack by default.
- Use the full local Supabase stack only when Storage, Realtime, Edge Functions, or logging/analytics are under test.
- Treat
tools/testing/e2e/run-playwright-suite.mjsas the owner of app startup and cleanup. - Repository details live in references/universo-e2e.md.
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
| Activity | Reference Files |
|---|---|
| Writing E2E tests | test-suite-structure.md, locators.md, assertions-waiting.md |
| Writing component tests | component-testing.md, test-suite-structure.md |
| Writing API tests | api-testing.md, test-suite-structure.md |
| Writing GraphQL tests | graphql-testing.md, api-testing.md |
| Writing visual regression tests | visual-regression.md, canvas-webgl.md |
| Structuring test code with POM | page-object-model.md, test-suite-structure.md |
| Setting up test data/fixtures | fixtures-hooks.md, test-data.md |
| Handling authentication | authentication.md, authentication-flows.md |
| Testing date/time features | clock-mocking.md |
| Testing file upload/download | file-operations.md, file-upload-download.md |
| Testing forms/validation | forms-validation.md |
| Testing drag and drop | drag-drop.md |
| Testing accessibility | accessibility.md |
| Testing security (XSS, CSRF) | security-testing.md |
| Using test annotations | annotations.md |
| Using test tags | test-tags.md |
| Testing iframes | iframes.md |
| Testing canvas/WebGL | canvas-webgl.md |
| Internationalization (i18n) | i18n.md |
| Testing Electron apps | electron.md |
| Testing browser extensions | browser-extensions.md |
Mobile & Responsive Testing
When to use: Testing mobile devices, touch interactions, responsive layouts
| Activity | Reference Files |
|---|---|
| Device emulation | mobile-testing.md |
| Touch gestures (swipe, tap) | mobile-testing.md |
| Viewport/breakpoint testing | mobile-testing.md |
| Mobile-specific UI | mobile-testing.md, locators.md |
Real-Time & Browser APIs
When to use: Testing WebSockets, geolocation, permissions, multi-tab flows
| Activity | Reference Files |
|---|---|
| WebSocket/real-time testing | websockets.md |
| Geolocation mocking | browser-apis.md |
| Permission handling | browser-apis.md |
| Clipboard testing | browser-apis.md |
| Camera/microphone mocking | browser-apis.md |
| Multi-tab/popup flows | multi-context.md |
| OAuth popup handling | third-party.md, multi-context.md |
Debugging & Troubleshooting
When to use: Test failures, element not found, timeouts, unexpected behavior
| Activity | Reference Files |
|---|---|
| Debugging test failures | debugging.md, assertions-waiting.md |
| Fixing flaky tests | flaky-tests.md, debugging.md, assertions-waiting.md |
| Debugging flaky parallel runs | flaky-tests.md, performance.md, fixtures-hooks.md |
| Ensuring test isolation / avoiding state leak | flaky-tests.md, fixtures-hooks.md, performance.md |
| Fixing selector issues | locators.md, debugging.md |
| Investigating timeout issues | assertions-waiting.md, debugging.md |
| Using trace viewer | debugging.md |
| Debugging race conditions | flaky-tests.md, debugging.md, assertions-waiting.md |
| Debugging console/JS errors | console-errors.md, debugging.md |
Error & Edge Case Testing
When to use: Testing error states, offline mode, network failures, validation
| Activity | Reference Files |
|---|---|
| Error boundary testing | error-testing.md |
| Network failure simulation | error-testing.md, network-advanced.md |
| Offline mode testing | error-testing.md, service-workers.md |
| Service worker testing | service-workers.md |
| Loading state testing | error-testing.md |
| Form validation testing | error-testing.md |
Multi-User & Collaboration Testing
When to use: Testing features involving multiple users, roles, or real-time collaboration
| Activity | Reference Files |
|---|---|
| Multiple users in one test | multi-user.md |
| Real-time collaboration | multi-user.md, websockets.md |
| Role-based access testing | multi-user.md |
| Concurrent action testing | multi-user.md |
Architecture Decisions
When to use: Choosing test patterns, deciding between approaches, planning test architecture
| Activity | Reference Files |
|---|---|
| POM vs fixtures decision | pom-vs-fixtures.md |
| Test type selection | test-architecture.md |
| Mock vs real services | when-to-mock.md |
| Test suite structure | test-suite-structure.md |
Framework-Specific Testing
When to use: Testing React, Angular, Vue, or Next.js applications
| Activity | Reference Files |
|---|---|
| Testing React apps | react.md |
| Testing Angular apps | angular.md |
| Testing Vue/Nuxt apps | vue.md |
| Testing Next.js apps | nextjs.md |
Refactoring & Maintenance
When to use: Improving existing tests, code review, reducing duplication
| Activity | Reference Files |
|---|---|
| Refactoring to Page Object Model | page-object-model.md, test-suite-structure.md |
| Improving test organization | test-suite-structure.md, page-object-model.md |
| Extracting common setup/teardown | fixtures-hooks.md |
| Replacing brittle selectors | locators.md |
| Removing explicit waits | assertions-waiting.md |
| Creating test data factories | test-data.md |
| Configuration setup | configuration.md |
Infrastructure & Configuration
When to use: Setting up projects, configuring CI/CD, optimizing performance
| Activity | Reference Files |
|---|---|
| Configuring Playwright project | configuration.md, projects-dependencies.md |
| Setting up CI/CD pipelines | ci-cd.md, github-actions.md |
| GitHub Actions setup | github-actions.md |
| GitLab CI setup | gitlab.md |
| Other CI providers | other-providers.md |
| Docker/container setup | docker.md |
| Global setup & teardown | global-setup.md |
| Project dependencies | projects-dependencies.md |
| Optimizing test performance | performance.md, test-suite-structure.md |
| Configuring parallel execution | parallel-sharding.md, performance.md |
| Isolating test data between workers | fixtures-hooks.md, performance.md |
| Test coverage | test-coverage.md |
| Test reporting/artifacts | reporting.md |
Advanced Patterns
When to use: Complex scenarios, API mocking, network interception
| Activity | Reference Files |
|---|---|
| Mocking API responses | test-suite-structure.md, network-advanced.md |
| Network interception | network-advanced.md, assertions-waiting.md |
| GraphQL mocking | network-advanced.md |
| HAR recording/playback | network-advanced.md |
| Custom fixtures | fixtures-hooks.md |
| Advanced waiting strategies | assertions-waiting.md |
| OAuth/SSO mocking | third-party.md, multi-context.md |
| Payment gateway mocking | third-party.md |
| Email/SMS verification mocking | third-party.md |
| Failing on console errors | console-errors.md |
| Security testing (XSS, CSRF) | security-testing.md |
| Performance budgets & Web Vitals | performance-testing.md |
| Lighthouse integration | performance-testing.md |
| Test annotations (skip, fixme) | annotations.md |
| Test tags (@smoke, @fast) | test-tags.md |
| Test steps for reporting | annotations.md |
Quick Decision Tree
Shortened here. Read the whole file on GitHub.
Signals
- GitHub stars
- 22
- Forks
- 3
- Last commit
- Sep 2026
ahel recommends instead
Advanced
- Catalog kind
- skill
- Gateway key
playwright-best-practices-teknokomo- Source
- github.com/teknokomo/universo-platformo-react