Purpose & When-To-Use
Trigger conditions:
- You need a complete e2e test suite for a web application or SPA
- You want page object pattern implementation for maintainability
- You require accessibility validation (WCAG A/AA/AAA) in automated tests
- You need cross-browser testing configuration (Chrome, Firefox, Safari, Edge)
- You're setting up visual regression testing for UI components
- You want parallel test execution in CI/CD pipelines
Scope: Generates production-ready test suites with framework-specific best practices, reusable page models, accessibility checks, and CI integration. Supports Playwright (recommended), Cypress, and Selenium WebDriver.
Not for: Unit tests, API tests (use dedicated skills), performance testing, or load testing.
Pre-Checks
Required before execution:
- Time normalization: Compute
NOW_ET using NIST/time.gov semantics (America/New_York, ISO-8601)
- Input validation:
framework must be one of: playwright, cypress, selenium
application_type must be one of: web, spa, mobile-web
test_scope must be one of: smoke, critical-path, full-regression
features array must not be empty (if provided)
accessibility_level valid for WCAG standards
- Source freshness checks:
- Playwright docs version ≥1.40 (accessed
NOW_ET)
- Cypress docs version ≥13.x (accessed
NOW_ET)
- Selenium WebDriver version ≥4.x (accessed
NOW_ET)
- axe-core version ≥4.8 (accessed
NOW_ET)
- Framework availability: Verify target framework installation instructions are current
Abort if: Framework choice conflicts with application_type (e.g., Selenium for component testing), or accessibility_level requirements exceed framework capabilities.
Procedure
Tier 1: Basic E2E Test Suite (≤2k tokens)
Fast path for 80% of common cases:
Framework selection:
- Playwright: Default for modern web/SPA with built-in cross-browser support
- Cypress: For component testing and developer-friendly debugging
- Selenium: For legacy browser support or existing infrastructure
Generate base configuration:
- Framework config file (playwright.config.ts, cypress.config.js, or wdio.conf.js)
- Base URL, timeouts, retry logic
- Browser launch options
Create page object foundation:
- Base Page class with common methods (click, type, waitFor, navigate)
- Locator strategies (data-testid preferred, CSS fallback)
- Example page object for login/authentication
Generate smoke test:
- Single critical path test (e.g., login → dashboard → logout)
- Uses page objects
- Basic assertions (visible, text content, navigation)
Output: Working test suite with 1-3 smoke tests, reusable page object pattern, runnable locally.
Tier 2: Advanced Patterns (≤6k tokens)
Extended validation with accessibility and visual regression:
Expand page object library:
- Create page objects for all major application sections
- Add custom commands/helpers (e.g.,
loginAsAdmin(), createEntity())
- Implement waiting strategies (network idle, specific elements)
Accessibility integration:
- Install and configure axe-core or @axe-core/playwright
- Add accessibility checks to critical user flows
- Configure WCAG level (A, AA, AAA) and violation reporting
- Example:
await expect(page).toPassA11yChecks({ wcagLevel: 'AA' })
Visual regression setup:
- Configure screenshot comparison (Percy, Playwright screenshots, Cypress snapshots)
- Define baseline images for key UI states
- Set pixel diff thresholds and ignore regions
Cross-browser testing:
- Configure browser matrix (Chromium, Firefox, WebKit/Safari)
- Mobile viewport emulation for responsive testing
- Device-specific test scenarios
Test data management:
- Fixture files or API-based test data setup
- Cleanup strategies (database resets, API teardown)
- Isolated test execution (no shared state)
Output: Comprehensive test suite with 10-20 tests covering critical paths, accessibility validation, visual regression, and multi-browser support.
Tier 3: CI Integration & Parallel Execution (≤12k tokens)
Deep dive for production deployment:
CI/CD pipeline configuration:
- GitHub Actions, GitLab CI, CircleCI, or Jenkins pipeline
- Docker container setup for consistent test environments
- Artifact storage (screenshots, videos, traces)
- Test result reporting (JUnit XML, HTML reports)
Parallelization strategy:
- Playwright: Shard tests across workers (
--shard=1/4)
- Cypress: Parallel execution with Cypress Dashboard or split by spec
- Selenium: Grid configuration for distributed execution
Flaky test mitigation:
- Retry logic configuration (max 2-3 retries)
- Wait strategy refinement (avoid hard sleeps)
- Network stubbing/mocking for deterministic tests
- Screenshot/video on failure for debugging
Advanced accessibility testing:
- Full page scans + component-level checks
- Custom axe rules for organization-specific requirements
- Accessibility regression tracking (fail on new violations)
Monitoring and alerting:
- Test duration trending
- Failure rate dashboards
- Slack/email notifications for critical test failures
Output: Production-ready test suite with CI integration, parallel execution, comprehensive reporting, and flaky test handling. Ready for continuous deployment pipelines.
Decision Rules
Framework selection matrix:
| Requirement |
Playwright |
Cypress |
Selenium |
| Modern web/SPA |
✓ Best |
✓ Good |
○ OK |
| Component testing |
○ Limited |
✓ Best |
✗ No |
| Cross-browser (built-in) |
✓ Yes |
○ Chromium-only free |
✓ Yes |
| Mobile emulation |
✓ Excellent |
✓ Good |
○ Limited |
| Network interception |
✓ Built-in |
✓ Built-in |
✗ Requires proxy |
| Debugging DX |
✓ Excellent |
✓ Excellent |
○ Basic |
| Legacy browser support |
○ Limited |
✗ No |
✓ Yes |
Test scope thresholds:
- Smoke: 3-5 tests covering authentication and primary user flow (T1 sufficient)
- Critical-path: 10-20 tests covering all major features and user journeys (T2 required)
- Full-regression: 50+ tests with edge cases, error states, and accessibility (T3 required)
Accessibility validation thresholds:
- WCAG A: Basic compliance (keyboard nav, alt text) - 15 rules
- WCAG AA: Standard compliance (color contrast, labels) - 38 rules
- WCAG AAA: Enhanced compliance (extended contrast, minimal flashing) - 61 rules
Abort conditions:
- Framework does not support required features (e.g., Cypress for multi-tab flows)
- Application requires authentication flows that cannot be automated safely
- Visual regression baseline images cannot be generated (missing UI states)
Output Contract
Required fields:
{
test_suite: {
files: string[], // Array of generated test file paths
framework_config: object, // Framework-specific config object
test_count: number, // Total number of test scenarios
coverage_areas: string[] // List of tested features
},
page_objects: {
models: Array<{ // Page object classes
name: string,
path: string,
methods: string[]
}>,
helpers: Array<{ // Utility functions
name: string,
description: string
}>
},
ci_config: {
pipeline_file: string, // Path to CI config (e.g., .github/workflows/e2e.yml)
parallelization_strategy: string, // "sharding" | "splitting" | "grid"
browser_matrix: string[], // ["chromium", "firefox", "webkit"]
estimated_duration_minutes: number
},
a11y_checks: {
rules: Array<{ // axe-core rules configuration
id: string,
impact: "critical" | "serious" | "moderate" | "minor"
}>,
compliance_level: "wcag-a" | "wcag-aa" | "wcag-aaa",
reporter: string, // HTML, JSON, or custom
violation_handling: "fail" | "warn" | "log"
}
}
Optional fields:
visual_regression: Screenshot comparison configuration
test_data: Fixture file paths and seeding strategies
environment_config: Environment-specific variables (staging, production)
Examples
Example 1: Playwright Admin Dashboard Test (≤30 lines)
import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/login-page';
import { DashboardPage } from '../pages/dashboard-page';
import { injectAxe, checkA11y } from 'axe-playwright';
test.describe('Admin Dashboard E2E', () => {
test('authenticated user can view and create entities with WCAG AA compliance', async ({ page }) => {
const loginPage = new LoginPage(page);
await loginPage.navigate();
await loginPage.login('admin@example.com', process.env.ADMIN_PASSWORD);
const dashboard = new DashboardPage(page);
await expect(dashboard.welcomeMessage).toContainText('Welcome, Admin');
await injectAxe(page);
await checkA11y(page, null, { detailedReport: true, wcagLevel: 'AA' });
await dashboard.clickCreateButton();
await dashboard.fillEntityForm({ name: 'Test Entity', type: 'Standard' });
await dashboard.submitForm();
await expect(dashboard.successToast).toBeVisible();
await expect(dashboard.entityList).toContainText('Test Entity');
await expect(page).toHaveScreenshot('dashboard-with-entity.png');
});
});
See /skills/e2e-testing-generator/examples/ for additional patterns and page object implementations.
Quality Gates
Token budgets (enforced):
- T1: ≤2k tokens — Basic test suite with page objects (smoke tests)
- T2: ≤6k tokens — Accessibility, visual regression, cross-browser (critical-path)
- T3: ≤12k tokens — CI integration, parallelization, monitoring (full-regression)
Safety checks:
- No hardcoded credentials in test files (use environment variables)
- No secrets in version control (use .env files with .gitignore)
- Page objects must not expose internal DOM structure to tests
- Accessibility violations must be surfaced in test reports
Auditability requirements:
- All generated tests must have descriptive names
- Test failures must include screenshots and/or videos
- CI pipeline must store artifacts for 30+ days
- Test execution traces must be available for debugging
Determinism checks:
- No
cy.wait(5000) or page.waitForTimeout(5000) without justification
- Prefer explicit waits (element visibility, network idle) over arbitrary timeouts
- Flaky test retry limit: max 3 attempts before failing the build
- Visual regression thresholds: ≤0.1% pixel difference for exact matches
Performance criteria:
- Smoke suite must complete in ≤5 minutes
- Critical-path suite must complete in ≤20 minutes
- Full regression suite must complete in ≤60 minutes with parallelization
Resources
Official Documentation:
Best Practices and Patterns:
CI/CD Integration Examples:
Visual Regression Tools:
1---2name: end-to-end-testing-framework-generator3description: Generate e2e test suites using Playwright, Cypress, or Selenium with page objects, accessibility checks, visual regression, and cross-browser testing4license: MIT5---67## Purpose & When-To-Use89**Trigger conditions:**1011* You need a complete e2e test suite for a web application or SPA12* You want page object pattern implementation for maintainability13* You require accessibility validation (WCAG A/AA/AAA) in automated tests14* You need cross-browser testing configuration (Chrome, Firefox, Safari, Edge)15* You're setting up visual regression testing for UI components16* You want parallel test execution in CI/CD pipelines1718**Scope:** Generates production-ready test suites with framework-specific best practices, reusable page models, accessibility checks, and CI integration. Supports Playwright (recommended), Cypress, and Selenium WebDriver.1920**Not for:** Unit tests, API tests (use dedicated skills), performance testing, or load testing.2122## Pre-Checks2324**Required before execution:**25261. **Time normalization:** Compute `NOW_ET` using NIST/time.gov semantics (America/New_York, ISO-8601)272. **Input validation:**28 - `framework` must be one of: playwright, cypress, selenium29 - `application_type` must be one of: web, spa, mobile-web30 - `test_scope` must be one of: smoke, critical-path, full-regression31 - `features` array must not be empty (if provided)32 - `accessibility_level` valid for WCAG standards333. **Source freshness checks:**34 - Playwright docs version ≥1.40 (accessed `NOW_ET`)35 - Cypress docs version ≥13.x (accessed `NOW_ET`)36 - Selenium WebDriver version ≥4.x (accessed `NOW_ET`)37 - axe-core version ≥4.8 (accessed `NOW_ET`)384. **Framework availability:** Verify target framework installation instructions are current3940**Abort if:** Framework choice conflicts with application_type (e.g., Selenium for component testing), or accessibility_level requirements exceed framework capabilities.4142## Procedure4344### Tier 1: Basic E2E Test Suite (≤2k tokens)4546**Fast path for 80% of common cases:**47481. **Framework selection:**49 - **Playwright:** Default for modern web/SPA with built-in cross-browser support50 - **Cypress:** For component testing and developer-friendly debugging51 - **Selenium:** For legacy browser support or existing infrastructure52532. **Generate base configuration:**54 - Framework config file (playwright.config.ts, cypress.config.js, or wdio.conf.js)55 - Base URL, timeouts, retry logic56 - Browser launch options57583. **Create page object foundation:**59 - Base Page class with common methods (click, type, waitFor, navigate)60 - Locator strategies (data-testid preferred, CSS fallback)61 - Example page object for login/authentication62634. **Generate smoke test:**64 - Single critical path test (e.g., login → dashboard → logout)65 - Uses page objects66 - Basic assertions (visible, text content, navigation)6768**Output:** Working test suite with 1-3 smoke tests, reusable page object pattern, runnable locally.6970### Tier 2: Advanced Patterns (≤6k tokens)7172**Extended validation with accessibility and visual regression:**73741. **Expand page object library:**75 - Create page objects for all major application sections76 - Add custom commands/helpers (e.g., `loginAsAdmin()`, `createEntity()`)77 - Implement waiting strategies (network idle, specific elements)78792. **Accessibility integration:**80 - Install and configure axe-core or @axe-core/playwright81 - Add accessibility checks to critical user flows82 - Configure WCAG level (A, AA, AAA) and violation reporting83 - Example: `await expect(page).toPassA11yChecks({ wcagLevel: 'AA' })`84853. **Visual regression setup:**86 - Configure screenshot comparison (Percy, Playwright screenshots, Cypress snapshots)87 - Define baseline images for key UI states88 - Set pixel diff thresholds and ignore regions89904. **Cross-browser testing:**91 - Configure browser matrix (Chromium, Firefox, WebKit/Safari)92 - Mobile viewport emulation for responsive testing93 - Device-specific test scenarios94955. **Test data management:**96 - Fixture files or API-based test data setup97 - Cleanup strategies (database resets, API teardown)98 - Isolated test execution (no shared state)99100**Output:** Comprehensive test suite with 10-20 tests covering critical paths, accessibility validation, visual regression, and multi-browser support.101102### Tier 3: CI Integration & Parallel Execution (≤12k tokens)103104**Deep dive for production deployment:**1051061. **CI/CD pipeline configuration:**107 - GitHub Actions, GitLab CI, CircleCI, or Jenkins pipeline108 - Docker container setup for consistent test environments109 - Artifact storage (screenshots, videos, traces)110 - Test result reporting (JUnit XML, HTML reports)1111122. **Parallelization strategy:**113 - Playwright: Shard tests across workers (`--shard=1/4`)114 - Cypress: Parallel execution with Cypress Dashboard or split by spec115 - Selenium: Grid configuration for distributed execution1161173. **Flaky test mitigation:**118 - Retry logic configuration (max 2-3 retries)119 - Wait strategy refinement (avoid hard sleeps)120 - Network stubbing/mocking for deterministic tests121 - Screenshot/video on failure for debugging1221234. **Advanced accessibility testing:**124 - Full page scans + component-level checks125 - Custom axe rules for organization-specific requirements126 - Accessibility regression tracking (fail on new violations)1271285. **Monitoring and alerting:**129 - Test duration trending130 - Failure rate dashboards131 - Slack/email notifications for critical test failures132133**Output:** Production-ready test suite with CI integration, parallel execution, comprehensive reporting, and flaky test handling. Ready for continuous deployment pipelines.134135## Decision Rules136137**Framework selection matrix:**138139| Requirement | Playwright | Cypress | Selenium |140|------------|-----------|---------|----------|141| Modern web/SPA | ✓ Best | ✓ Good | ○ OK |142| Component testing | ○ Limited | ✓ Best | ✗ No |143| Cross-browser (built-in) | ✓ Yes | ○ Chromium-only free | ✓ Yes |144| Mobile emulation | ✓ Excellent | ✓ Good | ○ Limited |145| Network interception | ✓ Built-in | ✓ Built-in | ✗ Requires proxy |146| Debugging DX | ✓ Excellent | ✓ Excellent | ○ Basic |147| Legacy browser support | ○ Limited | ✗ No | ✓ Yes |148149**Test scope thresholds:**150151* **Smoke:** 3-5 tests covering authentication and primary user flow (T1 sufficient)152* **Critical-path:** 10-20 tests covering all major features and user journeys (T2 required)153* **Full-regression:** 50+ tests with edge cases, error states, and accessibility (T3 required)154155**Accessibility validation thresholds:**156157* **WCAG A:** Basic compliance (keyboard nav, alt text) - 15 rules158* **WCAG AA:** Standard compliance (color contrast, labels) - 38 rules159* **WCAG AAA:** Enhanced compliance (extended contrast, minimal flashing) - 61 rules160161**Abort conditions:**162163* Framework does not support required features (e.g., Cypress for multi-tab flows)164* Application requires authentication flows that cannot be automated safely165* Visual regression baseline images cannot be generated (missing UI states)166167## Output Contract168169**Required fields:**170171```typescript172{173 test_suite: {174 files: string[], // Array of generated test file paths175 framework_config: object, // Framework-specific config object176 test_count: number, // Total number of test scenarios177 coverage_areas: string[] // List of tested features178 },179 page_objects: {180 models: Array<{ // Page object classes181 name: string,182 path: string,183 methods: string[]184 }>,185 helpers: Array<{ // Utility functions186 name: string,187 description: string188 }>189 },190 ci_config: {191 pipeline_file: string, // Path to CI config (e.g., .github/workflows/e2e.yml)192 parallelization_strategy: string, // "sharding" | "splitting" | "grid"193 browser_matrix: string[], // ["chromium", "firefox", "webkit"]194 estimated_duration_minutes: number195 },196 a11y_checks: {197 rules: Array<{ // axe-core rules configuration198 id: string,199 impact: "critical" | "serious" | "moderate" | "minor"200 }>,201 compliance_level: "wcag-a" | "wcag-aa" | "wcag-aaa",202 reporter: string, // HTML, JSON, or custom203 violation_handling: "fail" | "warn" | "log"204 }205}206```207208**Optional fields:**209210* `visual_regression`: Screenshot comparison configuration211* `test_data`: Fixture file paths and seeding strategies212* `environment_config`: Environment-specific variables (staging, production)213214## Examples215216**Example 1: Playwright Admin Dashboard Test (≤30 lines)**217218```typescript219import { test, expect } from '@playwright/test';220import { LoginPage } from '../pages/login-page';221import { DashboardPage } from '../pages/dashboard-page';222import { injectAxe, checkA11y } from 'axe-playwright';223test.describe('Admin Dashboard E2E', () => {224 test('authenticated user can view and create entities with WCAG AA compliance', async ({ page }) => {225 const loginPage = new LoginPage(page);226 await loginPage.navigate();227 await loginPage.login('admin@example.com', process.env.ADMIN_PASSWORD);228 const dashboard = new DashboardPage(page);229 await expect(dashboard.welcomeMessage).toContainText('Welcome, Admin');230 await injectAxe(page);231 await checkA11y(page, null, { detailedReport: true, wcagLevel: 'AA' });232 await dashboard.clickCreateButton();233 await dashboard.fillEntityForm({ name: 'Test Entity', type: 'Standard' });234 await dashboard.submitForm();235 await expect(dashboard.successToast).toBeVisible();236 await expect(dashboard.entityList).toContainText('Test Entity');237 await expect(page).toHaveScreenshot('dashboard-with-entity.png');238 });239});240```241242See `/skills/e2e-testing-generator/examples/` for additional patterns and page object implementations.243244## Quality Gates245246**Token budgets (enforced):**247248* **T1:** ≤2k tokens — Basic test suite with page objects (smoke tests)249* **T2:** ≤6k tokens — Accessibility, visual regression, cross-browser (critical-path)250* **T3:** ≤12k tokens — CI integration, parallelization, monitoring (full-regression)251252**Safety checks:**253254* No hardcoded credentials in test files (use environment variables)255* No secrets in version control (use .env files with .gitignore)256* Page objects must not expose internal DOM structure to tests257* Accessibility violations must be surfaced in test reports258259**Auditability requirements:**260261* All generated tests must have descriptive names262* Test failures must include screenshots and/or videos263* CI pipeline must store artifacts for 30+ days264* Test execution traces must be available for debugging265266**Determinism checks:**267268* No `cy.wait(5000)` or `page.waitForTimeout(5000)` without justification269* Prefer explicit waits (element visibility, network idle) over arbitrary timeouts270* Flaky test retry limit: max 3 attempts before failing the build271* Visual regression thresholds: ≤0.1% pixel difference for exact matches272273**Performance criteria:**274275* Smoke suite must complete in ≤5 minutes276* Critical-path suite must complete in ≤20 minutes277* Full regression suite must complete in ≤60 minutes with parallelization278279## Resources280281**Official Documentation:**282283* [Playwright API Reference](https://playwright.dev/docs/api/class-playwright) (accessed 2025-10-26T02:31:27-0400)284* [Cypress API Commands](https://docs.cypress.io/api/table-of-contents) (accessed 2025-10-26T02:31:27-0400)285* [Selenium WebDriver W3C Standard](https://www.w3.org/TR/webdriver2/) (accessed 2025-10-26T02:31:27-0400)286* [axe-core Rules and Impact Levels](https://github.com/dequelabs/axe-core/blob/develop/doc/API.md) (accessed 2025-10-26T02:31:27-0400)287288**Best Practices and Patterns:**289290* [Page Object Model Pattern (Martin Fowler)](https://martinfowler.com/bliki/PageObject.html) (accessed 2025-10-26T02:31:27-0400)291* [Playwright Best Practices - Locators](https://playwright.dev/docs/best-practices) (accessed 2025-10-26T02:31:27-0400)292* [Cypress Network Stubbing Guide](https://docs.cypress.io/guides/guides/network-requests) (accessed 2025-10-26T02:31:27-0400)293* [WCAG 2.1 Quick Reference](https://www.w3.org/WAI/WCAG21/quickref/) (accessed 2025-10-26T02:31:27-0400)294295**CI/CD Integration Examples:**296297* [Playwright GitHub Actions Setup](https://playwright.dev/docs/ci-intro) (accessed 2025-10-26T02:31:27-0400)298* [Cypress Parallelization Guide](https://docs.cypress.io/guides/guides/parallelization) (accessed 2025-10-26T02:31:27-0400)299* [Selenium Grid 4 Configuration](https://www.selenium.dev/documentation/grid/) (accessed 2025-10-26T02:31:27-0400)300301**Visual Regression Tools:**302303* [Percy Visual Testing](https://docs.percy.io/) (accessed 2025-10-26T02:31:27-0400)304* [Playwright Screenshots and Visual Comparisons](https://playwright.dev/docs/screenshots) (accessed 2025-10-26T02:31:27-0400)