generate
alirezarezvani/claude-skills
Playwright 테스트를 생성합니다. 사용자가 “테스트 작성”, “테스트 생성”, “~에 대한 테스트 추가”, “이 컴포넌트 테스트”, “e2e 테스트”, “~에 대한 테스트 생성”, “이 페이지 테스트”, “이 기능 테스트”라고 말할 때 사용합니다.
...모든 것을 확장하십시오generate 소개
이 스킬인 'generate'은 사용자 스토리, URL, 컴포넌트 경로 또는 기능 설명을 기반으로 즉시 프로덕션 환경에 적용 가능한 Playwright 엔드투엔드 테스트를 생성합니다. 이 스킬은 신뢰할 수 있고 관례에 부합하는 브라우저 테스트를 수작업으로 작성해야 하는 문제를 해결합니다. 즉, 아무것도 생성하기 전에 기존 프로젝트를 탐색하여 테스트 디렉터리, 기본 URL, 피처, 페이지 객체 관례를 파악하므로, 출력물은 일반적인 템플릿이 아닌 대상 코드베이스에 정확히 부합합니다.
이 워크플로는 테스트 대상을 분석하고, Explore 서브에이전트를 사용하여 Playwright 구성 및 기존 테스트를 읽은 뒤, 적합한 템플릿(인증, CRUD, 결제, 검색, 양식, 대시보드, 설정, 온보딩, API, 접근성)을 선택하여 실제 선택자와 데이터로 적용합니다. Generate d 테스트는 엄격한 품질 규칙을 따릅니다: 순수 CSS보다 getByRole, getByLabel 및 기타 의미론적 로케이터를 우선시하는 로케이터 우선순위 순서; 웹 우선 자동 재시도 어설션; waitForTimeout, page.$ 선택자, 불필요한 page.evaluate와 같은 안티패턴에 대한 명시적 금지. 이 테스트는 TypeScript 대 JavaScript, 페이지 객체, 피처에 대한 프로젝트 관례와 일치하며, 필요한 경우 페이지 객체, 피처 및 테스트 데이터 파일을 지원하는 generate를 사용할 수 있습니다. 마지막으로 Playwright CLI를 사용하여 generate d 테스트를 실행하고 실패 시 반복 처리를 수행합니다.
이 스킬은 Playwright를 사용하며, 자체 프로젝트 스타일에 맞춰 일관되고 유지 관리가 용이한 e2e 테스트 범위generate를 원하는 웹 개발자 및 QA 엔지니어를 대상으로 합니다. 사용 사례로는 로그인 및 결제 흐름, 양식 유효성 검사, 검색 및 필터링 UI, 컴포넌트 동작 테스트 등이 있습니다. 이 스킬에는 인증, CRUD 및 유효성 검사 흐름에 대한 구체적인 테스트 예제가 담긴 SKILL.md 및 patterns.md 라이브러리가 포함되어 있습니다.
자주 묻는 질문
어떤 입력값을 지원하나요?
사용자 스토리, 컴포넌트 파일 경로, 페이지 또는 URL, 기능 이름 등입니다. 예를 들어, '사용자가 이메일과 비밀번호로 로그인할 수 있다' 또는 'src/components/UserProfile.tsx'와 같은 입력입니다.
어떤 로케이터 및 어설션 스타일을 적용하나요?
의미론적 로케이터(getByRole, getByLabel, getByText, getByPlaceholder, getByTestId 순)를 우선적으로 사용하며, 수동 텍스트 추출 대신 항상 웹 우선 자동 재시도 어설션을 사용합니다.
어떤 안티패턴을 피합니까?
page.waitForTimeout(), page.$/page.$$ 선택자, 피할 수 없는 경우가 아닌 한 순수 CSS 선택자, 또는 로케이터로 처리할 수 있는 작업에 page.evaluate()를 절대 사용하지 않습니다.
작성한 테스트를 검증합니까?
예 — 'npx playwright test
제 프로젝트의 규칙과 호환되나요?
playwright.config.ts와 기존 테스트를 분석하여 TypeScript와 JavaScript의 차이, 기존 페이지 객체, 사용자 정의 피처, test-data 디렉터리를 반영합니다.
모든 파일
2개 파일 SKILL.md 4.4 KB 보기 patterns.md 5.7 KB 보기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.tsfortestDir,baseURL,projects - Check existing tests in
testDirfor 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.tsorstorageStateconfig)
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 themtest.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):
getByRole()— buttons, links, headings, form elementsgetByLabel()— form fields with labelsgetByText()— non-interactive text contentgetByPlaceholder()— inputs with placeholder textgetByTestId()— when semantic options aren't available
Assertions — always web-first:
// GOOD — auto-retriesawait expect(page.getByRole('heading')).toBeVisible();await expect(page.getByRole('alert')).toHaveText('Success');// BAD — no retryconst text = await page.textContent('.msg');expect(text).toBe('Success');
Never use:
page.waitForTimeout()page.$(selector)orpage.$$(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
awaiton every Playwright call baseURL-relative navigation (page.goto('/')notpage.goto('http://...'))
5. Match Project Conventions
- If project uses TypeScript → generate
.spec.ts - If project uses JavaScript → generate
.spec.jswithrequire()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:
- Read the error
- Fix the test (not the app)
- Run again
- 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
generate 설치
스킬 파일을 다운로드하여 .claude/skills/ 디렉터리에 압축을 풀어주세요.
ZIP 다운로드저장소를 클론하고 스킬 파일을 프로젝트에 복사하세요.
git clone https://github.com/alirezarezvani/claude-skills/blob/main/engineering-team/playwright-pro/skills/generate/SKILL.md # Copy SKILL.md to your .claude/skills/ directory
복사





집
