@specwright/plugin 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude_README.md +276 -0
- package/.claude_memory_MEMORY.md +11 -0
- package/.gitignore.snippet +21 -0
- package/PLUGIN.md +172 -0
- package/README-TESTING.md +227 -0
- package/cli.js +53 -0
- package/e2e-tests/.env.testing +29 -0
- package/e2e-tests/data/authenticationData.js +76 -0
- package/e2e-tests/data/testConfig.js +39 -0
- package/e2e-tests/features/playwright-bdd/@Modules/.gitkeep +0 -0
- package/e2e-tests/features/playwright-bdd/@Modules/@Authentication/authentication.feature +64 -0
- package/e2e-tests/features/playwright-bdd/@Modules/@Authentication/steps.js +27 -0
- package/e2e-tests/features/playwright-bdd/@Workflows/.gitkeep +0 -0
- package/e2e-tests/features/playwright-bdd/shared/auth.steps.js +74 -0
- package/e2e-tests/features/playwright-bdd/shared/common.steps.js +52 -0
- package/e2e-tests/features/playwright-bdd/shared/global-hooks.js +44 -0
- package/e2e-tests/features/playwright-bdd/shared/navigation.steps.js +47 -0
- package/e2e-tests/instructions.example.js +110 -0
- package/e2e-tests/instructions.js +9 -0
- package/e2e-tests/playwright/auth-storage/.auth/.gitkeep +0 -0
- package/e2e-tests/playwright/auth.setup.js +74 -0
- package/e2e-tests/playwright/fixtures.js +264 -0
- package/e2e-tests/playwright/generated/.gitkeep +0 -0
- package/e2e-tests/playwright/global.setup.js +49 -0
- package/e2e-tests/playwright/global.teardown.js +23 -0
- package/e2e-tests/playwright/test-data/.gitkeep +0 -0
- package/e2e-tests/utils/stepHelpers.js +404 -0
- package/e2e-tests/utils/testDataGenerator.js +38 -0
- package/install.sh +148 -0
- package/package.json +39 -0
- package/package.json.snippet +27 -0
- package/playwright.config.ts +143 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
# E2E Test Automation — Agentic Architecture
|
|
2
|
+
|
|
3
|
+
## Design Principle
|
|
4
|
+
|
|
5
|
+
**Skills own orchestration. Agents are pure building blocks.**
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
┌─────────────────────────────────────────────────────────────┐
|
|
9
|
+
│ USER │
|
|
10
|
+
│ /e2e-automate │
|
|
11
|
+
│ /e2e-plan │
|
|
12
|
+
│ /e2e-heal │
|
|
13
|
+
│ /e2e-generate │
|
|
14
|
+
└────────────────────────┬────────────────────────────────────┘
|
|
15
|
+
│
|
|
16
|
+
SKILLS LAYER
|
|
17
|
+
(defines agent chains)
|
|
18
|
+
│
|
|
19
|
+
┌───────────────┼───────────────┐
|
|
20
|
+
↓ ↓ ↓
|
|
21
|
+
┌─────────┐ ┌─────────┐ ┌─────────┐
|
|
22
|
+
│ Agent A │ │ Agent B │ │ Agent C │
|
|
23
|
+
│ (pure) │ │ (pure) │ │ (pure) │
|
|
24
|
+
└─────────┘ └─────────┘ └─────────┘
|
|
25
|
+
│ │ │
|
|
26
|
+
AGENT MEMORY AGENT MEMORY AGENT MEMORY
|
|
27
|
+
(persists across sessions)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
- **Skills** (`.claude/skills/`) — user-facing commands that define WHICH agents to invoke and in WHAT order. Skills own the workflow logic.
|
|
31
|
+
- **Agents** (`.claude/agents/`) — single-responsibility units. Each agent does ONE thing well. No agent invokes another agent — only skills do that.
|
|
32
|
+
- **Agent Memory** (`.claude/agent-memory/`) — persistent knowledge per agent. Selectors, patterns, and fixes survive across sessions.
|
|
33
|
+
- **Rules** (`.claude/rules/`) — project conventions, architecture decisions, debugging gotchas. Loaded as context for all agents.
|
|
34
|
+
|
|
35
|
+
This architecture makes agents **reusable as a plugin** — anyone can create new skills with custom agent chains from the same building blocks.
|
|
36
|
+
|
|
37
|
+
## The 10-Phase Pipeline
|
|
38
|
+
|
|
39
|
+
When you run `/e2e-automate`, the skill orchestrates this flow:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
┌──────────────────────────────────────────────────────────────┐
|
|
43
|
+
│ Phase 1: Read e2e-tests/instructions.js │
|
|
44
|
+
│ Phase 2: Detect route (Jira URL / file path / text) │
|
|
45
|
+
│ │
|
|
46
|
+
│ Phase 3: /e2e-process │
|
|
47
|
+
│ ├─ Jira → @agent-jira-processor → @agent-input-processor │
|
|
48
|
+
│ └─ File/Text → @agent-input-processor │
|
|
49
|
+
│ Output: e2e-tests/plans/{module}-parsed.md │
|
|
50
|
+
│ │
|
|
51
|
+
│ Phase 4: /e2e-plan │
|
|
52
|
+
│ └─ @agent-playwright-test-planner │
|
|
53
|
+
│ Output: plan.md + seed.spec.js + agent memory update │
|
|
54
|
+
│ │
|
|
55
|
+
│ Phase 5: /e2e-validate (optional) │
|
|
56
|
+
│ └─ @agent-execution-manager (seed mode) │
|
|
57
|
+
│ │
|
|
58
|
+
│ Phase 6: ⛔ USER APPROVAL CHECKPOINT │
|
|
59
|
+
│ └─ Review plan summary, approve or modify │
|
|
60
|
+
│ │
|
|
61
|
+
│ Phase 7: /e2e-generate │
|
|
62
|
+
│ ├─ @agent-bdd-generator → .feature + steps.js skeleton │
|
|
63
|
+
│ └─ @agent-code-generator → Playwright implementations │
|
|
64
|
+
│ Output: e2e-tests/features/playwright-bdd/@Modules/... │
|
|
65
|
+
│ │
|
|
66
|
+
│ Phase 8: /e2e-heal (optional) │
|
|
67
|
+
│ ├─ @agent-execution-manager → run + triage + source-fix │
|
|
68
|
+
│ └─ @agent-playwright-test-healer → MCP-based healing │
|
|
69
|
+
│ (loop max 3 iterations) │
|
|
70
|
+
│ │
|
|
71
|
+
│ Phase 9: Cleanup intermediate plan files │
|
|
72
|
+
│ Phase 10: Quality score + formatted review summary │
|
|
73
|
+
└──────────────────────────────────────────────────────────────┘
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## How Skills Chain Agents
|
|
77
|
+
|
|
78
|
+
Each skill defines its agent chain in the SKILL.md body. Example from `/e2e-heal`:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
Step 1: @agent-execution-manager → run tests, triage, source-fix
|
|
82
|
+
Step 2: @agent-playwright-test-healer → fix remaining via MCP
|
|
83
|
+
Step 3: Re-run (loop max 3)
|
|
84
|
+
Step 4: Update agent memory with findings
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The agents don't know about each other — the skill passes context between them.
|
|
88
|
+
|
|
89
|
+
## Data Flow: `<gen_test_data>` → `<from_test_data>`
|
|
90
|
+
|
|
91
|
+
The framework uses a **3-column data table** pattern for form filling and assertion:
|
|
92
|
+
|
|
93
|
+
```gherkin
|
|
94
|
+
# Form fill — generates faker values, caches them
|
|
95
|
+
When I fill the form with:
|
|
96
|
+
| Field Name | Value | Type |
|
|
97
|
+
| Name | <gen_test_data> | SharedGenerated |
|
|
98
|
+
| Email | <gen_test_data> | SharedGenerated |
|
|
99
|
+
|
|
100
|
+
# Assertion — reads cached values, asserts against UI
|
|
101
|
+
Then the card should display:
|
|
102
|
+
| Field Name | Expected Value | Type |
|
|
103
|
+
| Name | <from_test_data> | SharedGenerated |
|
|
104
|
+
| Email | <from_test_data> | SharedGenerated |
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
Powered by `e2e-tests/utils/stepHelpers.js` (`processDataTable` / `validateExpectations`) which handles value generation, caching, and field interaction declaratively via `FIELD_CONFIG` with `FIELD_TYPES`.
|
|
108
|
+
|
|
109
|
+
## Execution Modes
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
fullyParallel: true (global default)
|
|
113
|
+
│
|
|
114
|
+
├─ No tag needed → parallel (main-e2e project)
|
|
115
|
+
│ Each scenario gets a fresh browser
|
|
116
|
+
│
|
|
117
|
+
└─ @serial-execution → serial (serial-execution project, workers: 1)
|
|
118
|
+
Browser page REUSED across scenarios within same feature file
|
|
119
|
+
Required when: <gen_test_data> in Scenario A, <from_test_data> in Scenario B
|
|
120
|
+
Required when: scenarios depend on UI state from previous scenarios
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## Usage
|
|
124
|
+
|
|
125
|
+
### Generate tests from instructions
|
|
126
|
+
|
|
127
|
+
1. Configure `e2e-tests/instructions.js` (see `instructions.example.js` for text, Jira, CSV, workflow examples)
|
|
128
|
+
2. Start dev server: `pnpm dev`
|
|
129
|
+
3. Run: `/e2e-automate`
|
|
130
|
+
4. Review the plan summary at Phase 6 approval checkpoint
|
|
131
|
+
5. Type `1` to approve and generate BDD files
|
|
132
|
+
6. Run generated tests: `pnpm test:bdd`
|
|
133
|
+
|
|
134
|
+
### Plan tests for a page
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
/e2e-plan /users/add # Explore page, discover selectors, generate plan
|
|
138
|
+
/e2e-plan "Login flow" # Plan by feature description
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Generate tests from a plan
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
/e2e-generate /e2e-tests/plans/add_user-plan.md
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Fix failing tests
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
/e2e-heal # Fix all failing tests
|
|
151
|
+
/e2e-heal @counter # Fix specific module
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Quick test run
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
/e2e-run # Run all BDD tests
|
|
158
|
+
/e2e-run --grep @add-user # Run specific tag
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Process Jira or files into test plans
|
|
162
|
+
|
|
163
|
+
```
|
|
164
|
+
/e2e-process https://org.atlassian.net/browse/PROJ-123
|
|
165
|
+
/e2e-process /path/to/test-cases.xlsx
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Skills (7)
|
|
169
|
+
|
|
170
|
+
| Skill | Command | Chain |
|
|
171
|
+
| ---------------- | ---------------------- | ------------------------------------------------------------ |
|
|
172
|
+
| **e2e-automate** | `/e2e-automate` | Full 10-phase pipeline (all agents) |
|
|
173
|
+
| **e2e-plan** | `/e2e-plan <page>` | `playwright-test-planner` |
|
|
174
|
+
| **e2e-generate** | `/e2e-generate <plan>` | `bdd-generator` → `code-generator` |
|
|
175
|
+
| **e2e-heal** | `/e2e-heal [target]` | `execution-manager` ↔ `playwright-test-healer` (loop max 3) |
|
|
176
|
+
| **e2e-validate** | `/e2e-validate` | `execution-manager` ↔ `playwright-test-healer` (seed mode) |
|
|
177
|
+
| **e2e-process** | `/e2e-process <input>` | `jira-processor` → `input-processor` |
|
|
178
|
+
| **e2e-run** | `/e2e-run [filters]` | Direct `npx bddgen && npx playwright test` |
|
|
179
|
+
|
|
180
|
+
## Agents (8)
|
|
181
|
+
|
|
182
|
+
| Agent | Model | Purpose |
|
|
183
|
+
| --------------------------- | ------ | ----------------------------------------------------------------------------- |
|
|
184
|
+
| `playwright-test-planner` | opus | Browser exploration via MCP, selector discovery, test plan + seed file |
|
|
185
|
+
| `playwright-test-generator` | opus | MCP-based Playwright code generation from plans |
|
|
186
|
+
| `playwright-test-healer` | opus | Debug and fix failing tests interactively via MCP |
|
|
187
|
+
| `bdd-generator` | opus | Create .feature files + steps.js skeletons (Gherkin, tags, data tables) |
|
|
188
|
+
| `code-generator` | opus | Fill in Playwright implementations using seed file selectors + stepHelpers.js |
|
|
189
|
+
| `execution-manager` | sonnet | Run tests (BDD or seed), triage, source-aware fixing, review plans |
|
|
190
|
+
| `input-processor` | sonnet | Convert files (Excel/CSV/PDF/JSON) to test plan MD via Markitdown MCP |
|
|
191
|
+
| `jira-processor` | sonnet | Fetch Jira requirements via Atlassian MCP, analyze gaps, clarify with user |
|
|
192
|
+
|
|
193
|
+
## MCP Servers
|
|
194
|
+
|
|
195
|
+
| Server | Agent | Purpose |
|
|
196
|
+
| -------------- | --------------------------------------------- | ------------------------------------------------ |
|
|
197
|
+
| playwright-mcp | planner, generator, healer, execution-manager | Browser automation |
|
|
198
|
+
| markitdown | input-processor | File format conversion (Excel, CSV, PDF, etc.) |
|
|
199
|
+
| atlassian | jira-processor | Jira ticket fetching and requirements extraction |
|
|
200
|
+
|
|
201
|
+
## Key Utilities
|
|
202
|
+
|
|
203
|
+
| File | Purpose |
|
|
204
|
+
| -------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
205
|
+
| `e2e-tests/utils/stepHelpers.js` | `processDataTable`, `validateExpectations`, `FIELD_TYPES` — declarative form handling |
|
|
206
|
+
| `e2e-tests/utils/testDataGenerator.js` | `generateValueForField(fieldName)` — faker-based data generation |
|
|
207
|
+
| `e2e-tests/playwright/fixtures.js` | Custom fixtures, browser reuse for serial-execution, scoped data API |
|
|
208
|
+
|
|
209
|
+
## Agent Memory System
|
|
210
|
+
|
|
211
|
+
Three agents persist knowledge across sessions:
|
|
212
|
+
|
|
213
|
+
| Agent | What it remembers |
|
|
214
|
+
| --------------------------- | ------------------------------------------------------------------------------------- |
|
|
215
|
+
| **playwright-test-planner** | Navigation paths, discovered selectors per page, reusable patterns, known limitations |
|
|
216
|
+
| **playwright-test-healer** | Project conventions, module selector patterns, anti-patterns, last 20 selector fixes |
|
|
217
|
+
| **execution-manager** | Module → src/ path mappings, ARIA quirks, data flow, environment risks |
|
|
218
|
+
|
|
219
|
+
Memory files live in `.claude/agent-memory/{agent}/MEMORY.md`. Skills update memory as a mandatory final step.
|
|
220
|
+
|
|
221
|
+
## Creating Custom Skills
|
|
222
|
+
|
|
223
|
+
Any skill can chain agents in any order. Example:
|
|
224
|
+
|
|
225
|
+
```markdown
|
|
226
|
+
---
|
|
227
|
+
name: my-custom-workflow
|
|
228
|
+
description: My custom E2E workflow
|
|
229
|
+
context: fork
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
## Steps
|
|
233
|
+
|
|
234
|
+
1. Invoke `@agent-input-processor` with the file path
|
|
235
|
+
2. Invoke `@agent-bdd-generator` with the parsed plan
|
|
236
|
+
3. Invoke `@agent-code-generator` with the step skeleton
|
|
237
|
+
4. Invoke `@agent-execution-manager` in bdd mode
|
|
238
|
+
5. Report results
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Directory Layout
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
.claude/
|
|
245
|
+
├── README.md ← This file (architecture + usage)
|
|
246
|
+
├── agents/
|
|
247
|
+
│ ├── playwright/
|
|
248
|
+
│ │ ├── playwright-test-planner.md
|
|
249
|
+
│ │ ├── playwright-test-generator.md
|
|
250
|
+
│ │ └── playwright-test-healer.md
|
|
251
|
+
│ ├── bdd-generator.md
|
|
252
|
+
│ ├── code-generator.md
|
|
253
|
+
│ ├── execution-manager.md
|
|
254
|
+
│ ├── input-processor.md
|
|
255
|
+
│ └── jira-processor.md
|
|
256
|
+
├── agent-memory/
|
|
257
|
+
│ ├── playwright-test-planner/MEMORY.md
|
|
258
|
+
│ ├── playwright-test-healer/MEMORY.md
|
|
259
|
+
│ └── execution-manager/MEMORY.md
|
|
260
|
+
├── skills/
|
|
261
|
+
│ ├── e2e-automate/SKILL.md
|
|
262
|
+
│ ├── e2e-plan/SKILL.md
|
|
263
|
+
│ ├── e2e-generate/SKILL.md
|
|
264
|
+
│ ├── e2e-heal/SKILL.md
|
|
265
|
+
│ ├── e2e-validate/SKILL.md
|
|
266
|
+
│ ├── e2e-process/SKILL.md
|
|
267
|
+
│ └── e2e-run/SKILL.md
|
|
268
|
+
├── rules/
|
|
269
|
+
│ ├── architecture.md
|
|
270
|
+
│ ├── conventions.md
|
|
271
|
+
│ ├── debugging.md
|
|
272
|
+
│ ├── dependencies.md
|
|
273
|
+
│ └── onboarding.md
|
|
274
|
+
└── memory/
|
|
275
|
+
└── MEMORY.md
|
|
276
|
+
```
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Memory Index
|
|
2
|
+
|
|
3
|
+
## Project
|
|
4
|
+
|
|
5
|
+
- [E2E Framework Architecture](../rules/architecture.md) — Path-based tag scoping, 3-layer data persistence, skills-own-orchestration pattern, 10-phase agent pipeline
|
|
6
|
+
|
|
7
|
+
## Agent Memory
|
|
8
|
+
|
|
9
|
+
- [Planner Memory](../agent-memory/playwright-test-planner/MEMORY.md) — Navigation paths, selectors, reusable patterns
|
|
10
|
+
- [Healer Memory](../agent-memory/playwright-test-healer/MEMORY.md) — Conventions, anti-patterns, selector fixes
|
|
11
|
+
- [Execution Manager Memory](../agent-memory/execution-manager/MEMORY.md) — Module→src mappings, selector patterns, known risks
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Add these lines to your project's .gitignore
|
|
2
|
+
|
|
3
|
+
# Claude Code (user-specific settings, not tracked)
|
|
4
|
+
.claude/settings.local.json
|
|
5
|
+
|
|
6
|
+
# Agent memory (runtime data, populated per-project)
|
|
7
|
+
.claude/agent-memory/
|
|
8
|
+
|
|
9
|
+
# playwright-bdd generated specs
|
|
10
|
+
.features-gen/
|
|
11
|
+
|
|
12
|
+
# E2E auth and test data
|
|
13
|
+
e2e-tests/playwright/auth-storage/.auth/user.json
|
|
14
|
+
e2e-tests/playwright/test-data/*.json
|
|
15
|
+
e2e-tests/playwright/test-data/**/*.json
|
|
16
|
+
|
|
17
|
+
# Reports
|
|
18
|
+
reports/cucumber-bdd/*
|
|
19
|
+
reports/playwright/*
|
|
20
|
+
reports/json/*
|
|
21
|
+
reports/screenshots/*
|
package/PLUGIN.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# E2E Automation Plugin
|
|
2
|
+
|
|
3
|
+
Drop-in E2E test automation framework with AI-powered test generation, execution, and self-healing.
|
|
4
|
+
|
|
5
|
+
Built on **playwright-bdd** (Gherkin BDD) + **Claude Code agents** (8 agents, 7 skills).
|
|
6
|
+
|
|
7
|
+
## What You Get
|
|
8
|
+
|
|
9
|
+
- **Playwright BDD framework** — Gherkin `.feature` files compiled to Playwright specs
|
|
10
|
+
- **8 AI agents** — explore apps, generate tests, fix failures, process Jira tickets
|
|
11
|
+
- **7 Claude Code skills** — `/e2e-automate`, `/e2e-plan`, `/e2e-generate`, `/e2e-heal`, `/e2e-validate`, `/e2e-process`, `/e2e-run`
|
|
12
|
+
- **Shared step library** — auth, navigation, common assertions, global hooks
|
|
13
|
+
- **processDataTable utility** — declarative form filling with `FIELD_TYPES` and faker data generation
|
|
14
|
+
- **3-layer data persistence** — scenario → in-memory cache → scoped JSON files
|
|
15
|
+
- **Feature-level browser reuse** — `@serial-execution` shares browser across scenarios
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
|
|
19
|
+
- Node.js 18+, pnpm
|
|
20
|
+
- Claude Code CLI
|
|
21
|
+
- MCP servers: `playwright-mcp`, `markitdown` (optional), `atlassian` (optional for Jira)
|
|
22
|
+
|
|
23
|
+
## Installation
|
|
24
|
+
|
|
25
|
+
### Quick Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# From your project root (includes authentication tests):
|
|
29
|
+
bash path/to/e2e-plugin/install.sh
|
|
30
|
+
|
|
31
|
+
# Skip authentication module if your app doesn't have sign-in:
|
|
32
|
+
bash path/to/e2e-plugin/install.sh --skip-auth
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Manual Install
|
|
36
|
+
|
|
37
|
+
1. Copy `.claude/` contents to your project root (agents, skills, rules, memory)
|
|
38
|
+
2. Copy `e2e-tests/` contents to your project root (fixtures, shared steps, utils)
|
|
39
|
+
3. Copy `playwright.config.ts` to your project root
|
|
40
|
+
4. Merge `package.json.snippet` devDependencies and scripts into your `package.json`
|
|
41
|
+
5. Append `.gitignore.snippet` lines to your `.gitignore`
|
|
42
|
+
|
|
43
|
+
### Post-Install
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# 1. Install dependencies
|
|
47
|
+
pnpm install
|
|
48
|
+
|
|
49
|
+
# 2. Install Playwright browsers
|
|
50
|
+
pnpx playwright install
|
|
51
|
+
|
|
52
|
+
# 3. Configure for your app (see Configuration below)
|
|
53
|
+
|
|
54
|
+
# 4. Verify
|
|
55
|
+
pnpm test:bdd
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Configuration
|
|
59
|
+
|
|
60
|
+
### 1. Authentication (`e2e-tests/data/authenticationData.js`)
|
|
61
|
+
|
|
62
|
+
Update the `locators` object to match your app's login form:
|
|
63
|
+
|
|
64
|
+
```javascript
|
|
65
|
+
locators: {
|
|
66
|
+
emailInput: { testId: 'your-email-input-testid' },
|
|
67
|
+
emailSubmitButton: { testId: 'your-email-submit-testid' },
|
|
68
|
+
passwordInput: { testId: 'your-password-input-testid' },
|
|
69
|
+
loginSubmitButton: { testId: 'your-login-submit-testid' },
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 2. Routes (`e2e-tests/data/testConfig.js`)
|
|
74
|
+
|
|
75
|
+
Add your app's routes:
|
|
76
|
+
|
|
77
|
+
```javascript
|
|
78
|
+
routes: {
|
|
79
|
+
Home: '/home',
|
|
80
|
+
SignIn: '/signin',
|
|
81
|
+
Dashboard: '/dashboard', // Your routes
|
|
82
|
+
Settings: '/settings',
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 3. Environment Variables (`.env`)
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
BASE_URL=http://localhost:5173
|
|
90
|
+
TEST_USER_EMAIL=your-email@example.com
|
|
91
|
+
TEST_USER_PASSWORD=your-password
|
|
92
|
+
HEADLESS=true
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### 4. Auth Flow (`e2e-tests/playwright/auth.setup.js`)
|
|
96
|
+
|
|
97
|
+
The default auth setup uses a two-step login (email → password). If your app has a different login flow, update `auth.setup.js` to match.
|
|
98
|
+
|
|
99
|
+
## Running Tests
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
pnpm test:bdd # All tests except auth
|
|
103
|
+
pnpm test:bdd:auth # Authentication tests only (clean browser state)
|
|
104
|
+
pnpm test:bdd:all # Everything including auth
|
|
105
|
+
pnpm test:bdd:serial # Serial execution tests only
|
|
106
|
+
pnpm test:bdd:debug # Debug mode
|
|
107
|
+
pnpm report:playwright # View HTML report
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Out-of-the-Box Tests
|
|
111
|
+
|
|
112
|
+
The plugin includes a pre-built **@Authentication** module (7 scenarios):
|
|
113
|
+
|
|
114
|
+
- Login form display, successful login flow, invalid email, invalid credentials
|
|
115
|
+
- Empty email validation, logout flow, unauthenticated access protection
|
|
116
|
+
|
|
117
|
+
Run with: `pnpm test:bdd:auth`
|
|
118
|
+
|
|
119
|
+
Skip during install with: `bash install.sh --skip-auth`
|
|
120
|
+
|
|
121
|
+
## Creating Tests
|
|
122
|
+
|
|
123
|
+
### Manually
|
|
124
|
+
|
|
125
|
+
1. Create `e2e-tests/features/playwright-bdd/@Modules/@YourModule/`
|
|
126
|
+
2. Add `your-feature.feature` + `steps.js`
|
|
127
|
+
3. Run `pnpm test:bdd`
|
|
128
|
+
|
|
129
|
+
### Via AI Agents
|
|
130
|
+
|
|
131
|
+
1. Configure `e2e-tests/instructions.js` (copy from `instructions.example.js`)
|
|
132
|
+
2. Start dev server: `pnpm dev`
|
|
133
|
+
3. Run `/e2e-automate` in Claude Code CLI
|
|
134
|
+
4. Approve the plan at Phase 6
|
|
135
|
+
5. Tests are generated automatically
|
|
136
|
+
|
|
137
|
+
### Fix Failing Tests
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
/e2e-heal # Auto-fix all failing tests
|
|
141
|
+
/e2e-heal @module # Fix specific module
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Plugin Contents
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
e2e-plugin/
|
|
148
|
+
├── PLUGIN.md ← This file
|
|
149
|
+
├── install.sh ← Installation script
|
|
150
|
+
├── package.json.snippet ← Dependencies + scripts to merge
|
|
151
|
+
├── .gitignore.snippet ← Lines to add to .gitignore
|
|
152
|
+
├── playwright.config.ts ← Multi-project BDD config
|
|
153
|
+
├── README-TESTING.md ← Full testing documentation
|
|
154
|
+
├── .claude_README.md ← Agentic architecture docs
|
|
155
|
+
├── .claude_agents/ ← 8 agent system prompts
|
|
156
|
+
├── .claude_skills/ ← 7 skill definitions
|
|
157
|
+
├── .claude_rules/ ← 5 rule files
|
|
158
|
+
├── .claude_agent-memory/ ← Empty memory stubs
|
|
159
|
+
├── .claude_memory_MEMORY.md ← Memory index
|
|
160
|
+
└── e2e-tests/
|
|
161
|
+
├── playwright/ ← Fixtures, auth setup, global hooks
|
|
162
|
+
├── features/playwright-bdd/
|
|
163
|
+
│ ├── shared/ ← Reusable step definitions
|
|
164
|
+
│ ├── @Modules/@Authentication/← Out-of-the-box auth tests (7 scenarios)
|
|
165
|
+
│ ├── @Modules/.gitkeep ← Ready for your module tests
|
|
166
|
+
│ └── @Workflows/.gitkeep ← Ready for workflow tests (precondition/consumer)
|
|
167
|
+
├── utils/ ← stepHelpers.js, testDataGenerator.js
|
|
168
|
+
├── data/ ← Auth data + test config templates
|
|
169
|
+
├── instructions.js ← Empty config (add your entries)
|
|
170
|
+
├── instructions.example.js ← Example pipeline configs
|
|
171
|
+
└── .env.testing ← Environment variable template
|
|
172
|
+
```
|