Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This repository contains reusable AI coding workflows that can be installed glob
- **prd** — Requirements-to-PRD workflow (ingest, clarify, draft, revise, publish, respond)
- **design** — Design-and-decompose workflow (ingest, draft, decompose, revise, publish, respond, sync)
- **implement** — Story-to-code workflow (ingest, plan, revise, code, validate, publish, respond)
- **e2e** — Story-to-tests workflow for [QE] stories (ingest, plan, revise, code, validate, publish, respond)
- **kcs** — KCS Solution article workflow (gather, draft, validate, handoff)

## Architecture
Expand Down Expand Up @@ -60,6 +61,7 @@ Workflows write outputs to `.artifacts/{workflow-name}/{context}/`:
- **prd**: `.artifacts/prd/{issue-number}/` (01-requirements.md, 02-clarifications.md, 03-prd.md, 04-pr-description.md, 05-review-responses.md)
- **design**: `.artifacts/design/{issue-number}/` (01-context.md, 02-design.md, 03-epics.md, 04-stories/epic-{N}-{slug}.md, 04-stories/epic-{N}/story-{NN}-{slug}.md, 05-coverage.md, 06-pr-description.md, 07-review-responses.md, publish-metadata.json, sync-manifest.json)
- **implement**: `.artifacts/implement/{jira-key}/` (01-context.md, 02-plan.md, 03-test-report.md, 04-impl-report.md, 05-validation-report.md, 06-pr-description.md, 07-review-responses.md, publish-metadata.json)
- **e2e**: `.artifacts/e2e/{jira-key}/` (01-context.md, 02-plan.md, 03-test-report.md, 04-impl-report.md, 05-validation-report.md, 06-pr-description.md, 07-review-responses.md, publish-metadata.json)
- **kcs**: `.artifacts/kcs/{issue-key}/` (01-context.md, 02-kcs-draft.md, 03-handoff-message.md)

## Prerequisites
Expand All @@ -76,6 +78,7 @@ Workflows write outputs to `.artifacts/{workflow-name}/{context}/`:
- **prd**: Jira MCP server — for requirements ingestion; GitHub CLI (`gh`) — for PR creation and review comment management
- **design**: Jira MCP server or CLI — for `/ingest` (read-only) and `/sync` (creates epics/stories); GitHub CLI (`gh`) — for `/publish` and `/respond`
- **implement**: Jira MCP server or CLI — for `/ingest` (read-only); GitHub CLI (`gh`) — for `/publish` and `/respond`; project build/test/lint tooling (discovered during `/ingest`); docs repo (local clone) — for `/ingest` (reads PRD and design document)
- **e2e**: Jira MCP server or CLI — for `/ingest` (read-only); GitHub CLI (`gh`) — for `/publish` and `/respond`; project e2e test tooling (discovered during `/ingest`); docs repo (local clone) — for `/ingest` (reads PRD and design document)
- **kcs**: Jira MCP server — for `/gather` (read-only)

## Installation System
Expand Down Expand Up @@ -193,6 +196,18 @@ For detailed workflow development guidelines (structure, file conventions, testi
- Plan evolves during implementation — `02-plan.md` is updated as tasks complete, enabling resumption after interruptions
- Code changes happen in the source repo on a feature branch; `/publish` creates a PR in the source repo (not a separate docs repo)

### e2e

- Requires a Jira [QE] Story (typically created by the design workflow's `/sync` phase) as input
- Jira is read-only — no phase in this workflow writes to Jira
- Discovery-based infrastructure: e2e test framework, harness, auxiliary services, execution commands, and conventions are discovered during `/ingest` — not hardcoded
- Reference suite pattern: before writing tests, identifies the most similar existing e2e test suite and extracts its patterns (imports, setup/teardown, harness usage, assertions, labels)
- Scenario-driven planning: each acceptance criterion maps to concrete test scenarios with Describe/Context/It nesting, steps, assertions, and labels
- Anti-pattern detection during `/validate`: checks for hardcoded sleeps, brittle selectors, order-dependent tests, shared mutable state, missing cleanup, harness bypass, missing labels, hardcoded values, missing async polling, missing failure diagnostics
- Feature defects are not test bugs — if tests reveal a defect in the [DEV] implementation, the test is adjusted (xfail/skip) and the defect is noted in the implementation report
- Plan evolves during implementation — `02-plan.md` is updated as tasks complete, enabling resumption after interruptions
- Code changes happen in the source repo on a feature branch; `/publish` creates a PR in the source repo

### kcs

- Requires Jira MCP server for `/gather` (read-only — never modifies Jira)
Expand Down Expand Up @@ -265,6 +280,7 @@ ai-workflows/
├── cve-fix/
├── design/
├── docs-writer/
├── e2e/
├── implement/
├── kcs/
├── prd/
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ Reusable AI coding workflows a team member can install globally or per-project,
- **Implement** -- Story-to-code workflow: take a Jira Story, plan the implementation, write contract-based tests and production code via TDD, validate against the project's CI expectations, and manage review via GitHub PRs.
See [implement/README.md](implement/README.md).

- **E2E** -- Story-to-tests workflow for [QE] stories: discover the project's e2e testing infrastructure, map acceptance criteria to test scenarios, write e2e test code following the project's patterns and reference suite, validate against anti-patterns and scenario coverage, and manage review via GitHub PRs.
See [e2e/README.md](e2e/README.md).

- **CVE Fix** -- Automated CVE remediation: read vulnerability details from Jira, apply multi-strategy dependency fixes, validate, create pull requests, backport to release branches, and close Jira tickets. Language-agnostic.
See [cve-fix/README.md](cve-fix/README.md).

Expand Down Expand Up @@ -103,6 +106,7 @@ Each workflow is intended for a specific project or use case:
- **prd** -- teams drafting Product Requirements Documents from Jira features
- **design** -- teams creating technical design documents and Jira-ready epic/story breakdowns from PRDs
- **implement** -- teams implementing Jira stories produced by the design workflow
- **e2e** -- teams writing e2e tests for [QE] stories produced by the design workflow
- **cve-fix** -- teams patching CVEs and updating vulnerable dependencies from Jira vulnerability tickets
- **ai-ready** -- onboarding any project for AI agents by generating AGENTS.md
- **kcs** -- teams writing KCS Solution articles for known issues with workarounds
Expand Down
158 changes: 158 additions & 0 deletions e2e/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# E2E Test Workflow

A story-to-tests workflow that takes a Jira [QE] Story, discovers the project's e2e testing infrastructure, plans test scenarios mapped to acceptance criteria, writes e2e test code following the project's patterns, validates against anti-patterns and scenario coverage, and manages review via GitHub PRs.

## Prerequisites

| Tool | Required | Purpose |
|------|----------|---------|
| Jira access (MCP or CLI) | For `/ingest` | Fetch [QE] Story issue details |
| GitHub CLI (`gh`) | For `/publish`, `/respond` | Create PRs, post review comments |
| Git | Yes | Branch management, commits |
| Project e2e test tooling | Yes | Discovered during `/ingest` from project's AGENTS.md, Makefile, CI workflows |
| Docs repo (local clone) | For `/ingest` | Read PRD and design document for upstream context |

## Phases

| Phase | Command | Purpose | Artifact(s) |
|-------|---------|---------|-------------|
| Ingest | `/ingest` | Fetch [QE] story, verify [DEV] dependencies, explore e2e infrastructure | `01-context.md` |
| Plan | `/plan` | Map ACs to test scenarios, select reference suite | `02-plan.md` |
| Revise | `/revise` | Incorporate feedback into the test plan | Updated `02-plan.md` |
| Code | `/code` | Write e2e test code following discovered patterns | `03-test-report.md`, `04-impl-report.md` |
| Validate | `/validate` | Run tests, check anti-patterns, verify scenario coverage | `05-validation-report.md` |
| Publish | `/publish` | Push branch, create draft PR | `06-pr-description.md` |
| Respond | `/respond` | Address reviewer comments | `07-review-responses.md` |

## Typical Flow

```text
/ingest EDM-5678
-> fetches [QE] story from Jira
-> verifies [DEV] dependencies are merged
-> loads design document and PRD context
-> explores e2e test infrastructure (framework, harness, patterns)
-> selects reference suite as pattern source
-> discovers validation profile (test execution, lint commands)
-> writes .artifacts/e2e/EDM-5678/01-context.md

/plan
-> maps each acceptance criterion to test scenarios
-> selects reference suite and documents patterns to follow
-> designs test file structure (suite file + test files)
-> plans harness method usage and auxiliary services
-> breaks work into ordered tasks (suite file first, then scenarios)
-> writes 02-plan.md

/revise (optional, repeatable)
-> user reviews plan, requests changes
-> plan updated, consistency maintained

/code
-> creates feature branch
-> for each task: read reference -> write test code -> run tests -> review -> commit
-> updates 02-plan.md with task completion status
-> writes 03-test-report.md, 04-impl-report.md

/validate
-> runs e2e tests (scoped to new suite)
-> checks for anti-patterns (hardcoded sleeps, missing cleanup, etc.)
-> verifies every AC has a passing test scenario
-> checks for regressions in adjacent suites
-> writes 05-validation-report.md

/publish
-> pushes feature branch
-> creates draft GitHub PR with Jira link
-> writes 06-pr-description.md

/respond (repeatable)
-> fetches PR review comments
-> proposes responses (user approves before posting)
-> applies code changes if needed
-> writes 07-review-responses.md
```

## Artifacts

All artifacts are stored in `.artifacts/e2e/{jira-key}/`.

```text
.artifacts/e2e/EDM-5678/
01-context.md (story context, e2e infrastructure, validation profile)
02-plan.md (scenario breakdown, AC coverage -- updated as tasks complete)
03-test-report.md (tests written, harness methods used)
04-impl-report.md (changes, commits, deviations, discoveries)
05-validation-report.md (check results, anti-patterns, regressions)
06-pr-description.md (PR body)
07-review-responses.md (review comment log)
publish-metadata.json (PR number, branch, URL)
```

## Key Design Decisions

### Discovery-Based Infrastructure

The workflow does not hardcode language-specific commands or framework assumptions. During `/ingest`, it discovers the project's e2e testing framework, harness, auxiliary services, execution commands, and conventions. This makes the workflow portable across projects using different testing stacks (Ginkgo, Playwright, pytest, Cypress, etc.).

### Reference Suite Pattern

Before writing any test code, the workflow identifies the most similar existing e2e test suite in the project and extracts its patterns: imports, setup/teardown, harness usage, assertion style, labels, and cleanup. New tests follow these patterns exactly, ensuring consistency with the project's existing test base.

### Scenario-Driven Planning

Unlike implementation planning (task-driven), e2e test planning is scenario-driven. Each acceptance criterion maps to one or more concrete test scenarios with specific Describe/Context/It nesting, steps, assertions, and labels. This ensures every AC is verifiably covered.

### Anti-Pattern Detection

Validation checks for 10 common e2e test anti-patterns: hardcoded sleeps, brittle selectors, order-dependent tests, shared mutable state, missing cleanup, harness bypass, missing labels, hardcoded values, missing async polling, and missing failure diagnostics. Each detected anti-pattern is fixed during validation.

### Feature Defects Are Not Test Bugs

If e2e tests reveal that the feature behaves differently than the acceptance criteria describe, that is a defect in the [DEV] implementation, not a test failure. The test is adjusted (xfail/skip) and the defect is noted in the implementation report. The e2e workflow does not fix feature code.

### Incremental Commits

Each logical unit of work gets its own commit, following the project's commit format (discovered during `/ingest`). Each commit should be independently meaningful.

### Plan as Living Document

`02-plan.md` is updated during `/code` as tasks are completed. On re-invocation (e.g., after context limits or interruptions), the plan shows which tasks are done and which remain.

## Directory Structure

```text
e2e/
├── SKILL.md # Workflow entry point
├── guidelines.md # Behavioral rules and guardrails
├── README.md # This file
├── skills/
│ ├── controller.md # Phase dispatcher and transitions
│ ├── ingest.md # Fetch story, explore e2e infrastructure
│ ├── plan.md # Map ACs to test scenarios
│ ├── revise.md # Incorporate plan feedback
│ ├── code.md # Write e2e test code
│ ├── validate.md # Run tests, check anti-patterns
│ ├── publish.md # Create GitHub PR
│ └── respond.md # Address review comments
└── commands/
├── ingest.md # /ingest command
├── plan.md # /plan command
├── revise.md # /revise command
├── code.md # /code command
├── validate.md # /validate command
├── publish.md # /publish command
└── respond.md # /respond command
```

## Getting Started

```bash
# Install the workflow
./install.sh claude --workflows e2e

# Or install all workflows
./install.sh all
```

Then in your project, run the `e2e` workflow's `ingest` command for your [QE] Jira story (e.g., EDM-5678).
25 changes: 25 additions & 0 deletions e2e/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: e2e
description: >-
Story-to-e2e-test workflow that takes a Jira [QE] Story, discovers the
project's e2e testing infrastructure, plans test scenarios, writes e2e
tests matching project conventions, validates them, and manages review
via GitHub PRs. Use when implementing [QE] stories produced by the
design workflow.
Activated by commands: /ingest, /plan, /revise, /code, /validate, /publish, /respond.
---
# E2E Test Workflow Orchestrator

## Quick Start

1. If the user invoked a specific command (e.g., `/plan`, `/code`), read
`commands/{command}.md` and follow it.
2. Otherwise, read `skills/controller.md` to load the workflow controller:
- If the user provided a Jira issue key or URL, execute the `/ingest` phase
- Otherwise, execute the first phase the user requests

If a step fails or produces unexpected output (e.g., Jira MCP errors, test
failures, build errors), stop and report the error to the user. Do not
advance to the next phase. Offer to retry the failed step or escalate.

For principles, hard limits, safety, quality, and escalation rules, see `guidelines.md`.
11 changes: 11 additions & 0 deletions e2e/commands/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: e2e:code
description: "Write e2e test code following discovered patterns, committing incrementally"
---
# /code

Read `../skills/controller.md` and follow it.

Dispatch the **code** phase. Context:

$ARGUMENTS
11 changes: 11 additions & 0 deletions e2e/commands/ingest.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: e2e:ingest
description: "Fetch [QE] story, verify dependencies, explore e2e infrastructure, build test-execution profile"
---
# /ingest

Read `../skills/controller.md` and follow it.

Dispatch the **ingest** phase. Context:

$ARGUMENTS
11 changes: 11 additions & 0 deletions e2e/commands/plan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: e2e:plan
description: "Map acceptance criteria to e2e test scenarios, select reference suite, design test structure"
---
# /plan

Read `../skills/controller.md` and follow it.

Dispatch the **plan** phase. Context:

$ARGUMENTS
11 changes: 11 additions & 0 deletions e2e/commands/publish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: e2e:publish
description: "Push feature branch and create draft PR for e2e tests"
---
# /publish

Read `../skills/controller.md` and follow it.

Dispatch the **publish** phase. Context:

$ARGUMENTS
11 changes: 11 additions & 0 deletions e2e/commands/respond.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: e2e:respond
description: "Fetch and address PR reviewer comments on e2e test code"
---
# /respond

Read `../skills/controller.md` and follow it.

Dispatch the **respond** phase. Context:

$ARGUMENTS
11 changes: 11 additions & 0 deletions e2e/commands/revise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: e2e:revise
description: "Incorporate user feedback into the e2e test plan"
---
# /revise

Read `../skills/controller.md` and follow it.

Dispatch the **revise** phase. Context:

$ARGUMENTS
11 changes: 11 additions & 0 deletions e2e/commands/validate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: e2e:validate
description: "Run e2e tests, check for anti-patterns, verify scenario coverage, assess PR readiness"
---
# /validate

Read `../skills/controller.md` and follow it.

Dispatch the **validate** phase. Context:

$ARGUMENTS
Loading
Loading