Back to list
nexus-labs-automation

playwright-e2e

by nexus-labs-automation

Custom Claude Code plugins: E2E testing, mobile observability, and more

0🍴 0📅 Jan 12, 2026

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

  1. Test user-visible behavior - Use role-based locators, assert visible outcomes
  2. Isolate every test - Fresh context, own data, no shared state
  3. Use web-first assertions - expect(locator).toBeVisible() auto-waits
  4. Never test third parties - Mock OAuth, external APIs, analytics
  5. Prefer API setup over UI - Seed data via API, test UI separately

Locator Priority (Use in Order)

PriorityMethodExample
1getByRole()getByRole('button', { name: 'Submit' })
2getByLabel()getByLabel('Email address')
3getByText()getByText('Welcome back')
4getByPlaceholder()getByPlaceholder('Search...')
5getByTestId()getByTestId('submit-btn')
6CSS/XPathAVOID - fragile, breaks with styling

Critical Anti-Patterns

  • Never waitForTimeout() - Use web-first assertions instead
  • Never CSS class selectors - .MuiButton-root breaks 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-child
  • references/page-objects.md - POM + fixtures pattern
  • references/auth.md - storageState, multi-role
  • references/network.md - Mocking, HAR recording
  • references/ci-cd.md - GitHub Actions, sharding
  • references/headless-ui.md - Dialog, Menu, Listbox testing
  • references/anti-patterns.md - Full anti-pattern catalog

Score

Total Score

45/100

Based on repository quality metrics

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

Reviews

💬

Reviews coming soon