assuremind 1.0.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/CONTRIBUTING.md +254 -0
- package/LICENSE +21 -0
- package/README.md +367 -0
- package/dist/cli/index.js +14933 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.mts +2950 -0
- package/dist/index.d.ts +2950 -0
- package/dist/index.js +1628 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1525 -0
- package/dist/index.mjs.map +1 -0
- package/docs/CLI-REFERENCE.md +312 -0
- package/docs/GETTING-STARTED.md +378 -0
- package/docs/STUDIO.md +390 -0
- package/package.json +118 -0
- package/templates/AUTOMIND.md +275 -0
- package/templates/autotest.config.ts +25 -0
- package/templates/docs/CLI-REFERENCE.md +413 -0
- package/templates/docs/GETTING-STARTED.md +417 -0
- package/templates/docs/STUDIO.md +625 -0
- package/templates/env.example +112 -0
- package/templates/env.minimal +103 -0
- package/templates/gitignore +17 -0
- package/templates/global-variables.json +5 -0
- package/ui/dist/assets/index-CdtAorWT.js +819 -0
- package/ui/dist/assets/index-KjpMCzao.css +1 -0
- package/ui/dist/favicon.svg +36 -0
- package/ui/dist/index.html +15 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
# Assuremind — Quick Reference
|
|
2
|
+
|
|
3
|
+
> AI-powered codeless UI test automation. Write steps in plain English, AI writes Playwright code once, tests run forever.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Daily Commands
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Start the Studio (browser UI)
|
|
11
|
+
npx assuremind studio
|
|
12
|
+
|
|
13
|
+
# Run all tests
|
|
14
|
+
npx assuremind run --all
|
|
15
|
+
|
|
16
|
+
# Run by suite type (ui | api | audit)
|
|
17
|
+
npx assuremind run --type ui
|
|
18
|
+
npx assuremind run --type api
|
|
19
|
+
npx assuremind run --type audit
|
|
20
|
+
|
|
21
|
+
# Run a specific suite (partial name match)
|
|
22
|
+
npx assuremind run --suite "Login Tests"
|
|
23
|
+
|
|
24
|
+
# Run tests by tag
|
|
25
|
+
npx assuremind run --tag smoke
|
|
26
|
+
|
|
27
|
+
# Run a single test (partial name match)
|
|
28
|
+
npx assuremind run --test "User can log in"
|
|
29
|
+
|
|
30
|
+
# Combine filters (AND logic)
|
|
31
|
+
npx assuremind run --type audit --tag regression
|
|
32
|
+
npx assuremind run --suite "Orange HRM" --tag smoke
|
|
33
|
+
npx assuremind run --type audit --test "Login Page"
|
|
34
|
+
|
|
35
|
+
# Device emulation — mobile & tablet
|
|
36
|
+
npx assuremind run --all --device "iPhone 15 Pro" --browser chromium
|
|
37
|
+
npx assuremind run --tag smoke --device "Pixel 7" --browser chromium
|
|
38
|
+
npx assuremind run --all --device "iPad Pro 11" --browser webkit
|
|
39
|
+
|
|
40
|
+
# Run in CI (exit code = pass/fail)
|
|
41
|
+
npx assuremind run --all --ci
|
|
42
|
+
npx assuremind run --all --device "iPhone 15 Pro" --browser chromium --ci
|
|
43
|
+
|
|
44
|
+
# Watch the browser while running
|
|
45
|
+
npx assuremind run --all --headed
|
|
46
|
+
|
|
47
|
+
# Review + apply self-healing suggestions
|
|
48
|
+
npx assuremind apply-healing
|
|
49
|
+
|
|
50
|
+
# Accept all healing suggestions silently
|
|
51
|
+
npx assuremind apply-healing --yes
|
|
52
|
+
|
|
53
|
+
# Generate tests from a user story
|
|
54
|
+
npx assuremind generate --story "As a user I want to..."
|
|
55
|
+
|
|
56
|
+
# Check config and environment
|
|
57
|
+
npx assuremind validate
|
|
58
|
+
npx assuremind doctor
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## Project Structure
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
.
|
|
67
|
+
├── .env ← AI provider credentials (never commit)
|
|
68
|
+
├── .env.example ← Provider reference (safe to commit)
|
|
69
|
+
├── autotest.config.ts ← Framework configuration
|
|
70
|
+
├── TESTAUTOMIND.md ← This file
|
|
71
|
+
│
|
|
72
|
+
├── tests/
|
|
73
|
+
│ ├── <suite-slug>/ ← UI and API suites
|
|
74
|
+
│ │ ├── suite.json ← Suite metadata
|
|
75
|
+
│ │ └── <case-slug>.test.json ← Test case with steps
|
|
76
|
+
│ └── audit/ ← Audit suites (Lighthouse)
|
|
77
|
+
│ ├── suite.json
|
|
78
|
+
│ └── <case-slug>.test.json
|
|
79
|
+
│
|
|
80
|
+
├── variables/
|
|
81
|
+
│ ├── global.json ← Variables available in all environments
|
|
82
|
+
│ ├── dev.env.json ← Variables for --env dev
|
|
83
|
+
│ ├── staging.env.json ← Variables for --env staging
|
|
84
|
+
│ └── prod.env.json ← Variables for --env prod
|
|
85
|
+
│
|
|
86
|
+
├── fixtures/
|
|
87
|
+
│ ├── auth/ ← Auth state files (Playwright storageState)
|
|
88
|
+
│ └── data/ ← Test data files
|
|
89
|
+
│
|
|
90
|
+
└── results/
|
|
91
|
+
├── runs/ ← Run result JSON files
|
|
92
|
+
├── screenshots/ ← Failure screenshots
|
|
93
|
+
├── videos/ ← Video recordings
|
|
94
|
+
├── traces/ ← Playwright trace files
|
|
95
|
+
├── reports/ ← HTML / Allure reports
|
|
96
|
+
└── healing/ ← Healing report + pending suggestions
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Writing Step Instructions
|
|
102
|
+
|
|
103
|
+
| Pattern | Example |
|
|
104
|
+
|---------|---------|
|
|
105
|
+
| Navigate | `Go to the login page` |
|
|
106
|
+
| Click | `Click the Login button` |
|
|
107
|
+
| Fill | `Enter "admin@example.com" in the email field` |
|
|
108
|
+
| Select | `Select "United States" from the country dropdown` |
|
|
109
|
+
| Assert visible | `Verify the success message is visible` |
|
|
110
|
+
| Assert text | `Verify the heading contains "Dashboard"` |
|
|
111
|
+
| Assert URL | `Verify the URL contains "/dashboard"` |
|
|
112
|
+
| Wait | `Wait for the loading spinner to disappear` |
|
|
113
|
+
| Upload | `Upload the file "fixtures/data/avatar.png" to the photo field` |
|
|
114
|
+
| Variable | `Enter "{{ADMIN_EMAIL}}" in the email field` |
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Variables
|
|
119
|
+
|
|
120
|
+
Reference variables in instructions with `{{KEY}}`:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
Enter "{{BASE_URL}}" in the address bar
|
|
124
|
+
Enter "{{ADMIN_EMAIL}}" in the email field
|
|
125
|
+
Enter "{{ADMIN_PASSWORD}}" in the password field
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Define them in `variables/global.json`:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"BASE_URL": "http://localhost:3000",
|
|
133
|
+
"ADMIN_EMAIL": "admin@example.com",
|
|
134
|
+
"ADMIN_PASSWORD": { "value": "supersecret", "secret": true }
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## .env — AI Provider Setup
|
|
141
|
+
|
|
142
|
+
Edit `.env` in this directory. Pick one provider block:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Anthropic (Claude) — recommended
|
|
146
|
+
AI_PROVIDER=anthropic
|
|
147
|
+
ANTHROPIC_API_KEY=sk-ant-xxxxxxxx
|
|
148
|
+
|
|
149
|
+
# OpenAI (GPT-4o)
|
|
150
|
+
AI_PROVIDER=openai
|
|
151
|
+
OPENAI_API_KEY=sk-xxxxxxxx
|
|
152
|
+
|
|
153
|
+
# Google (Gemini)
|
|
154
|
+
AI_PROVIDER=google
|
|
155
|
+
GOOGLE_API_KEY=AIzaxxxxxxxx
|
|
156
|
+
|
|
157
|
+
# Groq (fast + free tier)
|
|
158
|
+
AI_PROVIDER=groq
|
|
159
|
+
GROQ_API_KEY=gsk_xxxxxxxx
|
|
160
|
+
|
|
161
|
+
# Ollama (local, free)
|
|
162
|
+
AI_PROVIDER=ollama
|
|
163
|
+
OLLAMA_BASE_URL=http://localhost:11434
|
|
164
|
+
OLLAMA_MODEL=llama3.3
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
See `.env.example` for all 12 supported providers.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## autotest.config.ts — Key Settings
|
|
172
|
+
|
|
173
|
+
```typescript
|
|
174
|
+
export default defineConfig({
|
|
175
|
+
baseUrl: 'http://localhost:3000', // Your app URL
|
|
176
|
+
browsers: ['chromium'], // chromium | firefox | webkit
|
|
177
|
+
headless: true, // false = watch browser
|
|
178
|
+
timeout: 30000, // Step timeout (ms)
|
|
179
|
+
retries: 1, // Retries on failure
|
|
180
|
+
parallel: 2, // Parallel workers
|
|
181
|
+
screenshot: 'on-failure', // on | off | on-failure
|
|
182
|
+
video: 'off', // on | off | on-failure
|
|
183
|
+
trace: 'on-failure', // on | off | on-failure
|
|
184
|
+
device: 'iPhone 15 Pro', // optional — Playwright device descriptor
|
|
185
|
+
healing: {
|
|
186
|
+
enabled: true,
|
|
187
|
+
maxLevel: 5, // 1–6
|
|
188
|
+
dailyBudget: 5.0, // Max USD/day on healing
|
|
189
|
+
},
|
|
190
|
+
studioPort: 4400,
|
|
191
|
+
});
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Self-Healing Levels
|
|
197
|
+
|
|
198
|
+
| Level | Strategy |
|
|
199
|
+
|-------|---------|
|
|
200
|
+
| 1 | Smart Retry — wait + retry with backoff |
|
|
201
|
+
| 2 | AI Regeneration — AI rewrites Playwright code |
|
|
202
|
+
| 3 | Multi-Selector — try alternate selectors (ID, text, role, aria) |
|
|
203
|
+
| 4 | Visual/SoM — screenshot + AI visual analysis |
|
|
204
|
+
| 5 | Decompose — break step into smaller sub-actions |
|
|
205
|
+
| 6 | Manual — flag for human review |
|
|
206
|
+
|
|
207
|
+
Healed steps are saved as pending suggestions. Review with:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npx assuremind apply-healing
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Or in the Studio → **Self-Healing** page.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Device Emulation
|
|
218
|
+
|
|
219
|
+
Emulate real devices using Playwright's built-in device descriptors. Select in Studio UI or use `--device` CLI flag.
|
|
220
|
+
|
|
221
|
+
| Device | Category | Viewport | Browser |
|
|
222
|
+
|--------|----------|----------|---------|
|
|
223
|
+
| `iPhone 15 Pro` | Mobile | 393×852 | webkit / chromium |
|
|
224
|
+
| `iPhone 15` | Mobile | 390×844 | webkit / chromium |
|
|
225
|
+
| `iPhone 14` | Mobile | 390×844 | webkit / chromium |
|
|
226
|
+
| `iPhone SE` | Mobile | 375×667 | webkit / chromium |
|
|
227
|
+
| `Pixel 7` | Mobile | 412×915 | chromium |
|
|
228
|
+
| `Pixel 5` | Mobile | 393×851 | chromium |
|
|
229
|
+
| `Galaxy S9+` | Mobile | 320×658 | chromium |
|
|
230
|
+
| `Galaxy S8` | Mobile | 360×740 | chromium |
|
|
231
|
+
| `iPad Pro 11` | Tablet | 834×1194 | webkit / chromium |
|
|
232
|
+
| `iPad (gen 7)` | Tablet | 810×1080 | webkit / chromium |
|
|
233
|
+
| `iPad Mini` | Tablet | 768×1024 | webkit / chromium |
|
|
234
|
+
| `Galaxy Tab S4` | Tablet | 712×1138 | chromium |
|
|
235
|
+
|
|
236
|
+
> **Tip:** Always pair mobile/tablet devices with `--browser chromium` for full touch event support.
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
## CI/CD (GitHub Actions)
|
|
241
|
+
|
|
242
|
+
```yaml
|
|
243
|
+
# Standard run
|
|
244
|
+
- name: Run tests
|
|
245
|
+
env:
|
|
246
|
+
AI_PROVIDER: anthropic
|
|
247
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
248
|
+
run: |
|
|
249
|
+
npx playwright install --with-deps chromium
|
|
250
|
+
npx assuremind run --all --ci
|
|
251
|
+
|
|
252
|
+
# Mobile run
|
|
253
|
+
- name: Run mobile tests
|
|
254
|
+
env:
|
|
255
|
+
AI_PROVIDER: anthropic
|
|
256
|
+
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
|
|
257
|
+
run: |
|
|
258
|
+
npx playwright install --with-deps chromium
|
|
259
|
+
npx assuremind run --all --device "iPhone 15 Pro" --browser chromium --ci
|
|
260
|
+
|
|
261
|
+
- name: Apply healing (if tests failed)
|
|
262
|
+
if: failure()
|
|
263
|
+
run: npx assuremind apply-healing --yes
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
---
|
|
267
|
+
|
|
268
|
+
## Getting Help
|
|
269
|
+
|
|
270
|
+
| Resource | Location |
|
|
271
|
+
|----------|----------|
|
|
272
|
+
| Full getting-started guide | `docs/GETTING-STARTED.md` |
|
|
273
|
+
| CLI reference | `docs/CLI-REFERENCE.md` |
|
|
274
|
+
| Studio UI walkthrough | `docs/STUDIO.md` |
|
|
275
|
+
| All AI providers | `.env.example` |
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defineConfig } from 'assuremind';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
baseUrl: 'http://localhost:3000',
|
|
5
|
+
browsers: ['chromium', 'firefox'],
|
|
6
|
+
headless: true,
|
|
7
|
+
timeout: 30000,
|
|
8
|
+
retries: 1,
|
|
9
|
+
parallel: 2,
|
|
10
|
+
screenshot: 'on-failure', // 'on' | 'off' | 'on-failure'
|
|
11
|
+
video: 'off', // 'on' | 'off' | 'on-failure'
|
|
12
|
+
trace: 'on-failure', // 'on' | 'off' | 'on-failure'
|
|
13
|
+
healing: {
|
|
14
|
+
enabled: true,
|
|
15
|
+
maxLevel: 5,
|
|
16
|
+
dailyBudget: 5.0,
|
|
17
|
+
autoPR: false,
|
|
18
|
+
},
|
|
19
|
+
reporting: {
|
|
20
|
+
allure: true,
|
|
21
|
+
html: true,
|
|
22
|
+
json: true,
|
|
23
|
+
},
|
|
24
|
+
studioPort: 4400,
|
|
25
|
+
});
|
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
# Assuremind CLI Reference
|
|
2
|
+
|
|
3
|
+
Complete reference for all `assuremind` CLI commands.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Global Usage
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx assuremind <command> [options]
|
|
11
|
+
# or if installed globally:
|
|
12
|
+
assuremind <command> [options]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
assuremind --version # Print version
|
|
17
|
+
assuremind --help # List all commands
|
|
18
|
+
assuremind <cmd> --help # Help for a specific command
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
### `init`
|
|
26
|
+
|
|
27
|
+
Initialise Assuremind in the current directory.
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx assuremind init [options]
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**What it does:**
|
|
34
|
+
- Creates the directory structure (`tests/`, `variables/`, `results/`, `fixtures/`, `docs/`)
|
|
35
|
+
- Copies starter files (`.env`, `autotest.config.ts`, `TESTAUTOMIND.md`, docs)
|
|
36
|
+
- Writes `autotest.config.json` with defaults
|
|
37
|
+
- Installs Playwright browsers (Chromium, Firefox, WebKit)
|
|
38
|
+
|
|
39
|
+
**Requirements:** A `package.json` must exist in the current directory.
|
|
40
|
+
|
|
41
|
+
**Options:**
|
|
42
|
+
|
|
43
|
+
| Flag | Description |
|
|
44
|
+
|------|-------------|
|
|
45
|
+
| `--skip-playwright` | Skip Playwright browser installation (useful in CI where browsers are pre-installed) |
|
|
46
|
+
|
|
47
|
+
**Examples:**
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Standard init
|
|
51
|
+
npx assuremind init
|
|
52
|
+
|
|
53
|
+
# Skip browser download (CI)
|
|
54
|
+
npx assuremind init --skip-playwright
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
### `studio`
|
|
60
|
+
|
|
61
|
+
Launch the Assuremind web UI (Studio).
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npx assuremind studio [options]
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
**What it does:**
|
|
68
|
+
- Starts the Fastify API server
|
|
69
|
+
- Serves the React Studio UI
|
|
70
|
+
- Opens the browser at `http://localhost:<port>`
|
|
71
|
+
|
|
72
|
+
**Options:**
|
|
73
|
+
|
|
74
|
+
| Flag | Description | Default |
|
|
75
|
+
|------|-------------|---------|
|
|
76
|
+
| `-p, --port <number>` | Override the studio port | `4400` (from config) |
|
|
77
|
+
| `--no-open` | Do not auto-open the browser | Auto-opens by default |
|
|
78
|
+
|
|
79
|
+
**Examples:**
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Start studio on default port
|
|
83
|
+
npx assuremind studio
|
|
84
|
+
|
|
85
|
+
# Use a custom port
|
|
86
|
+
npx assuremind studio --port 5000
|
|
87
|
+
|
|
88
|
+
# Start without opening browser
|
|
89
|
+
npx assuremind studio --no-open
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### `run`
|
|
95
|
+
|
|
96
|
+
Run tests from the command line (no Studio required).
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npx assuremind run [options]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**Scope options (pick one or combine):**
|
|
103
|
+
|
|
104
|
+
| Flag | Description |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| `--all` | Run all test suites |
|
|
107
|
+
| `--suite <name>` | Run a specific suite by name |
|
|
108
|
+
| `--tag <tag>` | Run all tests matching a tag |
|
|
109
|
+
| `--test <name>` | Run a specific test case by name |
|
|
110
|
+
|
|
111
|
+
**Browser options:**
|
|
112
|
+
|
|
113
|
+
| Flag | Description | Default |
|
|
114
|
+
|------|-------------|---------|
|
|
115
|
+
| `--browser <list...>` | Space-separated list of browsers | From config |
|
|
116
|
+
| `--headed` | Run in headed (visible) mode | Headless |
|
|
117
|
+
|
|
118
|
+
**Execution options:**
|
|
119
|
+
|
|
120
|
+
| Flag | Description | Default |
|
|
121
|
+
|------|-------------|---------|
|
|
122
|
+
| `--parallel <n>` | Number of parallel workers | From config |
|
|
123
|
+
| `--env <name>` | Environment to use (`dev`, `staging`, `prod`) | None |
|
|
124
|
+
| `--ci` | CI mode — no prompts, exit code = pass/fail | Off |
|
|
125
|
+
| `--no-healing` | Disable self-healing for this run | Healing enabled |
|
|
126
|
+
|
|
127
|
+
**Reporting options:**
|
|
128
|
+
|
|
129
|
+
| Flag | Description |
|
|
130
|
+
|------|-------------|
|
|
131
|
+
| `--reporter <list...>` | Space-separated reporters: `allure`, `html`, `json` |
|
|
132
|
+
|
|
133
|
+
**Examples:**
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
# Run everything
|
|
137
|
+
npx assuremind run --all
|
|
138
|
+
|
|
139
|
+
# Run a specific suite
|
|
140
|
+
npx assuremind run --suite "Login Tests"
|
|
141
|
+
|
|
142
|
+
# Run by tag
|
|
143
|
+
npx assuremind run --tag smoke
|
|
144
|
+
|
|
145
|
+
# Run a single test case
|
|
146
|
+
npx assuremind run --test "User can log in with valid credentials"
|
|
147
|
+
|
|
148
|
+
# Run with visible browser on Firefox
|
|
149
|
+
npx assuremind run --all --headed --browser firefox
|
|
150
|
+
|
|
151
|
+
# Run against staging environment
|
|
152
|
+
npx assuremind run --all --env staging
|
|
153
|
+
|
|
154
|
+
# CI pipeline (exit 0 = all pass, exit 1 = any fail)
|
|
155
|
+
npx assuremind run --all --ci
|
|
156
|
+
|
|
157
|
+
# Run without healing (saves AI costs)
|
|
158
|
+
npx assuremind run --all --no-healing
|
|
159
|
+
|
|
160
|
+
# Run with specific reporters
|
|
161
|
+
npx assuremind run --all --reporter allure html
|
|
162
|
+
|
|
163
|
+
# Parallel run with 3 workers
|
|
164
|
+
npx assuremind run --all --parallel 3
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Exit codes (CI mode):**
|
|
168
|
+
|
|
169
|
+
| Code | Meaning |
|
|
170
|
+
|------|---------|
|
|
171
|
+
| 0 | All tests passed |
|
|
172
|
+
| 1 | One or more tests failed |
|
|
173
|
+
| 2 | Configuration or setup error |
|
|
174
|
+
|
|
175
|
+
---
|
|
176
|
+
|
|
177
|
+
### `generate`
|
|
178
|
+
|
|
179
|
+
Generate test cases from a user story using AI.
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
npx assuremind generate [options]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**What it does:**
|
|
186
|
+
- Reads a plain-English user story (from argument or file)
|
|
187
|
+
- Uses AI to generate a complete test suite with test cases and steps
|
|
188
|
+
- Saves the generated suite to the `tests/` directory
|
|
189
|
+
|
|
190
|
+
**Options:**
|
|
191
|
+
|
|
192
|
+
| Flag | Description |
|
|
193
|
+
|------|-------------|
|
|
194
|
+
| `--story <text>` | User story text inline |
|
|
195
|
+
| `--story-file <path>` | Path to a `.txt` or `.md` file containing the story |
|
|
196
|
+
| `--suite <name>` | Name for the generated suite |
|
|
197
|
+
| `--output <path>` | Output directory (default: `tests/`) |
|
|
198
|
+
|
|
199
|
+
**Examples:**
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
# Inline user story
|
|
203
|
+
npx assuremind generate \
|
|
204
|
+
--story "As a user I want to log in with my email and password so that I can access my dashboard" \
|
|
205
|
+
--suite "Login Flow"
|
|
206
|
+
|
|
207
|
+
# From a file
|
|
208
|
+
npx assuremind generate \
|
|
209
|
+
--story-file docs/user-stories/checkout.md \
|
|
210
|
+
--suite "Checkout Flow"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
**After generating:**
|
|
214
|
+
Open the Studio, find the new suite, review the generated steps, then run **"Generate All"** to create Playwright code for each step.
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
### `validate`
|
|
219
|
+
|
|
220
|
+
Validate configuration, environment variables, and test files.
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
npx assuremind validate
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
**Checks performed:**
|
|
227
|
+
- `autotest.config.json` — valid JSON, required fields present, values in range
|
|
228
|
+
- `.env` — AI provider key is set
|
|
229
|
+
- `variables/global.json` — valid JSON, no syntax errors
|
|
230
|
+
- `tests/` directory — all suite and case JSON files parse correctly
|
|
231
|
+
- `baseUrl` — reachable (HTTP check, non-blocking)
|
|
232
|
+
|
|
233
|
+
**Output example:**
|
|
234
|
+
```
|
|
235
|
+
✅ autotest.config.json — valid
|
|
236
|
+
✅ .env — AI_PROVIDER=anthropic, key present
|
|
237
|
+
✅ variables/global.json — 4 variables defined
|
|
238
|
+
✅ tests/ — 3 suites, 12 cases, 47 steps — all valid
|
|
239
|
+
⚠️ baseUrl http://localhost:3000 — not reachable (start your app first)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
### `doctor`
|
|
245
|
+
|
|
246
|
+
Check system requirements and overall setup health.
|
|
247
|
+
|
|
248
|
+
```bash
|
|
249
|
+
npx assuremind doctor
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
**Checks performed:**
|
|
253
|
+
|
|
254
|
+
| Check | What it verifies |
|
|
255
|
+
|-------|-----------------|
|
|
256
|
+
| Node.js version | ≥ 18 |
|
|
257
|
+
| npm version | ≥ 8 |
|
|
258
|
+
| Playwright installed | `@playwright/test` or `playwright` package present |
|
|
259
|
+
| Browser binaries | Chromium, Firefox, WebKit installed |
|
|
260
|
+
| AI provider | Key set and API reachable |
|
|
261
|
+
| Config file | `autotest.config.json` exists and is valid |
|
|
262
|
+
| Results directory | Writable |
|
|
263
|
+
| Disk space | Warn if < 500 MB free |
|
|
264
|
+
|
|
265
|
+
**Output example:**
|
|
266
|
+
```
|
|
267
|
+
✅ Node.js v20.11.0 — ok
|
|
268
|
+
✅ npm 10.4.0 — ok
|
|
269
|
+
✅ Playwright 1.48.0 — installed
|
|
270
|
+
✅ Chromium — browser binary found
|
|
271
|
+
✅ Firefox — browser binary found
|
|
272
|
+
✅ WebKit — browser binary found
|
|
273
|
+
✅ AI provider: anthropic — API reachable
|
|
274
|
+
✅ autotest.config.json — valid
|
|
275
|
+
✅ results/ — writable
|
|
276
|
+
⚠️ Disk space: 1.2 GB free — consider cleaning results/
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
### `apply-healing`
|
|
282
|
+
|
|
283
|
+
Review and apply self-healing suggestions to test files.
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
npx assuremind apply-healing [options]
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
**What it does:**
|
|
290
|
+
- Lists all pending healing suggestions
|
|
291
|
+
- Shows the before/after code diff for each
|
|
292
|
+
- Prompts you to accept or reject each suggestion
|
|
293
|
+
- Accepted suggestions are written back to the test `.json` files
|
|
294
|
+
|
|
295
|
+
**Options:**
|
|
296
|
+
|
|
297
|
+
| Flag | Description |
|
|
298
|
+
|------|-------------|
|
|
299
|
+
| `--from <path>` | Load healing suggestions from a specific JSON file instead of `results/healing/` |
|
|
300
|
+
| `-y, --yes` | Accept all pending suggestions without prompting (CI-friendly) |
|
|
301
|
+
|
|
302
|
+
**Examples:**
|
|
303
|
+
|
|
304
|
+
```bash
|
|
305
|
+
# Interactive review
|
|
306
|
+
npx assuremind apply-healing
|
|
307
|
+
|
|
308
|
+
# Accept all suggestions silently (CI)
|
|
309
|
+
npx assuremind apply-healing --yes
|
|
310
|
+
|
|
311
|
+
# Apply from a specific healing report
|
|
312
|
+
npx assuremind apply-healing --from results/healing/2026-03-25.json
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**Interactive prompt example:**
|
|
316
|
+
```
|
|
317
|
+
Pending healing suggestions: 2
|
|
318
|
+
|
|
319
|
+
─── Suggestion 1/2 ───────────────────────────────────────
|
|
320
|
+
Case: login-tests/user-can-log-in
|
|
321
|
+
Step: Click the Login button
|
|
322
|
+
Level: 2 (AI Regeneration)
|
|
323
|
+
|
|
324
|
+
Before:
|
|
325
|
+
await page.getByText('Login').click();
|
|
326
|
+
|
|
327
|
+
After:
|
|
328
|
+
await page.getByRole('button', { name: 'Login' }).click();
|
|
329
|
+
|
|
330
|
+
Accept this change? [Y/n] Y
|
|
331
|
+
✅ Applied
|
|
332
|
+
|
|
333
|
+
─── Suggestion 2/2 ───────────────────────────────────────
|
|
334
|
+
...
|
|
335
|
+
```
|
|
336
|
+
|
|
337
|
+
---
|
|
338
|
+
|
|
339
|
+
## Environment Variables
|
|
340
|
+
|
|
341
|
+
These environment variables can override CLI flags or config file values:
|
|
342
|
+
|
|
343
|
+
| Variable | Description |
|
|
344
|
+
|----------|-------------|
|
|
345
|
+
| `AI_PROVIDER` | AI provider to use |
|
|
346
|
+
| `ANTHROPIC_API_KEY` | Anthropic API key |
|
|
347
|
+
| `OPENAI_API_KEY` | OpenAI API key |
|
|
348
|
+
| `GOOGLE_API_KEY` | Google Gemini API key |
|
|
349
|
+
| `GROQ_API_KEY` | Groq API key |
|
|
350
|
+
| `OLLAMA_BASE_URL` | Ollama server URL |
|
|
351
|
+
| `OLLAMA_MODEL` | Ollama model name |
|
|
352
|
+
| `AI_TIMEOUT` | AI request timeout in seconds |
|
|
353
|
+
| `AI_MAX_RETRIES` | Max AI request retries |
|
|
354
|
+
| `STUDIO_PORT` | Override studio port |
|
|
355
|
+
| `HEALING_ENABLED` | `false` to disable healing globally |
|
|
356
|
+
|
|
357
|
+
---
|
|
358
|
+
|
|
359
|
+
## Configuration File
|
|
360
|
+
|
|
361
|
+
`autotest.config.json` (auto-generated, also editable via Settings UI):
|
|
362
|
+
|
|
363
|
+
```json
|
|
364
|
+
{
|
|
365
|
+
"baseUrl": "http://localhost:3000",
|
|
366
|
+
"browsers": ["chromium"],
|
|
367
|
+
"headless": true,
|
|
368
|
+
"viewport": { "width": 1280, "height": 720 },
|
|
369
|
+
"timeout": 30000,
|
|
370
|
+
"retries": 1,
|
|
371
|
+
"parallel": 1,
|
|
372
|
+
"pageLoad": "domcontentloaded",
|
|
373
|
+
"screenshot": "only-on-failure",
|
|
374
|
+
"video": "off",
|
|
375
|
+
"trace": "on-first-retry",
|
|
376
|
+
"healing": {
|
|
377
|
+
"enabled": true,
|
|
378
|
+
"maxLevel": 5,
|
|
379
|
+
"dailyBudget": 5.0,
|
|
380
|
+
"autoPR": false
|
|
381
|
+
},
|
|
382
|
+
"reporting": {
|
|
383
|
+
"allure": true,
|
|
384
|
+
"html": true,
|
|
385
|
+
"json": true
|
|
386
|
+
},
|
|
387
|
+
"studioPort": 4400
|
|
388
|
+
}
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
**Field reference:**
|
|
392
|
+
|
|
393
|
+
| Field | Type | Options | Description |
|
|
394
|
+
|-------|------|---------|-------------|
|
|
395
|
+
| `baseUrl` | string | Any URL | Root URL of your app |
|
|
396
|
+
| `browsers` | array | `chromium` `firefox` `webkit` | Browsers to run tests on |
|
|
397
|
+
| `headless` | boolean | `true` `false` | Headless or headed mode |
|
|
398
|
+
| `viewport` | object | `{ width, height }` | Browser window size |
|
|
399
|
+
| `timeout` | number | ms | Step timeout |
|
|
400
|
+
| `retries` | number | 0–10 | Retry count on failure |
|
|
401
|
+
| `parallel` | number | 1–16 | Parallel workers |
|
|
402
|
+
| `pageLoad` | string | `commit` `domcontentloaded` `load` `networkidle` | Page load wait strategy |
|
|
403
|
+
| `screenshot` | string | `off` `on` `only-on-failure` | Screenshot capture |
|
|
404
|
+
| `video` | string | `off` `on` `on-first-retry` `retain-on-failure` | Video recording |
|
|
405
|
+
| `trace` | string | `off` `on` `on-first-retry` `retain-on-failure` | Playwright trace |
|
|
406
|
+
| `healing.enabled` | boolean | | Enable self-healing |
|
|
407
|
+
| `healing.maxLevel` | number | 1–6 | Max healing strategy level |
|
|
408
|
+
| `healing.dailyBudget` | number | USD | Max daily AI spend on healing |
|
|
409
|
+
| `healing.autoPR` | boolean | | Auto-create PRs for accepted heals |
|
|
410
|
+
| `reporting.allure` | boolean | | Generate Allure report |
|
|
411
|
+
| `reporting.html` | boolean | | Generate HTML report |
|
|
412
|
+
| `reporting.json` | boolean | | Save JSON results |
|
|
413
|
+
| `studioPort` | number | 1024–65535 | Studio server port |
|