본문으로 건너뛰기
Skillpedia
테스트41k · #6678

e2e-testing-patterns

하는 일

이 스킬은 웹사이트와 애플리케이션을 위한 자동화된 테스트를 만드는 방법을 가르칩니다. 이 테스트들은 모든 것이 기대대로 작동하는지 확인해, 사용자가 보기 전에 버그를 찾는 데 도움을 줍니다.

사용하는 경우

  • ✓웹사이트를 위한 자동화된 테스트를 만들 때.
  • ✓명확한 이유 없이 자동 테스트가 실패할 때.
  • ✓프로젝트 테스트의 규칙을 정하는 경우.

스킬 링크

https://github.com/wshobson/agents/blob/main/plugins/developer-essentials/skills/e2e-testing-patterns/SKILL.md

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

사용 방법

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

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

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

AI에게 요청하는 예시

“제 웹사이트가 여러 브라우저에서 잘 작동하도록 하려면 어떻게 해야 할까요?”

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

작동 방식

가장 중요한 테스트 유형(실제 사용자 상호작용을 흉내 내는 테스트 등)과 이를 효율적으로 작성하는 방법을 설명합니다. 인기 있는 도구로 실용적인 예시를 사용합니다.

기술 내용 (원본 SKILL.md)

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

E2E Testing Patterns

Build reliable, fast, and maintainable end-to-end test suites that provide confidence to ship code quickly and catch regressions before users do.

When to Use This Skill

  • Implementing end-to-end test automation
  • Debugging flaky or unreliable tests
  • Testing critical user workflows
  • Setting up CI/CD test pipelines
  • Testing across multiple browsers
  • Validating accessibility requirements
  • Testing responsive designs
  • Establishing E2E testing standards

Core Concepts

1. E2E Testing Fundamentals

What to Test with E2E:

  • Critical user journeys (login, checkout, signup)
  • Complex interactions (drag-and-drop, multi-step forms)
  • Cross-browser compatibility
  • Real API integration
  • Authentication flows

What NOT to Test with E2E:

  • Unit-level logic (use unit tests)
  • API contracts (use integration tests)
  • Edge cases (too slow)
  • Internal implementation details

2. Test Philosophy

The Testing Pyramid:

        /\
       /E2E\         ← Few, focused on critical paths
      /─────\
     /Integr\        ← More, test component interactions
    /────────\
   /Unit Tests\      ← Many, fast, isolated
  /────────────\

Best Practices:

  • Test user behavior, not implementation
  • Keep tests independent
  • Make tests deterministic
  • Optimize for speed
  • Use data-testid, not CSS selectors

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

Best Practices

  1. Use Data Attributes: data-testid or data-cy for stable selectors
  2. Avoid Brittle Selectors: Don't rely on CSS classes or DOM structure
  3. Test User Behavior: Click, type, see - not implementation details
  4. Keep Tests Independent: Each test should run in isolation
  5. Clean Up Test Data: Create and destroy test data in each test
  6. Use Page Objects: Encapsulate page logic
  7. Meaningful Assertions: Check actual user-visible behavior
  8. Optimize for Speed: Mock when possible, parallel execution
// ❌ Bad selectors
cy.get(".btn.btn-primary.submit-button").click();
cy.get("div > form > div:nth-child(2) > input").type("text");

// ✅ Good selectors (findBy* commands come from @testing-library/cypress;
// add `import "@testing-library/cypress/add-commands";` to your Cypress support file)
cy.findByRole("button", { name: "Submit" }).click();
cy.findByLabelText("Email address").type("user@example.com");
cy.get('[data-testid="email-input"]').type("user@example.com");

Common Pitfalls

  • Flaky Tests: Use proper waits, not fixed timeouts
  • Slow Tests: Mock external APIs, use parallel execution
  • Over-Testing: Don't test every edge case with E2E
  • Coupled Tests: Tests should not depend on each other
  • Poor Selectors: Avoid CSS classes and nth-child
  • No Cleanup: Clean up test data after each test
  • Testing Implementation: Test user behavior, not internals

Debugging Failing Tests

// Playwright debugging
// 1. Run in headed mode
npx playwright test --headed

// 2. Run in debug mode
npx playwright test --debug

// 3. Use trace viewer (record with `use: { trace: 'on-first-retry' }` in the config)
npx playwright show-trace path/to/trace.zip
await page.screenshot({ path: 'screenshot.png' });

// 4. Add test.step for better reporting
test('checkout flow', async ({ page }) => {
    await test.step('Add item to cart', async () => {
        await page.goto('/products');
        await page.getByRole('button', { name: 'Add to Cart' }).click();
    });

    await test.step('Proceed to checkout', async () => {
        await page.goto('/cart');
        await page.getByRole('button', { name: 'Checkout' }).click();
    });
});

// 5. Inspect page state
await page.pause();  // Pauses execution, opens inspector
자주 묻는 질문

E2E 테스트란 무엇인가요?

E2E(End-to-End, 종단 간) 테스트는 로그인이나 제품 구매처럼 여정의 처음부터 끝까지 사용자의 전체 경험을 흉내 냅니다.

'data-testid' 선택자는 왜 쓰나요?

웹사이트 디자인이나 클래스, 코드 구조에 따라 바뀌는 선택자와 달리 변하지 않아서 더 믿을 수 있습니다.

테스트가 가끔 실패하면 어떻게 해야 하나요?

테스트가 요소가 로드되기를 적절한 시간 동안 기다리는지, 다른 테스트에 의존하지 않는지, 안정적인 선택자를 쓰는지 확인하세요.

상세 정보

작성자의 원본 설명

Master end-to-end testing with Playwright and Cypress to build reliable test suites that catch bugs, improve confidence, and enable fast deployment. Use when implementing E2E tests, debugging flaky tests, or establishing testing standards.

repo: wshobson/agents

인기도

GitHub 스타
41k
순위
#6678
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

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

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬