Communitygithub.com

YepAPI/skills

Playwright 패턴: 페이지 객체, 로케이터 모범 사례, CI 통합, 시각적 회귀 테스트, 병렬 실행

skills란 무엇인가요?

이 스킬은 Playwright를 활용한 E2E(종단 간) 테스트에 대한 포괄적인 가이드를 제공합니다. 개발자와 QA 엔지니어가 페이지 객체 모델(POM), 로케이터 우선순위(role 기반 > label > placeholder > testId > CSS), 테스트 격리 및 병렬 실행과 같은 모범 사례를 적용할 수 있도록 도와줍니다. CI/CD 환경에서 헤드리스 모드 실행, 재시도(retries) 설정, 실패 시 Trace 수집 등을 지원하며, 시각적 회귀 테스트를 위해 `expect(page).toHaveScreenshot()` 사용법을 포함합니다. 주요 대상 플랫폼은 Claude Code, Cursor, Codex 등 AI 에이전트와 통합된 개발 환경이며, 실제 웹 애플리케이션의 신뢰성과 유지보수성을 높이는 데 초점을 맞춥니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/YepAPI/skills/tree/HEAD/skills/e2e-testing

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

E2E 테스트

규칙

  • E2E에는 Playwright 사용 — 크로스 브라우저, 자동 대기, 내장 테스트 러너, 우수한 CI 지원
  • 로케이터 우선순위: getByRole() > getByLabel() > getByPlaceholder() > getByTestId() > CSS 선택자
  • 페이지 객체 모델: 페이지 상호작용을 클래스로 캡슐화 — LoginPage.login(email, password)
  • 테스트 격리: 각 테스트는 새로운 상태에서 시작 — 설정에는 beforeEach 사용, 테스트 간 의존성 금지
  • 자동 대기: Playwright가 요소를 자동으로 기다림 — 수동 waitForTimeout() 호출 금지
  • 단언문: expect(locator) 웹 우선 단언문 사용 — toBeVisible(), toHaveText(), toHaveURL()
  • 병렬 실행: 기본적으로 테스트가 병렬로 실행됨 — 테스트 간 공유 가능한 변경 상태 없어야 함
  • CI: 헤드리스 모드 실행, 재시도 구성(CI에서 retries: 2), 실패 시 Trace 업로드
  • 시각적 회귀 테스트: expect(page).toHaveScreenshot() — --update-snapshots로 기준 스냅샷 업데이트

패턴

// 페이지 객체 모델
class LoginPage {
  constructor(private page: Page) {}
  async goto() { await this.page.goto("/login"); }
  async login(email: string, password: string) {
    await this.page.getByLabel("Email").fill(email);
    await this.page.getByLabel("Password").fill(password);
    await this.page.getByRole("button", { name: "Sign in" }).click();
    await this.page.waitForURL("/dashboard");
  }
}

// playwright.config.ts
export default defineConfig({
  retries: process.env.CI ? 2 : 0,
  use: { trace: "on-first-retry", screenshot: "only-on-failure" },
  projects: [
    { name: "chromium", use: { ...devices["Desktop Chrome"] } },
    { name: "mobile", use: { ...devices["Pixel 5"] } },
  ],
});

피해야 할 것

  • page.waitForTimeout() — 자동 대기 또는 waitForURL(), waitForResponse() 사용
  • 상호작용 요소에 CSS 선택자 사용 — role 기반 로케이터를 사용하여 안정성 확보
  • 다른 테스트의 상태에 의존하는 테스트 — 각 테스트는 독립적으로 실행 가능해야 함
  • 제3자 서비스 직접 테스트 — page.route()로 외부 API 모킹
  • 모바일 뷰포트 생략 — 프로젝트 매트릭스에 최소 하나의 모바일 기기 테스트 포함

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

YepAPI/skills

WCAG 2.1 AA — semantic HTML, keyboard navigation, screen readers.

YepAPI/skills

Experiment setup, variant splitting, statistical significance, and feature flag integration.

YepAPI/skills

CRUD generators, data tables, user management, role-based access, and bulk operations.

YepAPI/skills

Monitor what ChatGPT and Gemini say about your brand using YepAPI.

YepAPI/skills

Queue workers with BullMQ/Inngest/Trigger.dev, job retries, dead letter queues, concurrency.

YepAPI/skills

Commander.js, interactive prompts with Clack, spinners, colors, config files, exit codes, and npm publishing.

YepAPI/skills

cmdk integration, Cmd+K trigger, fuzzy search, grouped actions, keyboard navigation, and dynamic action registration.

YepAPI/skills

Content planning with trend and sentiment data from YepAPI.

YepAPI/skills

Content calendar, keyword-driven planning, and content briefs.

YepAPI/skills

Theme switching with CSS variables, system preference detection, next-themes, and persistence.

YepAPI/skills

Threaded comments, @mentions, reactions, moderation queue, optimistic UI, and cursor pagination.

YepAPI/skills

Competitive analysis between domains using YepAPI.

YepAPI/skills

Layout grids, KPI cards, data tables with sorting/filtering, sidebar navigation, and responsive breakpoints.

YepAPI/skills

Data encryption — TLS everywhere, AES-256-GCM for PII, bcrypt passwords, encrypted backups.

YepAPI/skills

Chart patterns with Recharts/Nivo/D3, responsive containers, color scales, and accessibility.

YepAPI/skills

Drizzle schema definition, push vs migrate, type-safe queries, relations, transactions, and prepared statements.

YepAPI/skills

Upload handling, resize/compress, CDN delivery, blur placeholders, and next/image patterns.

YepAPI/skills

Local business and Google Maps research using YepAPI.

YepAPI/skills

Cursor-based pagination, IntersectionObserver, virtualized lists with @tanstack/react-virtual, and scroll position restoration.

YepAPI/skills

Chat UI components, streaming responses with AI SDK, context window management, and RAG patterns.

관련 스킬