마지막 수정: 2026년 2월 24일
프론트엔드 개발을 하다 보면 "잘 되던 기능이 갑자기 안 된다"는 상황을 자주 마주한다.
| 층위 | 도구 예시 | 속도 | 신뢰도 | 비용 |
|---|---|---|---|---|
| E2E | Playwright, Cypress | 느림 | 높음 | 높음 |
| 통합/컴포넌트 | Testing Library, Vitest | 보통 | 보통 | 보통 |
| 단위 | Vitest, Jest | 빠름 | 낮음 | 낮음 |
💡 E2E 테스트는 "모든 것을 테스트하는 도구"가 아니다. 가장 중요한 Happy Path를 보호하는 안전망이다.
| 항목 | Cypress | Playwright |
|---|---|---|
| 브라우저 지원 | Chrome 중심 | Chromium, Firefox, WebKit |
| 병렬 실행 | 유료(Cloud) | 내장 지원 |
| 멀티 탭/윈도우 | 미지원 | 지원 |
| 디버깅 도구 | Time Travel | Trace Viewer, UI Mode, Codegen |
npm install -D @playwright/test
npx playwright install --with-deps chromium
// playwright.config.ts
import { defineConfig, devices } from '@playwright/test'
export default defineConfig({
testDir: './e2e',
fullyParallel: true,
retries: process.env.CI ? 2 : 0,
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
screenshot: 'only-on-failure',
},
projects: [
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
],
webServer: {
command: 'npm run dev',
url: 'http://localhost:3000',
reuseExistingServer: !process.env.CI,
},
})
✅ Locator 우선순위:
getByRole>getByLabel>getByText>getByPlaceholder>getByTestId
npx playwright test --ui
npx playwright codegen http://localhost:3000
시작할 때 추천하는 접근법:
storageState로 인증을 한 번에 해결한다getByRole 중심의 안정적인 Locator를 사용한다