← スキル一覧に戻る

playwright-e2e
by nexus-labs-automation
Custom Claude Code plugins: E2E testing, mobile observability, and more
⭐ 0🍴 0📅 2026年1月12日
SKILL.md
name: playwright-e2e description: This skill should be used when the user asks to "write playwright test", "e2e test", "playwright locator", "test isolation", "page object", or needs guidance on Playwright E2E testing patterns, locator strategies, test structure, or debugging flaky tests.
Playwright E2E Testing
Write tests that mimic user behavior, not implementation details.
Core Principles
- Test user-visible behavior - Use role-based locators, assert visible outcomes
- Isolate every test - Fresh context, own data, no shared state
- Use web-first assertions -
expect(locator).toBeVisible()auto-waits - Never test third parties - Mock OAuth, external APIs, analytics
- Prefer API setup over UI - Seed data via API, test UI separately
Locator Priority (Use in Order)
| Priority | Method | Example |
|---|---|---|
| 1 | getByRole() | getByRole('button', { name: 'Submit' }) |
| 2 | getByLabel() | getByLabel('Email address') |
| 3 | getByText() | getByText('Welcome back') |
| 4 | getByPlaceholder() | getByPlaceholder('Search...') |
| 5 | getByTestId() | getByTestId('submit-btn') |
| 6 | CSS/XPath | AVOID - fragile, breaks with styling |
Critical Anti-Patterns
- Never
waitForTimeout()- Use web-first assertions instead - Never CSS class selectors -
.MuiButton-rootbreaks on updates - Never XPath - Hard to read, brittle
- Never test dependencies - Tests affect each other
- Never skip isolation - Parallel execution will fail
Quick Patterns
// ✅ Good: Role-based, auto-waiting
await expect(page.getByRole('button', { name: 'Save' })).toBeEnabled();
await page.getByRole('button', { name: 'Save' }).click();
// ❌ Bad: CSS selector, manual wait
await page.waitForTimeout(2000);
await page.locator('.save-btn').click();
References
For detailed patterns, see:
references/locators.md- Chaining, filtering, nth-childreferences/page-objects.md- POM + fixtures patternreferences/auth.md- storageState, multi-rolereferences/network.md- Mocking, HAR recordingreferences/ci-cd.md- GitHub Actions, shardingreferences/headless-ui.md- Dialog, Menu, Listbox testingreferences/anti-patterns.md- Full anti-pattern catalog
スコア
総合スコア
45/100
リポジトリの品質指標に基づく評価
✓SKILL.md
SKILL.mdファイルが含まれている
+20
○LICENSE
ライセンスが設定されている
0/10
○説明文
100文字以上の説明がある
0/10
○人気
GitHub Stars 100以上
0/15
○最近の活動
3ヶ月以内に更新がある
0/10
○フォーク
10回以上フォークされている
0/5
✓Issue管理
オープンIssueが50未満
+5
○言語
プログラミング言語が設定されている
0/5
○タグ
1つ以上のタグが設定されている
0/5
レビュー
💬
レビュー機能は近日公開予定です