E2e logo

E2e

Community
yusuftayman
e2e

E2E test generation skill using Playwright CLI with Page Object Model pattern and visual regression testing via @visual tag.

Overview

Publisheryusuftayman
Repositoryplaywright-cli-agents
Skill namee2e
Stars
26
Forks
3
Bundled files
4
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 4 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by yusuftayman on GitHub. Read the source before you install it.

Installation

Install the E2e AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/yusuftayman/playwright-cli-agents/tree/main/.claude/skills/e2e
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/yusuftayman/playwright-cli-agents.git /tmp/playwright-cli-agents
mkdir -p .claude/skills
cp -r /tmp/playwright-cli-agents/.claude/skills/e2e .claude/skills/e2e
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable E2e in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads E2e on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so E2e is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

E2E Test Generator Skill

This skill generates E2E tests using playwright-cli commands for browser automation. It uses the Page Object Model pattern and supports visual regression testing with the @visual tag in test titles.

When to Use

Use this skill when:

  • The user provides a URL to explore and create tests for
  • You need to create new E2E tests for a web application
  • You want to generate Page Object classes for a website
  • Visual regression tests are needed (integrated with integration tests using @visual tag)

Prerequisites

  • playwright-cli installed globally (npm install -g @playwright/cli@latest)
  • Target URL must be accessible
  • Project should have Playwright configured

Workflow Overview

1. EXPLORE → Navigate to URL, take snapshot, understand the page structure
2. PLAN → Identify testable features and create test plan
3. GENERATE PAGES → Create Page Object classes
4. GENERATE TESTS → Create test specs (add @visual tag for visual checks)
5. VALIDATE → Run tests to ensure they pass

References

For detailed exploration techniques and CLI commands, see:

Examples

For code templates and patterns, see:


Quick Start Workflow

Phase 1: URL Exploration

  1. Open URL

    bash
    playwright-cli open https://example.com
  2. Take Page Snapshot

    bash
    playwright-cli snapshot
  3. Identify Interactive Elements from snapshot output:

    • Buttons, links, form inputs
    • Navigation elements
    • Modal triggers
    • Dropdown menus
  4. Test Interactions before generating code:

    bash
    playwright-cli click e12
    playwright-cli snapshot  # Verify result

Phase 2: Test Planning

Based on exploration, identify:

  1. Happy Path Tests - Core user workflows
  2. Edge Cases - Error states, boundary conditions
  3. Visual Tests - UI consistency checks (add @visual tag to test title when needed)

Phase 3: Generate Page Objects

See examples/page-object-model.md for templates.

Key rules:

  • All locators as readonly class properties
  • Initialize locators in constructor
  • Every interaction method has waitFor before action
  • Use .catch(() => false) for visibility checks

Phase 4: Generate Tests

See examples/e2e-tests.md for templates.

Key patterns:

  • Add @visual tag to test title for visual regression tests (e.g., 'should display page correctly @visual')
  • Follow AAA pattern (Arrange, Act, Assert)
  • Create constants for reusable test data
  • All logic in Page Objects (no separate helpers or fixtures)

Test File Structure

__tests__/
├── e2e/
│   ├── pages/           # Page Object classes (ALL locators & interaction logic)
│   │   └── [page-name]-page.ts
│   └── [feature].spec.ts  # Integration tests (include @visual tag for visual checks)
└── constants/           # Test data only (URLs, emails, text values)
    └── test-data.ts

Important Notes:

  • All locators in Page Objects - No separate selectors file, locators are defined as class properties
  • No helpers folder - All interaction methods belong in Page Object classes
  • No fixtures folder - Use standard Playwright test setup
  • No visual folder - Visual tests are integrated with integration tests using @visual tag

Visual Testing Best Practices

ALWAYS Prefer Component-Level Screenshots

Never use full-page screenshots. Component-level screenshots are more stable and focused:

typescript
// CORRECT - Component-level screenshot
await expect(featurePage.header).toHaveScreenshot('preview-mode-header.png');
await expect(featurePage.globalStylesPanel).toHaveScreenshot('styles-expanded.png');

// WRONG - Full-page screenshot (too fragile)
await expect(page).toHaveScreenshot('preview-mode.png');

Why Component-Level Screenshots?

Full PageComponent
Fails when ANY element changesOnly fails when the specific component changes
Large image filesSmall, focused images
Hard to diagnose failuresEasy to see what changed
Flaky due to animationsStable, isolated scope

Strict Pixel Comparison

In playwright.config.ts, use strict comparison (no tolerance):

typescript
expect: {
  toHaveScreenshot: {
    maxDiffPixels: 0, // Strict - no pixel difference allowed
  },
},

Add Component Locators to Page Objects

typescript
// In your Page Object class constructor
this.header = page.locator('.guido__header, header').first();
this.globalStylesPanel = page.getByRole('tabpanel', { name: 'General Styles' });
this.leftSidebar = page.locator('.left-sidebar, [class*="sidebar"]').first();

Screenshot Naming Convention

Use descriptive names that indicate the component and state:

typescript
// Good names
await expect(featurePage.header).toHaveScreenshot('header-preview-mode.png');
await expect(featurePage.globalStylesPanel).toHaveScreenshot('styles-mobile-view.png');

// Bad names (too generic)
await expect(element).toHaveScreenshot('test1.png');

API Mocking

For deterministic tests, mock API responses using the mockApi utility:

typescript
import { API_ENDPOINTS } from '../enums/constants';
import { mockApi } from '../mockServer';

test('displays empty state @visual', async ({ page }) => {
  // Setup mocks BEFORE navigation
  await mockApi(page, `**/${API_ENDPOINTS.LIST_DATA}**`, 'list-data/empty.json');

  const featurePage = new FeaturePage(page);
  await featurePage.goto('/page');
  await expect(featurePage.emptyState).toHaveScreenshot('empty-state.png');
});

See references/api-mocking.md for full documentation.


Important Notes

  • Always explore first - Use playwright-cli snapshot before writing any code
  • Mock APIs - Use mockApi utility for deterministic test data
  • Test interactions - Verify element refs work before generating Page Objects
  • Visual tests use @visual tag in title - e.g., 'component visual test @visual'
  • Use component-level screenshots - NEVER use full-page screenshots
  • Strict pixel comparison - Use maxDiffPixels: 0 in config
  • Don't separate visual tests - Integrate them with integration tests when needed
  • Follow existing patterns - Match project structure exactly
  • Use descriptive names - Test names should describe expected behavior
  • Keep Page Objects comprehensive - Include wait methods, helper methods, and assertion helpers
  • Never use page.waitForTimeout() - Use proper waitFor conditions instead

Error Handling

ErrorSolution
Element not foundTake new snapshot, verify ref value
Timeout on navigationIncrease timeout or check URL
Screenshot mismatchUpdate baseline with --update-snapshots
Network errorsCheck console messages and network requests

GitHub Actions Workflow

Example CI/CD workflow for E2E tests with sharding and visual regression:

yaml
name: E2E Tests

on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review]
  push:
    branches: [develop]
  workflow_dispatch:
    inputs:
      update_snapshots:
        description: 'Update snapshots only'
        required: false
        default: 'false'
        type: boolean

jobs:
  run-e2e-tests:
    if: github.event_name == 'workflow_dispatch' || github.event_name == 'pull_request' || github.event_name == 'push'
    timeout-minutes: 60
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        shardIndex: [1, 2, 3, 4]
        shardTotal: [4]
    permissions:
      contents: read
      issues: write
      pull-requests: write
    env:
      APP_URL: https://localhost:3000
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Install Playwright browsers
        run: npx playwright install --with-deps

      - name: Start dev server
        run: |
          npm run dev &
          npx wait-on ${{ env.APP_URL }}

      - name: Run E2E Tests
        run: |
          if [ "${{ inputs.update_snapshots }}" == "true" ]; then
            npx playwright test --grep @visual --update-snapshots --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob
          else
            npx playwright test --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=blob
          fi

      - name: Upload blob report
        if: always()
        uses: actions/upload-artifact@v4
        with:
          name: blob-report-${{ github.run_id }}-${{ matrix.shardIndex }}
          path: blob-report/
          retention-days: 3

  merge-reports:
    if: always()
    needs: [run-e2e-tests]
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - uses: actions/setup-node@v4
        with:
          node-version: 22
          cache: npm

      - name: Install dependencies
        run: npm ci

      - name: Download blob reports
        uses: actions/download-artifact@v4
        with:
          path: all-blob-reports
          pattern: blob-report-${{ github.run_id }}-*
          merge-multiple: true

      - name: Merge reports
        run: npx playwright merge-reports --reporter html ./all-blob-reports

      - name: Upload HTML report
        uses: actions/upload-artifact@v4
        with:
          name: playwright-report
          path: playwright-report/
          retention-days: 7

Key Workflow Features

FeatureDescription
ShardingTests split across 4 parallel runners for speed
Visual updateworkflow_dispatch with update_snapshots input to update baselines
Blob reportsEach shard uploads blob report for later merging
Report mergingCombined HTML report from all shards
grep @visualOnly visual tests updated when update_snapshots is true

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the E2e AI skill do?

E2E test generation skill using Playwright CLI with Page Object Model pattern and visual regression testing via @visual tag.

Why use E2e on TypingMind?

Because you install it once and use it with any model. E2e is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install E2e in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/yusuftayman/playwright-cli-agents/tree/main/.claude/skills/e2e. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use E2e?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with E2e?

As many as you like. As long as a model supports skills, you can use E2e with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the E2e AI skill free?

It is published on GitHub by yusuftayman. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇