본문으로 건너뛰기
Skillpedia
테스트29k · #9475

generate

하는 일

이 스킬은 에이전트가 앱의 엔드 투 엔드 브라우저 테스트를 작성하게 합니다. 빈 파일에서 시작하지 않고 로그인, 결제, 양식 등의 기능 테스트를 원하는 개발자를 위한 스킬입니다.

사용하는 경우

  • ✓로그인이나 가입 흐름을 위한 테스트를 작성하고 싶을 때.
  • ✓방금 만든 페이지, 컴포넌트, 기능에 대한 테스트가 필요할 때.
  • ✓사용자 스토리를 브라우저 테스트로 바꾸고 싶을 때.

스킬 링크

https://github.com/alirezarezvani/claude-skills/blob/main/engineering-team/playwright-pro/skills/generate/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/alirezarezvani/claude-skills/blob/main/engineering-team/playwright-pro/skills/generate/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이메일 주소와 비밀번호로 로그인하는 사용자를 위한 Playwright 테스트를 작성해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

에이전트는 테스트 설정과 기존 테스트를 읽어 스타일을 맞춘 뒤, 대상 페이지나 컴포넌트를 읽습니다. 맞는 템플릿을 고르고, 설명한 동작에 대한 테스트를 작성합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

Generate Playwright Tests

Generate production-ready Playwright tests from a user story, URL, component name, or feature description.

Input

$ARGUMENTS contains what to test. Examples:

  • "user can log in with email and password"
  • "the checkout flow"
  • "src/components/UserProfile.tsx"
  • "the search page with filters"

Steps

1. Understand the Target

Parse $ARGUMENTS to determine:

  • User story: Extract the behavior to verify
  • Component path: Read the component source code
  • Page/URL: Identify the route and its elements
  • Feature name: Map to relevant app areas

2. Explore the Codebase

Use the Explore subagent to gather context:

  • Read playwright.config.ts for testDir, baseURL, projects
  • Check existing tests in testDir for patterns, fixtures, and conventions
  • If a component path is given, read the component to understand its props, states, and interactions
  • Check for existing page objects in pages/
  • Check for existing fixtures in fixtures/
  • Check for auth setup (auth.setup.ts or storageState config)

3. Select Templates

Check templates/ in this plugin for matching patterns:

If testing... Load template from
Login/auth flow ../pw/templates/auth/login.md
CRUD operations templates/crud/
Checkout/payment templates/checkout/
Search/filter UI templates/search/
Form submission templates/forms/
Dashboard/data templates/dashboard/
Settings page templates/settings/
Onboarding flow templates/onboarding/
API endpoints templates/api/
Accessibility templates/accessibility/

Adapt the template to the specific app — replace {{placeholders}} with actual selectors, URLs, and data.

4. Generate the Test

Follow these rules:

Structure:

import { test, expect } from '@playwright/test';
// Import custom fixtures if the project uses them

test.describe('Feature Name', () => {
  // Group related behaviors

  test('should <expected behavior>', async ({ page }) => {
    // Arrange: navigate, set up state
    // Act: perform user action
    // Assert: verify outcome
  });
});

Locator priority (use the first that works):

  1. getByRole() — buttons, links, headings, form elements
  2. getByLabel() — form fields with labels
  3. getByText() — non-interactive text content
  4. getByPlaceholder() — inputs with placeholder text
  5. getByTestId() — when semantic options aren't available

Assertions — always web-first:

// GOOD — auto-retries
await expect(page.getByRole('heading')).toBeVisible();
await expect(page.getByRole('alert')).toHaveText('Success');

// BAD — no retry
const text = await page.textContent('.msg');
expect(text).toBe('Success');

Never use:

  • page.waitForTimeout()
  • page.$(selector) or page.$$(selector)
  • Bare CSS selectors unless absolutely necessary
  • page.evaluate() for things locators can do

Always include:

  • Descriptive test names that explain the behavior
  • Error/edge case tests alongside happy path
  • Proper await on every Playwright call
  • baseURL-relative navigation (page.goto('/') not page.goto('http://...'))

5. Match Project Conventions

  • If project uses TypeScript → generate .spec.ts
  • If project uses JavaScript → generate .spec.js with require() imports
  • If project has page objects → use them instead of inline locators
  • If project has custom fixtures → import and use them
  • If project has a test data directory → create test data files there

6. Generate Supporting Files (If Needed)

  • Page object: If the test touches 5+ unique locators on one page, create a page object
  • Fixture: If the test needs shared setup (auth, data), create or extend a fixture
  • Test data: If the test uses structured data, create a JSON file in test-data/

7. Verify

Run the generated test:

npx playwright test <generated-file> --reporter=list

If it fails:

  1. Read the error
  2. Fix the test (not the app)
  3. Run again
  4. If it's an app issue, report it to the user

Output

  • Generated test file(s) with path
  • Any supporting files created (page objects, fixtures, data)
  • Test run result
  • Coverage note: what behaviors are now tested
자주 묻는 질문

프로젝트의 기존 테스트 스타일을 따르나요?

네. 무엇을 쓰기 전에 설정, 기존 테스트, 페이지 객체, 픽스처를 확인합니다.

시작하려면 무엇을 주어야 하나요?

사용자 스토리, 페이지 주소, 컴포넌트 파일 경로, 또는 기능에 대한 짧은 설명이면 됩니다.

작성된 테스트를 검토해야 하나요?

네. 커밋 전에 pw-review 검사를 실행하라고 이 스킬이 안내합니다. 흔한 로케이터와 품질 문제를 잡아내기 때문입니다.

상세 정보

작성자의 원본 설명

Use when asked to write Playwright or e2e tests for a page, component or feature ('write tests', 'add tests for', 'e2e test').

repo: alirezarezvani/claude-skills

인기도

GitHub 스타
29k
순위
#9475
라이선스
MIT
업데이트
2026. 11. 2.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬