agentsclimarketplace

E2e

Skill tunneleven/C4Flow/skills/e2e

Run end-to-end browser tests against the deployed or locally-running application. Auto-detect e2e framework (Playwright, Cypress, Selenium, TestCafe, Robot Framework), manage app server lifecycle, execute tests, classify failures, and report results. Manual trigger — not part of auto-flow. Use when the user wants to run e2e tests, browser tests, integration tests against a live app, or validate user flows. Triggers on "e2e", "end-to-end", "browser test", "playwright", "cypress", or "smoke test".From its SKILL.md

Install
npx -y skills add tunneleven/C4Flow --skill e2e

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

15.7 KB, as published. Nobody here has run it

/c4flow:e2e — End-to-End Browser Tests

Phase: 4: Testing (manual trigger — not part of auto flow) Agent type: Sub-agent (dispatched by orchestrator or invoked directly) Status: Implemented

Overview

Run the full end-to-end test suite against a running application. Detect the e2e framework, optionally start the app server, execute browser tests, classify failures (code bugs vs environment issues), and report results. Does NOT write test files.

Relationship to c4flow:test: c4flow:test handles unit + integration tests with coverage checking. c4flow:e2e handles browser-level user flow validation against a live app. They are complementary — run c4flow:test first, then c4flow:e2e.

Input

  • Feature name (kebab-cased) from .state.json
  • docs/specs/<feature>/tech-stack.md — framework & e2e stack info
  • docs/specs/<feature>/spec.md — expected behaviors (GIVEN/WHEN/THEN scenarios for validation)
  • App URL (from config, env var, or auto-detected dev server)

Output

  • Test results: pass/fail count, duration, screenshots/videos (if available)
  • Failure analysis: root cause suggestions with confidence levels
  • Gate decision: pass (report success) or fail (report issues)

Gate Condition

E2E pass: All critical-path tests pass
E2E warn: Non-critical tests fail (report DONE_WITH_CONCERNS)

Note: Since e2e is a manual trigger, there is no auto-advance to a next state. Results are reported to the user.

Capabilities

CapabilityDetails
Framework detection5 frameworks: Playwright, Cypress, Selenium/WebDriverIO, TestCafe, Robot Framework
App server managementAuto-detect dev server command, start before tests, shutdown after
Browser managementHeadless by default, configurable via env vars
Failure classificationTier 1 (test/code bugs: deep analysis) / Tier 2 (env issues: quick fix)
Deep analysisUp to 5 unique-file slots, ±10 lines context, HIGH/MEDIUM/LOW confidence
Artifact collectionScreenshots, videos, trace files (if framework supports)

Instructions

You are the c4flow:e2e agent. Execute the following steps in order.


Step 1: Parse Input & Resolve Configuration

Read from orchestrator context:

  • Feature name from .state.json
  • docs/specs/<feature>/tech-stack.md — extract:
    • E2E testing framework (if specified)
    • App start command
    • Base URL
  • docs/specs/<feature>/spec.md — keep available for flow validation

Initialize internal counters:

CounterInitialMaxPurpose
fix_attempts03Tier 1 auto-fix attempts (Step 6)
server_start_retries03App server start attempts

Resolve e2e configuration — priority order:

PrioritySource
1E2E config file (playwright.config.*, cypress.config.*, wdio.conf.*, .testcaferc.*)
2tech-stack.md e2e section
3Auto-detection (Step 2)

Resolve app URL — priority order:

PrioritySource
1E2E_BASE_URL or BASE_URL env var
2baseURL / baseUrl in e2e config file
3tech-stack.md app URL
4Default: http://localhost:3000

Step 2: Detect E2E Framework

If no explicit command is configured, auto-detect by scanning project files. First match wins:

PrioritySignalFrameworkCommand
1playwright.config.ts / playwright.config.js / @playwright/test in depsPlaywrightnpx playwright test
2cypress.config.ts / cypress.config.js / cypress/ dir / cypress in depsCypressnpx cypress run
3wdio.conf.ts / wdio.conf.js / @wdio/cli in depsWebDriverIOnpx wdio run wdio.conf.ts
4.testcaferc.json / .testcaferc.cjs / testcafe in depsTestCafenpx testcafe chromium:headless
5*.robot files in test dirs / robotframework in Python depsRobot Frameworkrobot --outputdir results tests/
6selenium-webdriver in deps + custom configSelenium (custom)Check package.json scripts for e2e or test:e2e

Package manager detection: bun.lockb/bun.lock → bun, yarn.lock → yarn, pnpm-lock.yaml → pnpm, otherwise npm.

If no framework detected: Report BLOCKED with message "No e2e test framework detected. Install Playwright (npm init playwright@latest) or Cypress (npm install cypress) and add tests."


Step 3: Start App Server (If Needed)

Check if app is already running:

APP_URL="${E2E_BASE_URL:-http://localhost:3000}"
HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "$APP_URL" 2>/dev/null || echo "000")

If app is already running (HTTP status 200/301/302): Skip server start, proceed to Step 4.

If app is NOT running: Detect and start dev server.

Dev server detection — priority order:

PrioritySignalCommand
1E2E_START_CMD env varUse as-is
2package.json has scripts.devnpm run dev
3package.json has scripts.startnpm start
4manage.py existspython manage.py runserver
5main.go existsgo run .

Start server in background:

# Start dev server in background
$START_CMD &
SERVER_PID=$!

# Wait for server to be ready (max 30 seconds)
for i in $(seq 1 30); do
  HTTP_STATUS=$(curl -s -o /dev/null -w "%{http_code}" --max-time 2 "$APP_URL" 2>/dev/null || echo "000")
  if [ "$HTTP_STATUS" != "000" ]; then
    echo "App server ready at $APP_URL (HTTP $HTTP_STATUS)"
    break
  fi
  sleep 1
done

if [ "$HTTP_STATUS" = "000" ]; then
  echo "ERROR: App server failed to start within 30 seconds"
  kill $SERVER_PID 2>/dev/null
  # Report BLOCKED
fi

Record SERVER_PID — needed for cleanup in Step 8.

Playwright-specific: If framework is Playwright and config has webServer, skip manual server start — Playwright manages it natively.


Step 4: Run E2E Test Suite

Execute the resolved e2e command, capturing stdout and stderr.

Apply timeout: Default 300 seconds for e2e tests (longer than unit tests). Override via E2E_TIMEOUT env var.

Headless mode flags — append framework-specific headless flag:

FrameworkHeadless FlagDefault
Playwright(headless by default in CI)No flag needed
Cypress--headlessAppended automatically
WebDriverIOSet in wdio.conf capabilitiesNo flag needed
TestCafechromium:headlessAlready in command
Robot Framework--variable BROWSER:headlesschromeAppend if no display

Check for headless environment:

# Detect if running headless (no display)
if [ -z "${DISPLAY:-}" ] && [ -z "${WAYLAND_DISPLAY:-}" ]; then
  HEADLESS=true
fi

Framework-specific execution:

FrameworkFull Command
Playwrightnpx playwright test --reporter=list
Cypressnpx cypress run --reporter spec
WebDriverIOnpx wdio run wdio.conf.ts
TestCafenpx testcafe chromium:headless tests/
Robot Frameworkrobot --outputdir results --loglevel INFO tests/

Step 5: Classify Results

Exit code interpretation:

ExitClassificationAction
0All tests passedProceed to Step 8 (report)
Non-zero + test failure markersTier 1 — test/code failuresStep 6 (deep analysis)
Non-zero + env error signalsTier 2 — environment failuresStep 7 (quick fix)
Killed by timeoutTier 2 — process timeoutStep 7

Tier 1 markers: FAIL, FAILED, AssertionError, Expected, Received, Timed out waiting for, element not found, element not visible, click intercepted, test count summaries

Tier 2 markers: browserType.launch, Browser closed, ERR_CONNECTION_REFUSED, ECONNREFUSED, net::ERR_, No such file, command not found, Permission denied, OOM, Protocol error, Target closed, Session not created


Step 6: Analyze Tier 1 Failures (Deep Analysis)

For test/code failures, apply deep analysis with a maximum of 5 unique-file slots:

  • All failures from the same test file share one slot
  • Failures beyond the 5-slot limit: list test name and raw message only

For each slot (up to 5 unique files):

  1. Extract: test file path, line number, test name(s), error message(s), stack trace, screenshot path (if available)
  2. Read: the failing test file and relevant page object / component file (±10 lines around each error)
  3. Categorize failure type:
CategorySignalCommon Cause
Element not foundlocator.click, getByRole, cy.get timeoutSelector changed, element not rendered, timing issue
Assertion mismatchexpect(...).toBe(...), should('have.text')UI text changed, data mismatch, race condition
Navigation failurepage.goto, cy.visit errorRoute changed, redirect loop, 404
Interaction blockedclick intercepted, element not interactableModal overlay, element not scrolled into view
TimeoutTimed out waiting forSlow API, loading spinner stuck, network issue
Visual regressionScreenshot diffUI layout changed
  1. Suggest: identify likely root cause with confidence level

Confidence levels:

LevelMeaning
[HIGH]Error points directly to a specific selector or assertion
[MEDIUM]Error implicates a page or flow, not an exact element
[LOW]Pattern match only — could be timing, data, or code

Auto-fix Decision

After analysis, decide whether to auto-fix or escalate:

ConditionAction
Failure is fixable (selector update, wait added, text change) AND fix_attempts < 3Fix test code, increment fix_attempts, re-run from Step 4
Failure is fixable BUT fix_attempts ≥ 3Stop auto-fixing. Report DONE_WITH_CONCERNS
Failure requires user input (flow changed, new feature, spec unclear)Report NEEDS_CONTEXT with the analysis

Step 7: Report Tier 2 Failures (Fast Path)

For environment/tooling failures, provide a short actionable message only. No deep analysis.

TypeMessage
Browser not found"Install browser: npx playwright install or npx cypress install"
App server not running"Start the app server first, or set E2E_BASE_URL env var"
Connection refused"App not responding at {url}. Check if the server started correctly"
Display/GPU error"Running headless? Set --headless flag or use xvfb-run"
Process timeout"Tests exceeded {timeout}s. Increase E2E_TIMEOUT or check for hanging tests"
Browser crashed"Browser ran out of memory or crashed. Try reducing parallel workers"
SSL/certificate error"Accept self-signed certs: set NODE_TLS_REJECT_UNAUTHORIZED=0 for dev"
Docker/container error"Check Docker is running and browser containers are healthy"

After reporting, set status to BLOCKED — environment issues need user intervention.


Step 8: Report Status & Cleanup

Cleanup first:

# Stop dev server if we started it
if [ -n "${SERVER_PID:-}" ]; then
  kill $SERVER_PID 2>/dev/null
  wait $SERVER_PID 2>/dev/null
  echo "Dev server stopped (PID: $SERVER_PID)"
fi

Collect artifacts (if available):

FrameworkArtifacts Location
Playwrighttest-results/, playwright-report/
Cypresscypress/screenshots/, cypress/videos/
WebDriverIOallure-results/, custom output dir
TestCafereports/, screenshots in test output
Robot Frameworkresults/output.xml, results/log.html, results/report.html

Report one of:

DONE

All e2e tests pass.

E2E Tests: {passed}/{total} passed  ({duration}s)
Framework: {framework}
Base URL:  {app_url}

Artifacts:
  Screenshots: {screenshot_count} captured
  Videos: {video_count} recorded

All critical user flows validated.

DONE_WITH_CONCERNS

Tests mostly pass but some non-critical failures.

E2E Tests: {passed}/{total} passed, {failed} failed  ({duration}s)
Framework: {framework}
Base URL:  {app_url}

Failures (non-blocking):
  - {test_name}: {error_summary}

Concerns:
  - {concern_description}

Screenshots of failures available at: {artifact_path}

BLOCKED

Cannot proceed:

  • Tier 2 environment failure → include env error and fix instructions
  • No e2e framework detected → include detection failure details
  • App server failed to start → include server error output

NEEDS_CONTEXT

Test failures that require user decisions:

  • Flow changed (test expects old behavior, app shows new)
  • Spec ambiguity (test expects A, app does B, spec unclear)
  • Include the failure analysis from Step 6

Environment Variables

VariableDefaultDescription
E2E_BASE_URL or BASE_URLhttp://localhost:3000App URL to test against
E2E_START_CMDAuto-detectedCommand to start the app server
E2E_TIMEOUT300Timeout in seconds for the full e2e suite
E2E_HEADLESStrue (if no display)Force headless browser mode
E2E_WORKERSFramework defaultNumber of parallel browser workers
E2E_RETRIES0Number of retries for failed tests

Edge Cases

ScenarioBehavior
No e2e tests found in projectReport BLOCKED: "No e2e test files found. Write tests first or check test directory configuration."
App server starts but returns 500Proceed with tests — the 500 may be limited to certain routes. Tests will surface the issues.
Flaky tests (pass on retry)If E2E_RETRIES > 0, use framework retry. Report flaky tests in DONE_WITH_CONCERNS even if they pass on retry.
Multiple e2e frameworks detectedUse the first match from detection priority. Note others in output.
Tests require auth/loginTests should handle auth themselves (test fixtures, env vars, setup hooks). If auth fails, classify as Tier 1.
Tests need seeded dataTests should handle data seeding. If data missing, classify as Tier 2 (environment setup needed).
Playwright webServer in configSkip Step 3 entirely — Playwright manages the server lifecycle.
Tests pass locally but fail in CICommon causes: timing, viewport, font rendering. Report DONE_WITH_CONCERNS with environment diff.
Browser install neededReport BLOCKED: "Run npx playwright install to download browsers."

Guardrails

  • Always detect framework before running — never guess
  • Always apply timeout (default 300s — e2e tests are slow)
  • Always run in headless mode unless display is available
  • Never read more than 5 unique test files for deep analysis
  • Never write or create test files — only run existing tests
  • If framework detection fails, report BLOCKED — do not proceed without a runner
  • Environment issues (Tier 2) are always BLOCKED — never try to fix environment
  • Always clean up — stop the dev server if you started it, even on failure
  • Report honestly — don't hide failures or claim tests passed without evidence
  • Never install browsers or dependencies — only report what's needed
  • Never run tests against production URLs unless explicitly configured

Keep looking

Skills are one crate of 607,721. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.