@matware/e2e-runner 1.1.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.
Files changed (89) hide show
  1. package/.claude-plugin/marketplace.json +21 -0
  2. package/.claude-plugin/plugin.json +9 -0
  3. package/.mcp.json +9 -0
  4. package/.opencode/commands/create-test.md +63 -0
  5. package/.opencode/commands/run.md +50 -0
  6. package/.opencode/commands/verify-issue.md +62 -0
  7. package/.opencode/skills/e2e-testing/SKILL.md +181 -0
  8. package/.opencode/skills/e2e-testing/references/action-types.md +143 -0
  9. package/.opencode/skills/e2e-testing/references/auth-strategies.md +91 -0
  10. package/.opencode/skills/e2e-testing/references/graphql.md +59 -0
  11. package/.opencode/skills/e2e-testing/references/issue-verification.md +59 -0
  12. package/.opencode/skills/e2e-testing/references/multi-pool.md +60 -0
  13. package/.opencode/skills/e2e-testing/references/network-debugging.md +62 -0
  14. package/.opencode/skills/e2e-testing/references/test-json-format.md +163 -0
  15. package/.opencode/skills/e2e-testing/references/troubleshooting.md +224 -0
  16. package/.opencode/skills/e2e-testing/references/variables.md +41 -0
  17. package/.opencode/skills/e2e-testing/references/visual-verification.md +89 -0
  18. package/OPENCODE.md +166 -0
  19. package/README.md +990 -296
  20. package/agents/test-analyzer.md +81 -0
  21. package/agents/test-creator.md +155 -0
  22. package/agents/test-improver.md +177 -0
  23. package/bin/cli.js +602 -22
  24. package/commands/create-test.md +65 -0
  25. package/commands/run.md +49 -0
  26. package/commands/verify-issue.md +63 -0
  27. package/opencode.json +11 -0
  28. package/package.json +15 -2
  29. package/scripts/setup-opencode.sh +113 -0
  30. package/skills/e2e-testing/SKILL.md +173 -0
  31. package/skills/e2e-testing/references/action-types.md +143 -0
  32. package/skills/e2e-testing/references/auth-strategies.md +91 -0
  33. package/skills/e2e-testing/references/graphql.md +59 -0
  34. package/skills/e2e-testing/references/issue-verification.md +59 -0
  35. package/skills/e2e-testing/references/multi-pool.md +60 -0
  36. package/skills/e2e-testing/references/network-debugging.md +62 -0
  37. package/skills/e2e-testing/references/test-json-format.md +163 -0
  38. package/skills/e2e-testing/references/troubleshooting.md +224 -0
  39. package/skills/e2e-testing/references/variables.md +41 -0
  40. package/skills/e2e-testing/references/visual-verification.md +89 -0
  41. package/src/actions.js +597 -20
  42. package/src/ai-generate.js +142 -12
  43. package/src/config.js +171 -0
  44. package/src/dashboard.js +299 -17
  45. package/src/db.js +335 -13
  46. package/src/index.js +15 -8
  47. package/src/learner-markdown.js +177 -0
  48. package/src/learner-neo4j.js +255 -0
  49. package/src/learner-sqlite.js +658 -0
  50. package/src/learner.js +418 -0
  51. package/src/mcp-tools.js +1558 -50
  52. package/src/module-resolver.js +310 -0
  53. package/src/narrate.js +262 -0
  54. package/src/neo4j-pool.js +124 -0
  55. package/src/pool-manager.js +223 -0
  56. package/src/reporter.js +117 -3
  57. package/src/runner.js +274 -71
  58. package/src/sync/auth.js +354 -0
  59. package/src/sync/client.js +572 -0
  60. package/src/sync/hub-routes.js +816 -0
  61. package/src/sync/index.js +68 -0
  62. package/src/sync/middleware.js +347 -0
  63. package/src/sync/queue.js +209 -0
  64. package/src/sync/schema.js +540 -0
  65. package/src/verify.js +14 -9
  66. package/src/watch.js +384 -0
  67. package/templates/build-dashboard.js +69 -0
  68. package/templates/dashboard/js/api.js +60 -0
  69. package/templates/dashboard/js/init.js +13 -0
  70. package/templates/dashboard/js/keyboard.js +46 -0
  71. package/templates/dashboard/js/state.js +40 -0
  72. package/templates/dashboard/js/toast.js +41 -0
  73. package/templates/dashboard/js/utils.js +196 -0
  74. package/templates/dashboard/js/view-live.js +143 -0
  75. package/templates/dashboard/js/view-runs.js +572 -0
  76. package/templates/dashboard/js/view-tests.js +294 -0
  77. package/templates/dashboard/js/view-watch.js +242 -0
  78. package/templates/dashboard/js/websocket.js +110 -0
  79. package/templates/dashboard/styles/base.css +69 -0
  80. package/templates/dashboard/styles/components.css +110 -0
  81. package/templates/dashboard/styles/view-live.css +74 -0
  82. package/templates/dashboard/styles/view-runs.css +207 -0
  83. package/templates/dashboard/styles/view-tests.css +96 -0
  84. package/templates/dashboard/styles/view-watch.css +53 -0
  85. package/templates/dashboard/template.html +267 -0
  86. package/templates/dashboard.html +2171 -530
  87. package/templates/docker-compose-neo4j.yml +19 -0
  88. package/templates/e2e.config.js +3 -0
  89. package/templates/sample-test.json +0 -8
@@ -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