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.
@@ -0,0 +1,378 @@
1
+ # Getting Started with Assuremind
2
+
3
+ This guide walks you from a blank folder to running your first AI-generated UI test in under 10 minutes.
4
+
5
+ ---
6
+
7
+ ## 1. Prerequisites
8
+
9
+ - **Node.js 18 or later** — [download](https://nodejs.org)
10
+ - **An AI provider API key** — Anthropic, OpenAI, Google, Groq, or any other supported provider (see [Step 4](#4-configure-your-ai-provider))
11
+ - A web application to test (any URL works — you can use your localhost dev server)
12
+
13
+ ---
14
+
15
+ ## 2. Create a New Project
16
+
17
+ Assuremind does not need its own project — it works inside any existing Node.js project or a brand-new folder.
18
+
19
+ ```bash
20
+ mkdir my-tests
21
+ cd my-tests
22
+ npm init -y
23
+ ```
24
+
25
+ ---
26
+
27
+ ## 3. Install Assuremind
28
+
29
+ ```bash
30
+ npm install git+https://github.com/<org>/assuremind.git
31
+ ```
32
+
33
+ ---
34
+
35
+ ## 4. Initialise the Project
36
+
37
+ ```bash
38
+ npx assuremind init
39
+ ```
40
+
41
+ This command:
42
+
43
+ - Creates the folder structure (`tests/`, `variables/`, `results/`, `fixtures/`)
44
+ - Copies **`.env.example`** — full reference of all supported environment variables
45
+ - Creates **`.env`** — minimal template for you to fill in
46
+ - Creates **`autotest.config.ts`** — framework configuration
47
+ - Creates **`TESTAUTOMIND.md`** — quick-reference card for daily use
48
+ - Installs Playwright browsers (`chromium`, `firefox`, `webkit`)
49
+
50
+ If you want to skip the Playwright browser download (e.g., in CI where you install them separately):
51
+
52
+ ```bash
53
+ npx assuremind init --skip-playwright
54
+ ```
55
+
56
+ ---
57
+
58
+ ## 5. Configure Your AI Provider
59
+
60
+ Open `.env` and fill in your chosen provider. You only need **one**:
61
+
62
+ ### Anthropic (Claude) — recommended for best results
63
+
64
+ ```bash
65
+ AI_PROVIDER=anthropic
66
+ ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxx
67
+ # ANTHROPIC_MODEL=claude-sonnet-4-6 # optional, defaults to latest Sonnet
68
+ ```
69
+
70
+ ### OpenAI (GPT)
71
+
72
+ ```bash
73
+ AI_PROVIDER=openai
74
+ OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
75
+ # OPENAI_MODEL=gpt-4o # optional
76
+ ```
77
+
78
+ ### Google (Gemini)
79
+
80
+ ```bash
81
+ AI_PROVIDER=google
82
+ GOOGLE_API_KEY=AIzaxxxxxxxxxxxxxxxx
83
+ # GOOGLE_MODEL=gemini-2.5-flash # optional
84
+ ```
85
+
86
+ ### Groq (fast, free tier available)
87
+
88
+ ```bash
89
+ AI_PROVIDER=groq
90
+ GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxx
91
+ # GROQ_MODEL=llama-3.3-70b-versatile # optional
92
+ ```
93
+
94
+ ### Ollama (local, completely free)
95
+
96
+ ```bash
97
+ AI_PROVIDER=ollama
98
+ OLLAMA_BASE_URL=http://localhost:11434
99
+ OLLAMA_MODEL=llama3.3
100
+ ```
101
+
102
+ See `.env.example` for all 12 supported providers including DeepSeek, Together AI, Perplexity, Qwen, AWS Bedrock, and Azure OpenAI.
103
+
104
+ ---
105
+
106
+ ## 6. Configure Your Application URL
107
+
108
+ Open `autotest.config.ts` and set `baseUrl` to your application:
109
+
110
+ ```typescript
111
+ import { defineConfig } from 'assuremind';
112
+
113
+ export default defineConfig({
114
+ baseUrl: 'http://localhost:3000', // ← change this
115
+ browsers: ['chromium'],
116
+ headless: true,
117
+ timeout: 30000,
118
+ retries: 1,
119
+ parallel: 2,
120
+ healing: {
121
+ enabled: true,
122
+ maxLevel: 5,
123
+ dailyBudget: 5.0,
124
+ },
125
+ });
126
+ ```
127
+
128
+ ---
129
+
130
+ ## 7. Write Your First Test
131
+
132
+ ### Option A — Studio UI (recommended for beginners)
133
+
134
+ Start the Studio:
135
+
136
+ ```bash
137
+ npx assuremind studio
138
+ ```
139
+
140
+ Your browser opens at `http://localhost:4400`. From there:
141
+
142
+ 1. Click **Test Editor** in the sidebar
143
+ 2. Click **New Suite** → name it `Login Tests`, select suite type **UI**, **API**, or **Audit**
144
+ 3. Click **New Case** → name it `User can log in`
145
+ 4. Add steps in plain English, one per line:
146
+ - `Go to the login page`
147
+ - `Enter "admin@example.com" in the email field`
148
+ - `Enter "password123" in the password field`
149
+ - `Click the Login button`
150
+ - `Verify the dashboard heading is visible`
151
+ 5. Click **Generate Code** — AI generates Playwright code for each step
152
+ 6. Click **Run** to execute the test
153
+
154
+ See [STUDIO.md](./STUDIO.md) for a full Studio walkthrough.
155
+
156
+ ### Option B — CLI generate command
157
+
158
+ Generate a full test suite from a user story in one command:
159
+
160
+ ```bash
161
+ npx assuremind generate \
162
+ --story "As a user I want to log in with my email and password so I can access my dashboard." \
163
+ --suite "Login Tests"
164
+ ```
165
+
166
+ This creates the suite file structure under `tests/login-tests/` and generates Playwright code for every step.
167
+
168
+ ### Option C — Write JSON directly
169
+
170
+ Create `tests/login-tests/suite.json`:
171
+
172
+ ```json
173
+ {
174
+ "id": "suite-001",
175
+ "name": "Login Tests",
176
+ "description": "Tests for the authentication flow",
177
+ "tags": ["smoke", "auth"],
178
+ "createdAt": "2026-01-01T00:00:00.000Z",
179
+ "updatedAt": "2026-01-01T00:00:00.000Z"
180
+ }
181
+ ```
182
+
183
+ Create `tests/login-tests/user-can-log-in.test.json`:
184
+
185
+ ```json
186
+ {
187
+ "id": "case-001",
188
+ "name": "User can log in",
189
+ "description": "",
190
+ "tags": ["smoke"],
191
+ "priority": "critical",
192
+ "steps": [
193
+ { "id": "step-1", "order": 1, "instruction": "Go to the login page", "generatedCode": "", "strategy": "primary", "lastHealed": null },
194
+ { "id": "step-2", "order": 2, "instruction": "Click the Login button", "generatedCode": "", "strategy": "primary", "lastHealed": null }
195
+ ],
196
+ "createdAt": "2026-01-01T00:00:00.000Z",
197
+ "updatedAt": "2026-01-01T00:00:00.000Z"
198
+ }
199
+ ```
200
+
201
+ Steps with empty `generatedCode` will have code generated on the first run.
202
+
203
+ ---
204
+
205
+ ## 8. Run Tests
206
+
207
+ The `run` command supports flexible filters that can be combined with AND logic.
208
+
209
+ ### Run everything
210
+
211
+ ```bash
212
+ npx assuremind run --all
213
+ ```
214
+
215
+ ### Run by suite type
216
+
217
+ ```bash
218
+ # Run only UI suites
219
+ npx assuremind run --type ui
220
+
221
+ # Run only API suites
222
+ npx assuremind run --type api
223
+
224
+ # Run only Audit suites
225
+ npx assuremind run --type audit
226
+ ```
227
+
228
+ ### Run a specific suite (partial name match)
229
+
230
+ ```bash
231
+ npx assuremind run --suite "Login Tests"
232
+ ```
233
+
234
+ ### Run tests matching a tag
235
+
236
+ ```bash
237
+ npx assuremind run --tag smoke
238
+ ```
239
+
240
+ ### Run a single test by name (partial match)
241
+
242
+ ```bash
243
+ npx assuremind run --test "User can log in"
244
+ ```
245
+
246
+ ### Combine filters (AND logic)
247
+
248
+ ```bash
249
+ # Audit suites with the regression tag
250
+ npx assuremind run --type audit --tag regression
251
+
252
+ # A named suite filtered to smoke tests
253
+ npx assuremind run --suite "Orange HRM" --tag smoke
254
+
255
+ # Audit suites containing a specific test name
256
+ npx assuremind run --type audit --test "Login Page"
257
+ ```
258
+
259
+ ### Run in headed mode (watch the browser)
260
+
261
+ ```bash
262
+ npx assuremind run --all --headed
263
+ ```
264
+
265
+ ### Run with device emulation (mobile/tablet)
266
+
267
+ ```bash
268
+ # Emulate iPhone 15 Pro (use Chromium for best results)
269
+ npx assuremind run --all --device "iPhone 15 Pro" --browser chromium
270
+
271
+ # Emulate Pixel 7 on a specific suite
272
+ npx assuremind run --suite "Mobile Checkout" --device "Pixel 7" --browser chromium
273
+
274
+ # Emulate iPad Pro with WebKit
275
+ npx assuremind run --all --device "iPad Pro 11" --browser webkit
276
+ ```
277
+
278
+ Device emulation applies the full Playwright device descriptor — viewport, user-agent, device pixel ratio, touch events, and `isMobile` flag. See the [CLI Reference](./CLI-REFERENCE.md) for the full device list.
279
+
280
+ ### Run in CI mode (exit code 0 = pass, 1 = fail)
281
+
282
+ ```bash
283
+ npx assuremind run --all --ci
284
+
285
+ # CI with device emulation
286
+ npx assuremind run --all --device "iPhone 15 Pro" --browser chromium --ci
287
+ ```
288
+
289
+ ---
290
+
291
+ ## 9. Review Results
292
+
293
+ After a run:
294
+
295
+ ```
296
+ ─────────────────────────────────
297
+ ✅ All tests passed!
298
+
299
+ 5 passed 0 failed 0 skipped
300
+ Duration: 12.4s
301
+ Run ID: 2026-03-23T14-30-00
302
+ ─────────────────────────────────
303
+ ```
304
+
305
+ Results are saved to `results/runs/<runId>.json`. Reports are written to `results/reports/`.
306
+
307
+ View historical results in the Studio:
308
+
309
+ ```bash
310
+ npx assuremind studio
311
+ # Navigate to Reports in the sidebar
312
+ ```
313
+
314
+ ---
315
+
316
+ ## 10. Review Self-Healing Suggestions
317
+
318
+ When a test step fails and the AI generates a healed version, the suggestion is saved to `results/healing/pending.json`. Review and apply:
319
+
320
+ ```bash
321
+ npx assuremind apply-healing
322
+ ```
323
+
324
+ You will be prompted for each suggestion:
325
+
326
+ ```
327
+ Healing suggestion for: "Click the Login button"
328
+ Suite: Login Tests
329
+ Case: User can log in
330
+ Step: step-2
331
+
332
+ Original code: await page.click('#login-btn');
333
+ Healed code: await page.click('button[type="submit"]');
334
+
335
+ Accept? [y/n/a/q] (y=yes, n=no, a=accept all, q=quit):
336
+ ```
337
+
338
+ Or accept all suggestions without prompting:
339
+
340
+ ```bash
341
+ npx assuremind apply-healing --yes
342
+ ```
343
+
344
+ ---
345
+
346
+ ## 11. Use Test Variables
347
+
348
+ Variables let you avoid hardcoding credentials and URLs. Define them in `variables/global.json`:
349
+
350
+ ```json
351
+ {
352
+ "BASE_URL": "http://localhost:3000",
353
+ "ADMIN_EMAIL": "admin@example.com",
354
+ "ADMIN_PASSWORD": { "value": "supersecret", "secret": true }
355
+ }
356
+ ```
357
+
358
+ Reference them in step instructions using double-braces:
359
+
360
+ ```
361
+ Enter "{{ADMIN_EMAIL}}" in the email field
362
+ Enter "{{ADMIN_PASSWORD}}" in the password field
363
+ ```
364
+
365
+ Or manage variables in the Studio → **Variables** page.
366
+
367
+ ---
368
+
369
+ ## 12. Next Steps
370
+
371
+ | Topic | Where to look |
372
+ |-------|---------------|
373
+ | All CLI flags | [CLI Reference](./CLI-REFERENCE.md) |
374
+ | Studio UI walkthrough | [Studio Guide](./STUDIO.md) |
375
+ | Build the package from source | [CONTRIBUTING.md](../CONTRIBUTING.md) |
376
+ | Config options | `autotest.config.ts` comments |
377
+ | All supported AI providers | `.env.example` |
378
+ | Quick daily reference | `TESTAUTOMIND.md` in your project root |