Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

e2e-playwright-testing

БесплатноБез исполняемых скриптовНе проверен

End-to-end testing with Playwright for web applications. Use when writing E2E tests, browser automation, form submission testing, or user flow testing…

AsyrafHussinот AsyrafHussin★ 112 звёзд на GitHub

Об этом скилле

E2E Playwright Testing

Patterns and conventions for reliable end-to-end browser testing with Playwright.

Comprehensive E2E testing guide for web applications. Contains 10 rules across 6 categories covering locator strategies, authentication reuse, form testing (including React/SPA-specific gotchas), assertions, test organization, reliability, and CI/CD configuration.

Stack Detection

Before writing or reviewing E2E tests, detect the project stack:

Step 1 — Check for Playwright

# Look in package.json devDependencies:
# "@playwright/test" → Playwright is installed
# Check for playwright.config.js or playwright.config.ts
  • If @playwright/test is present → use Playwright patterns from this skill
  • If cypress is present → this skill does not apply

Step 2 — Detect Frontend Framework

# Check package.json dependencies:
# "react" + "@inertiajs/react" → React + Inertia.js (SPA with server routing)
# "react" + "react-router" → React SPA
# "vue" → Vue.js
# "next" → Next.js

Why this matters:

  • React + Inertia.js: Use waitForURL not waitForLoadState('networkidle') — Inertia uses history.pushState
  • React controlled inputs: fill() works for text and for native date/time inputs when given the ISO value (2026-04-16, 14:30); a locale-formatted value is silently ignored
  • SPA navigation: Page doesn't do full reload — assertions must wait for content, not network idle

Step 3 — Detect Auth Pattern

# Check for session-based (Laravel Sanctum) or token-based (JWT) auth
# Session: storageState saves cookies
# Token: may need to save tokens to localStorage

Step 4 — Detect Rate Limiting

# Check routes for throttle middleware
# If present in dev, tests will hit 429 after ~5 login attempts
# Solution: production-only throttle or increase limits in test env

Metadata

  • Version: 1.1.0
  • Rule Count: 10 rules across 6 categories
  • Targets: Playwright 1.65+ on Node.js 22+ (1.65 no longer tests on Node.js 20)
  • Last Updated: November 2026
  • License: MIT

When to Apply

  • Writing or reviewing Playwright E2E tests
  • Setting up E2E testing for a new project
  • Debugging flaky browser tests
  • Testing form submissions, authentication flows, or user interactions
  • Choosing locator strategies for elements
  • Configuring Playwright for CI/CD

Rule Categories by Priority

Priority Category Impact Prefix
1 Locators CRITICAL loc
2 Authentication CRITICAL auth
3 Assertions HIGH assert
4 Forms & Inputs HIGH form
5 Test Organization MEDIUM org
6 Reliability MEDIUM rel

Quick Reference

1. Locators (CRITICAL)

  • loc-prefer-role-locators - Use getByRole/getByLabel over CSS selectors
  • loc-strict-mode - Handle strict mode violations with exact, scoping and filter() (not .first())

2. Authentication (CRITICAL)

  • auth-storage-state - Reuse login state via setup project pattern

3. Assertions (HIGH)

  • assert-web-first - Use auto-retrying expect(locator) assertions
  • assert-aria-snapshot - Assert region structure with toMatchAriaSnapshot()

4. Forms & Inputs (HIGH)

  • form-react-date-inputs - fill() date/time inputs with ISO values (YYYY-MM-DD, HH:mm)
  • form-custom-checkboxes - Click the label of sr-only checkboxes; check() is blocked when covered

5. Test Organization (MEDIUM)

  • org-mirror-routes - Directory structure mirrors route groups

6. Reliability (MEDIUM)

  • rel-no-wait-for-timeout - Never use arbitrary waitForTimeout
  • rel-flaky-tooling - --repeat-each, --last-failed, --only-changed, failOnFlakyTests

Essential Patterns

Locator Priority

// Order as listed in the Playwright locators guide
// 1st: Role (best — mirrors accessibility)
page.getByRole('button', { name: 'Submit' })
page.getByRole('tab', { name: 'Network' })
page.getByRole('heading', { name: 'Dashboard' })

// 2nd: Text (for non-interactive content, use exact when ambiguous)
page.getByText('Welcome', { exact: true })

// 3rd: Label (the first choice for form fields)
page.getByLabel('Email')

// Then: placeholder, alt text, title
page.getByPlaceholder('Search orders')
page.getByAltText('Company logo')

// Fallback: test id (no usable role or text)
page.getByTestId('revenue-chart')

// Last resort: CSS / XPath
page.locator('button.submit-btn')

Auth Setup Pattern

// Setup project logs in once per role and saves playwright/.auth/<role>.json
// (git-ignored); the config sets the default role's storageState
// 2 logins for 90+ tests (not 90 logins)

// In a test file that needs another role:
test.use({ storageState: 'playwright/.auth/admin.json' });
test('shows the approval queue', async ({ page }) => {
    await page.goto('/admin/orders');
    await expect(page.getByRole('heading', { name: 'Approval queue' })).toBeVisible();
})
Полный SKILL.md на GitHub

Установить e2e-playwright-testing в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

AGENTS.mdREADME.mdmetadata.jsonrules/_sections.mdrules/_template.mdrules/assert-aria-snapshot.mdrules/assert-web-first.mdrules/auth-storage-state.mdrules/form-custom-checkboxes.mdrules/form-react-date-inputs.mdrules/loc-prefer-role-locators.mdrules/loc-strict-mode.mdrules/org-mirror-routes.mdrules/rel-flaky-tooling.mdrules/rel-no-wait-for-timeout.md

FAQ

Что делает скилл e2e-playwright-testing?

End-to-end testing with Playwright for web applications. Use when writing E2E tests, browser automation, form submission testing, or user flow testing. Triggers on "playwright", "e2e test", "browser test", "end-to-end", "form flow testing", or test files in tests/e2e/.

Как установить скилл e2e-playwright-testing?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл e2e-playwright-testing запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить e2e-playwright-testing с