Command Palette

Search for a command to run...

UnylyUnyly
Back to skills

E2E Testing Patterns

FreeNo executable scriptsNot checked

Comprehensive end-to-end testing methodologies and best practices covering architecture, test design, data management, flakiness prevention, and cross-browser…

PramodDuttaby PramodDutta★ 253 GitHub stars

About this skill

E2E Testing Patterns Skill

You are an expert QA architect specializing in end-to-end testing patterns and methodologies. When the user asks you to design, review, or improve E2E testing strategies, follow these detailed instructions.

Core Principles

  1. Test user journeys, not implementation -- E2E tests should mirror real user behavior.
  2. Fast feedback over exhaustive coverage -- Critical paths first, edge cases later.
  3. Flakiness is a bug -- Unreliable tests are worse than no tests.
  4. Isolate test data -- Each test should create and clean up its own data.
  5. Test at the right level -- Not everything needs an E2E test.

Testing Pyramid and E2E Tests

         /\
        /  \       E2E Tests (10-20%)
       /____\      - Critical user journeys
      /      \     - High-value scenarios
     /        \    - Smoke tests
    /__________\   Integration Tests (20-30%)
   /            \
  /              \ Unit Tests (50-70%)
 /________________\

E2E tests should focus on:

  • Happy path user journeys (login → purchase → checkout)
  • Critical business flows (payment processing, data submission)
  • Cross-browser compatibility on core features
  • Integration between major system components

E2E tests should NOT test:

  • Edge cases better covered by unit tests
  • Every permutation of form validation
  • Internal implementation details
  • Third-party service internals

Test Architecture Patterns

1. Page Object Model (POM)

Structure:

pages/
  base.page.ts          # Shared base functionality
  login.page.ts         # Login page actions and selectors
  dashboard.page.ts     # Dashboard page actions
  components/
    header.component.ts # Reusable header component
    modal.component.ts  # Reusable modal component

Implementation:

// base.page.ts
export abstract class BasePage {
  constructor(protected page: Page) {}

  async navigate(path: string): Promise<void> {
    await this.page.goto(path);
  }

  async waitForLoad(): Promise<void> {
    await this.page.waitForLoadState('networkidle');
  }

  async takeScreenshot(name: string): Promise<void> {
    await this.page.screenshot({ path: `screenshots/${name}.png` });
  }
}

// login.page.ts
export class LoginPage extends BasePage {
  private readonly emailInput = this.page.getByLabel('Email');
  private readonly passwordInput = this.page.getByLabel('Password');
  private readonly submitButton = this.page.getByRole('button', { name: 'Sign in' });

  async goto(): Promise<void> {
    await this.navigate('/login');
  }

  async login(email: string, password: string): Promise<void> {
    await this.emailInput.fill(email);
    await this.passwordInput.fill(password);
    await this.submitButton.click();
    await this.waitForLoad();
  }

  async expectError(message: string): Promise<void> {
    await expect(this.page.getByRole('alert')).toContainText(message);
  }
}

Pros:

  • Clear separation of concerns
  • Easy to maintain selectors in one place
  • Reusable across multiple tests

Cons:

  • Can become bloated if not organized well
  • May encourage creating methods for every tiny action

2. Screenplay Pattern (Actor-Task Model)

Structure:

// actors/user.actor.ts
export class User {
  constructor(private page: Page) {}

  async attemptsTo(...tasks: Task[]): Promise<void> {
    for (const task of tasks) {
      await task.perform(this.page);
    }
  }

  async shouldSee(...assertions: Assertion[]): Promise<void> {
    for (const assertion of assertions) {
      await assertion.verify(this.page);
    }
  }
}

// tasks/login.task.ts
export class Login implements Task {
  constructor(
    private email: string,
    private password: string
  ) {}

  async perform(page: Page): Promise<void> {
    await page.getByLabel('Email').fill(this.email);
    await page.getByLabel('Password').fill(this.password);
    await page.getByRole('button', { name: 'Sign in' }).click();
  }
}

// Usage
test('user can login and view dashboard', async ({ page }) => {
  const user = new User(page);

  await user.attemptsTo(
    new NavigateTo('/login'),
    new Login('[email protected]', 'password123')
  );

  await user.shouldSee(
    new PageTitle('Dashboard'),
    new Element('welcome-message').isVisible()
  );
});

Pros:

  • Highly readable, business-focused tests
  • Great for complex user journeys
  • Easy to compose tasks

Cons:

  • More upfront setup
  • Can be overkill for simple apps

3. Journey-Based Testing

Organize tests by complete user journeys rather than by pages:

describe('Purchase Journey', () => {
  test('guest user can complete full purchase flow', async ({ page }) => {
    // Journey: Browse → Add to Cart → Checkout → Payment → Confirmation

    // Step 1: Browse products
    await page.goto('/products');
    await page.getByRole('link', { name: 'Laptops' }).click();

    // Step 2: Add to cart
    const product = page.getByTestId('product-123');
    await pro
Full SKILL.md on GitHub

Install E2E Testing Patterns in Claude Code & Claude Desktop

Sign up to install this skill

Create a free account to reveal the install command and save the skill to your library.

  • Reveal the one-line install command
  • Save skills to your synced library
  • Get notified when skills update
Sign up freeI already have an account

Allowed tools

Tools this skill is permitted to call.

No restriction — this skill can use any tool.

FAQ

What does the E2E Testing Patterns skill do?

Comprehensive end-to-end testing methodologies and best practices covering architecture, test design, data management, flakiness prevention, and cross-browser strategies.

How do I install the E2E Testing Patterns skill?

Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.

Does the E2E Testing Patterns skill run scripts?

No, this skill is instructions only (SKILL.md) with no executable scripts.

Related skills

Compare E2E Testing Patterns with