@matware/e2e-runner 1.2.1 → 1.3.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-plugin/marketplace.json +21 -0
- package/.mcp.json +2 -2
- package/.opencode/commands/create-test.md +63 -0
- package/.opencode/commands/run.md +50 -0
- package/.opencode/commands/verify-issue.md +62 -0
- package/.opencode/skills/e2e-testing/SKILL.md +181 -0
- package/.opencode/skills/e2e-testing/references/action-types.md +143 -0
- package/.opencode/skills/e2e-testing/references/auth-strategies.md +91 -0
- package/.opencode/skills/e2e-testing/references/graphql.md +59 -0
- package/.opencode/skills/e2e-testing/references/issue-verification.md +59 -0
- package/.opencode/skills/e2e-testing/references/multi-pool.md +60 -0
- package/.opencode/skills/e2e-testing/references/network-debugging.md +62 -0
- package/.opencode/skills/e2e-testing/references/test-json-format.md +163 -0
- package/.opencode/skills/e2e-testing/references/troubleshooting.md +224 -0
- package/.opencode/skills/e2e-testing/references/variables.md +41 -0
- package/.opencode/skills/e2e-testing/references/visual-verification.md +89 -0
- package/OPENCODE.md +166 -0
- package/README.md +581 -55
- package/agents/test-creator.md +54 -1
- package/agents/test-improver.md +37 -0
- package/bin/cli.js +408 -16
- package/commands/create-test.md +16 -1
- package/opencode.json +11 -0
- package/package.json +7 -2
- package/scripts/setup-opencode.sh +113 -0
- package/skills/e2e-testing/SKILL.md +10 -3
- package/skills/e2e-testing/references/action-types.md +48 -5
- package/skills/e2e-testing/references/auth-strategies.md +91 -0
- package/skills/e2e-testing/references/graphql.md +59 -0
- package/skills/e2e-testing/references/issue-verification.md +59 -0
- package/skills/e2e-testing/references/multi-pool.md +60 -0
- package/skills/e2e-testing/references/network-debugging.md +62 -0
- package/skills/e2e-testing/references/test-json-format.md +4 -0
- package/skills/e2e-testing/references/troubleshooting.md +44 -2
- package/skills/e2e-testing/references/variables.md +41 -0
- package/skills/e2e-testing/references/visual-verification.md +89 -0
- package/src/actions.js +324 -2
- package/src/ai-generate.js +58 -8
- package/src/config.js +143 -0
- package/src/dashboard.js +145 -13
- package/src/db.js +130 -2
- package/src/index.js +7 -6
- package/src/learner-sqlite.js +304 -0
- package/src/learner.js +8 -3
- package/src/mcp-tools.js +1121 -43
- package/src/module-resolver.js +37 -0
- package/src/narrate.js +37 -0
- package/src/pool-manager.js +223 -0
- package/src/reporter.js +82 -1
- package/src/runner.js +157 -28
- package/src/sync/auth.js +354 -0
- package/src/sync/client.js +572 -0
- package/src/sync/hub-routes.js +816 -0
- package/src/sync/index.js +68 -0
- package/src/sync/middleware.js +347 -0
- package/src/sync/queue.js +209 -0
- package/src/sync/schema.js +540 -0
- package/src/verify.js +10 -7
- package/src/watch.js +384 -0
- package/templates/build-dashboard.js +47 -6
- package/templates/dashboard/js/api.js +60 -0
- package/templates/dashboard/js/init.js +13 -0
- package/templates/dashboard/js/keyboard.js +46 -0
- package/templates/dashboard/js/state.js +40 -0
- package/templates/dashboard/js/toast.js +41 -0
- package/templates/dashboard/js/utils.js +196 -0
- package/templates/dashboard/js/view-live.js +143 -0
- package/templates/dashboard/js/view-runs.js +572 -0
- package/templates/dashboard/js/view-tests.js +294 -0
- package/templates/dashboard/js/view-watch.js +242 -0
- package/templates/dashboard/js/websocket.js +110 -0
- package/templates/dashboard/styles/base.css +69 -0
- package/templates/dashboard/styles/components.css +110 -0
- package/templates/dashboard/styles/view-live.css +74 -0
- package/templates/dashboard/styles/view-runs.css +207 -0
- package/templates/dashboard/styles/view-tests.css +96 -0
- package/templates/dashboard/styles/view-watch.css +53 -0
- package/templates/dashboard/template.html +165 -99
- package/templates/dashboard.html +1596 -541
- package/templates/sample-test.json +0 -8
- package/templates/dashboard/app.js +0 -1152
- package/templates/dashboard/styles.css +0 -413
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Visual Verification Reference
|
|
2
|
+
|
|
3
|
+
Tests can include an `expect` field for AI-powered visual verification. No API key required — Claude Code itself does the visual judgment.
|
|
4
|
+
|
|
5
|
+
## Expect Field Formats
|
|
6
|
+
|
|
7
|
+
### String form — free-form description
|
|
8
|
+
```json
|
|
9
|
+
{
|
|
10
|
+
"name": "dashboard-loads",
|
|
11
|
+
"expect": "Should show the data table with at least 3 rows, no error messages, and the sidebar with navigation links",
|
|
12
|
+
"actions": [
|
|
13
|
+
{ "type": "goto", "value": "/dashboard" },
|
|
14
|
+
{ "type": "wait", "selector": ".data-table" }
|
|
15
|
+
]
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### Array form — per-criterion checklist (each evaluated independently as PASS/FAIL)
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"name": "dashboard-loads",
|
|
23
|
+
"expect": [
|
|
24
|
+
"Data table visible with at least 3 rows",
|
|
25
|
+
"No error messages or red banners",
|
|
26
|
+
"Sidebar shows navigation links"
|
|
27
|
+
],
|
|
28
|
+
"actions": [
|
|
29
|
+
{ "type": "goto", "value": "/dashboard" },
|
|
30
|
+
{ "type": "wait", "selector": ".data-table" }
|
|
31
|
+
]
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Double Screenshot (Before/After)
|
|
36
|
+
|
|
37
|
+
When `expect` is present, the runner captures TWO screenshots:
|
|
38
|
+
1. **Baseline** (`baseline-{name}-{timestamp}.png`) — captured BEFORE test actions run (after `beforeEach` hooks)
|
|
39
|
+
2. **Verification** (`verify-{name}-{timestamp}.png`) — captured AFTER all actions complete
|
|
40
|
+
|
|
41
|
+
Both hashes are registered in SQLite and returned in the MCP response for before/after comparison.
|
|
42
|
+
|
|
43
|
+
## Verification Strictness
|
|
44
|
+
|
|
45
|
+
Controls how strictly Claude Code evaluates visual verification. Set via:
|
|
46
|
+
- Config: `verificationStrictness: 'moderate'`
|
|
47
|
+
- CLI: `--verification-strictness strict`
|
|
48
|
+
- Env: `VERIFICATION_STRICTNESS=strict`
|
|
49
|
+
- MCP: `verificationStrictness: 'strict'` in `e2e_run` args
|
|
50
|
+
|
|
51
|
+
| Level | Behavior |
|
|
52
|
+
|-------|----------|
|
|
53
|
+
| **`strict`** | No ambiguity allowed. If any criterion is unclear, not fully visible, or doubtful → FAIL. |
|
|
54
|
+
| **`moderate`** (default) | Reasonable judgment. Minor cosmetic differences acceptable, functional mismatches → FAIL. |
|
|
55
|
+
| **`lenient`** | Only fail on clear, obvious contradictions. |
|
|
56
|
+
|
|
57
|
+
## MCP Response Format
|
|
58
|
+
|
|
59
|
+
The `e2e_run` response includes a `verifications` array:
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"verifications": [
|
|
63
|
+
{
|
|
64
|
+
"name": "dashboard-loads",
|
|
65
|
+
"expect": ["Data table visible...", "No error messages..."],
|
|
66
|
+
"success": true,
|
|
67
|
+
"screenshotHash": "ss:a3f2b1c9",
|
|
68
|
+
"baselineScreenshotHash": "ss:b4e1c2d8",
|
|
69
|
+
"isChecklist": true
|
|
70
|
+
}
|
|
71
|
+
],
|
|
72
|
+
"verificationInstructions": "Verification strictness: MODERATE — ..."
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Verdict Format
|
|
77
|
+
|
|
78
|
+
After calling `e2e_screenshot` for each hash (after + baseline), Claude Code reports a structured verdict:
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
TEST: dashboard-loads
|
|
82
|
+
VERDICT: PASS
|
|
83
|
+
STATE CHANGE: Page loaded from blank to populated dashboard
|
|
84
|
+
CRITERIA:
|
|
85
|
+
- "Data table visible with at least 3 rows": PASS
|
|
86
|
+
- "No error messages or red banners": PASS
|
|
87
|
+
- "Sidebar shows navigation links": PASS
|
|
88
|
+
REASON: All criteria met, dashboard fully loaded with expected content
|
|
89
|
+
```
|
package/OPENCODE.md
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
# OpenCode Integration
|
|
2
|
+
|
|
3
|
+
This document describes how to use `@matware/e2e-runner` with [OpenCode](https://github.com/anomalyco/opencode).
|
|
4
|
+
|
|
5
|
+
## Quick Setup
|
|
6
|
+
|
|
7
|
+
1. **Install the package** (if not already installed):
|
|
8
|
+
```bash
|
|
9
|
+
npm install -g @matware/e2e-runner
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
2. **Copy configuration to your project**:
|
|
13
|
+
```bash
|
|
14
|
+
# Copy opencode.json to your project root
|
|
15
|
+
cp node_modules/@matware/e2e-runner/opencode.json ./opencode.json
|
|
16
|
+
|
|
17
|
+
# Or merge with existing opencode.json
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. **Copy skills and commands** (optional, for skill/command support):
|
|
21
|
+
```bash
|
|
22
|
+
mkdir -p .opencode
|
|
23
|
+
cp -r node_modules/@matware/e2e-runner/.opencode/* .opencode/
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Configuration
|
|
27
|
+
|
|
28
|
+
### opencode.json
|
|
29
|
+
|
|
30
|
+
The MCP server is configured as a `local` type:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcp": {
|
|
35
|
+
"e2e-runner": {
|
|
36
|
+
"type": "local",
|
|
37
|
+
"command": "node",
|
|
38
|
+
"args": ["node_modules/@matware/e2e-runner/bin/mcp-server.js"],
|
|
39
|
+
"cwd": "${workspaceFolder}"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If installed globally, use the binary name directly:
|
|
46
|
+
```json
|
|
47
|
+
{
|
|
48
|
+
"mcp": {
|
|
49
|
+
"e2e-runner": {
|
|
50
|
+
"type": "local",
|
|
51
|
+
"command": "e2e-runner-mcp"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Available MCP Tools
|
|
58
|
+
|
|
59
|
+
All tools are prefixed with `e2e_`:
|
|
60
|
+
|
|
61
|
+
| Tool | Description |
|
|
62
|
+
|------|-------------|
|
|
63
|
+
| `e2e_pool_status` | Check Chrome pool availability |
|
|
64
|
+
| `e2e_list` | List test suites and modules |
|
|
65
|
+
| `e2e_run` | Execute tests (all, suite, or file) |
|
|
66
|
+
| `e2e_create_test` | Create a new test JSON file |
|
|
67
|
+
| `e2e_create_module` | Create a reusable module |
|
|
68
|
+
| `e2e_screenshot` | Retrieve screenshot by hash |
|
|
69
|
+
| `e2e_capture` | Capture screenshot of any URL |
|
|
70
|
+
| `e2e_network_logs` | Inspect network requests from a run |
|
|
71
|
+
| `e2e_learnings` | Query the learning system |
|
|
72
|
+
| `e2e_issue` | Fetch GitHub/GitLab issue details |
|
|
73
|
+
| `e2e_variables` | Manage test variables |
|
|
74
|
+
| `e2e_dashboard_start` | Start the web dashboard |
|
|
75
|
+
| `e2e_dashboard_stop` | Stop the web dashboard |
|
|
76
|
+
|
|
77
|
+
## Differences from Claude Code
|
|
78
|
+
|
|
79
|
+
| Feature | Claude Code | OpenCode |
|
|
80
|
+
|---------|-------------|----------|
|
|
81
|
+
| MCP Config | `.mcp.json` with `mcpServers` | `opencode.json` with `mcp` |
|
|
82
|
+
| MCP Type | `stdio` | `local` or `remote` |
|
|
83
|
+
| Skills Location | `skills/<name>/SKILL.md` | `.opencode/skills/<name>/SKILL.md` |
|
|
84
|
+
| Commands Location | `commands/*.md` | `.opencode/commands/*.md` |
|
|
85
|
+
| Frontmatter | `allowed_tools` array | No `allowed_tools` (tools are auto-detected) |
|
|
86
|
+
| Skill Triggers | Implicit from description | Explicit `triggers` array in frontmatter |
|
|
87
|
+
| Variable Substitution | `${CLAUDE_PLUGIN_ROOT}` | `${workspaceFolder}` |
|
|
88
|
+
|
|
89
|
+
### Key Differences Explained
|
|
90
|
+
|
|
91
|
+
1. **MCP Server Configuration**
|
|
92
|
+
- Claude Code: Uses `mcpServers` key with `type: "stdio"`
|
|
93
|
+
- OpenCode: Uses `mcp` key with `type: "local"` or `type: "remote"`
|
|
94
|
+
|
|
95
|
+
2. **Skills**
|
|
96
|
+
- Both use `SKILL.md` files with YAML frontmatter
|
|
97
|
+
- OpenCode supports an explicit `triggers` array to activate the skill
|
|
98
|
+
- Location differs: `.opencode/skills/` vs `skills/`
|
|
99
|
+
|
|
100
|
+
3. **Commands**
|
|
101
|
+
- Claude Code: Supports `allowed_tools` to restrict tool access
|
|
102
|
+
- OpenCode: Tools are auto-detected from the MCP server
|
|
103
|
+
- Location differs: `.opencode/commands/` vs `commands/`
|
|
104
|
+
|
|
105
|
+
4. **Variable Expansion**
|
|
106
|
+
- Claude Code: `${CLAUDE_PLUGIN_ROOT}` points to the package root
|
|
107
|
+
- OpenCode: `${workspaceFolder}` points to the current workspace
|
|
108
|
+
|
|
109
|
+
## Directory Structure
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
your-project/
|
|
113
|
+
├── opencode.json # OpenCode configuration
|
|
114
|
+
├── .opencode/
|
|
115
|
+
│ ├── skills/
|
|
116
|
+
│ │ └── e2e-testing/
|
|
117
|
+
│ │ ├── SKILL.md
|
|
118
|
+
│ │ └── references/
|
|
119
|
+
│ │ ├── action-types.md
|
|
120
|
+
│ │ ├── auth-strategies.md
|
|
121
|
+
│ │ └── ...
|
|
122
|
+
│ └── commands/
|
|
123
|
+
│ ├── run.md
|
|
124
|
+
│ ├── create-test.md
|
|
125
|
+
│ └── verify-issue.md
|
|
126
|
+
└── e2e/
|
|
127
|
+
├── e2e.config.json # Test configuration
|
|
128
|
+
├── tests/ # Test JSON files
|
|
129
|
+
└── modules/ # Reusable modules
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Global Installation
|
|
133
|
+
|
|
134
|
+
To make the skill and commands available to all projects:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Copy to global OpenCode config
|
|
138
|
+
mkdir -p ~/.config/opencode/skills
|
|
139
|
+
mkdir -p ~/.config/opencode/commands
|
|
140
|
+
|
|
141
|
+
cp -r node_modules/@matware/e2e-runner/.opencode/skills/* ~/.config/opencode/skills/
|
|
142
|
+
cp -r node_modules/@matware/e2e-runner/.opencode/commands/* ~/.config/opencode/commands/
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Troubleshooting
|
|
146
|
+
|
|
147
|
+
### MCP Server Not Starting
|
|
148
|
+
|
|
149
|
+
1. Check that Node.js >= 20 is installed
|
|
150
|
+
2. Verify the path in `opencode.json` is correct
|
|
151
|
+
3. Try running the server manually:
|
|
152
|
+
```bash
|
|
153
|
+
node node_modules/@matware/e2e-runner/bin/mcp-server.js
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Tools Not Available
|
|
157
|
+
|
|
158
|
+
1. Restart OpenCode after changing `opencode.json`
|
|
159
|
+
2. Check the MCP server logs for errors
|
|
160
|
+
3. Verify the Chrome pool is running: `npx e2e-runner pool status`
|
|
161
|
+
|
|
162
|
+
### Skill Not Loading
|
|
163
|
+
|
|
164
|
+
1. Ensure the skill is in `.opencode/skills/e2e-testing/SKILL.md`
|
|
165
|
+
2. Check the frontmatter has `name` and `description`
|
|
166
|
+
3. Try using a trigger word from the `triggers` array
|