Skip to main content
ClaudeWave
ES, Spanish
Skill443 estrellas del repoactualizado 6d ago

playwright-best-practices

This Playwright testing skill provides resilient locator patterns, Page Object Model architecture, fixture setup, assertion strategies, and network mocking techniques for writing maintainable browser automation tests. Use it when creating or updating Playwright test files (.spec.ts, .test.ts) to ensure tests remain stable across UI changes and follow industry best practices for web testing.

Instalar en Claude Code
Copiar
git clone --depth 1 https://github.com/aiskillstore/marketplace /tmp/playwright-best-practices && cp -r /tmp/playwright-best-practices/skills/0xbigboss/playwright-best-practices ~/.claude/skills/playwright-best-practices
Después abre una sesión nueva de Claude Code; el skill carga automáticamente.

SKILL.md

# 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:

1. `page.getByRole('button', { name: 'Submit' })` — accessibility roles
2. `page.getByLabel('Email')` — form control labels
3. `page.getByPlaceholder('Search...')` — input placeholders
4. `page.getByText('Welcome')` — visible text (non-interactive)
5. `page.getByAltText('Logo')` — image alt text
6. `page.getByTitle('Settings')` — title attributes
7. `page.getByTestId('submit-btn')` — explicit test contracts
8. CSS/XPath — last resort, avoid

## Core Rules

- **Web-first assertions**: always `await expect(locator).toBeVisible()`, never `expect(await locator.isVisible()).toBe(true)` — web-first matchers auto-wait and retry
- **Test isolation**: each test creates its own data; never share state between tests
- **Auth state reuse**: save authenticated state via setup project + `storageState`; never log in via UI in every test
- **Fixtures over beforeEach**: fixtures encapsulate setup + teardown, run on-demand, and compose

## Anti-Patterns

- `page.waitForTimeout(ms)` — use auto-waiting locators instead
- `page.locator('.class')` — use role/label/testid
- XPath selectors — fragile, use user-facing attributes
- Shared state between tests — each test creates own data
- UI login in every test — use setup project + storageState
- Manual assertions without await — use web-first assertions
- Hardcoded waits — rely on Playwright's auto-waiting
- Default reporter in CI/agent — use `--reporter=line` or `--reporter=dot`

## Checklist

- [ ] Locators use role/label/testid, not CSS classes or XPath
- [ ] All assertions use `await expect()` web-first matchers
- [ ] Page objects define locators in constructor
- [ ] No `page.waitForTimeout()` — use auto-waiting
- [ ] Tests isolated — no shared state
- [ ] Auth state reused via setup project
- [ ] Network mocks set up before navigation
- [ ] Test data created per-test or via fixtures
- [ ] Debug logging added for complex flows
- [ ] Minimal reporter (`line`/`dot`) used in CI/agent contexts

See `playwright-patterns.md` for Page Object Model, fixtures, network mocking, and configuration examples.
agy-workerSkill

Let Codex use Google Antigravity CLI (agy) for repository exploration, bounded feature work, and project-scale implementation. Use when a Codex task benefits from delegated repository work while Codex retains diff review, verification, repair, and delivery assurance.

always-current-datetimeSkill

Use when replying. Refresh current date and time.

archifySkill

Create polished, validated architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as explorable standalone HTML with inline SVG, dark/light themes, optional trace motion, and PNG/JPEG/WebP/SVG/WebM export. Accept plain-language requirements or pasted Mermaid flowchart, sequenceDiagram, and stateDiagram input; inspect repository evidence when the diagram must reflect real code. Use when the user asks to visualize system architecture, infrastructure, cloud/security/network topology, technical workflows, API call sequences, request lifecycles, data pipelines, ETL/ELT, data lineage, state machines, or to convert/beautify Mermaid.

architectSkill

Design systems, plan implementations, review architecture decisions - Use when you need to plan a complex feature, design system architecture, or make high-level technical decisions.

axe-ios-simulatorSkill

Use when automating iOS Simulator interactions, capturing screenshots/video, or inspecting accessibility via AXe CLI.

canton-network-reposSkill

Use when working with Canton Network participants, DAML smart contracts, Splice applications, or debugging LF version and package ID issues.

caveman-setupSkill

>

chinese-learning-assistantSkill

HSK4級レベルから流暢さを目指す学習者向け。中国語表現の使用場面・自然さを分析し、作文を「ネイティブらしい流暢な表現」に改善。bilibili等のコンテンツ理解とネイティブとの会話をサポート。実際の用例をWeb検索で提示