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,417 @@
1
+ # Getting Started with Assuremind
2
+
3
+ > AI-powered UI test automation — write steps in plain English, AI generates Playwright code, tests run forever.
4
+
5
+ ---
6
+
7
+ ## Table of Contents
8
+
9
+ 1. [Prerequisites](#1-prerequisites)
10
+ 2. [Installation](#2-installation)
11
+ 3. [Project Initialisation](#3-project-initialisation)
12
+ 4. [Configure AI Provider](#4-configure-ai-provider)
13
+ 5. [Configure Your App URL](#5-configure-your-app-url)
14
+ 6. [Start the Studio](#6-start-the-studio)
15
+ 7. [Create Your First Test Suite](#7-create-your-first-test-suite)
16
+ 8. [Write Test Steps](#8-write-test-steps)
17
+ 9. [Generate Code with AI](#9-generate-code-with-ai)
18
+ 10. [Run the Test](#10-run-the-test)
19
+ 11. [View Results & Reports](#11-view-results--reports)
20
+ 12. [Use Variables (Credentials & Dynamic Data)](#12-use-variables-credentials--dynamic-data)
21
+ 13. [Self-Healing](#13-self-healing)
22
+ 14. [CI/CD Integration](#14-cicd-integration)
23
+ 15. [Next Steps](#15-next-steps)
24
+
25
+ ---
26
+
27
+ ## 1. Prerequisites
28
+
29
+ | Requirement | Version |
30
+ |-------------|---------|
31
+ | Node.js | ≥ 18 |
32
+ | npm | ≥ 8 |
33
+ | Git | Any |
34
+
35
+ An API key for at least one supported AI provider (OpenAI, Anthropic, Google, Groq, Ollama, etc.)
36
+
37
+ ---
38
+
39
+ ## 2. Installation
40
+
41
+ Install Assuremind from the private GitHub repository:
42
+
43
+ ```bash
44
+ npm install git+https://github.com/<org>/assuremind.git
45
+ ```
46
+
47
+ Then use the CLI:
48
+
49
+ ```bash
50
+ npx assuremind init
51
+ ```
52
+
53
+ ---
54
+
55
+ ## 3. Project Initialisation
56
+
57
+ Navigate to your project directory (must have a `package.json`) and run:
58
+
59
+ ```bash
60
+ cd my-project
61
+ npx assuremind init
62
+ ```
63
+
64
+ This will:
65
+ - Create the folder structure (`tests/`, `variables/`, `results/`, `fixtures/`)
66
+ - Copy starter config files (`.env`, `autotest.config.ts`)
67
+ - Copy this documentation to `docs/`
68
+ - Install Playwright browsers (Chromium, Firefox, WebKit)
69
+
70
+ **Folder structure created:**
71
+
72
+ ```
73
+ my-project/
74
+ ├── .env ← AI credentials (never commit)
75
+ ├── .env.example ← Provider reference
76
+ ├── autotest.config.ts ← Framework configuration
77
+ ├── autotest.config.json ← Runtime config (auto-synced)
78
+ ├── TESTAUTOMIND.md ← Quick-reference cheat sheet
79
+ ├── docs/
80
+ │ ├── GETTING-STARTED.md ← This file
81
+ │ ├── STUDIO.md ← Full UI walkthrough
82
+ │ └── CLI-REFERENCE.md ← All CLI commands
83
+ ├── tests/ ← Test suites (auto-managed by Studio)
84
+ ├── variables/
85
+ │ ├── global.json ← Variables for all environments
86
+ │ ├── dev.env.json
87
+ │ ├── staging.env.json
88
+ │ └── prod.env.json
89
+ ├── fixtures/
90
+ │ ├── auth/ ← Auth state files
91
+ │ └── data/ ← Test data files
92
+ └── results/
93
+ ├── screenshots/
94
+ ├── videos/
95
+ ├── traces/
96
+ ├── reports/
97
+ └── healing/
98
+ ```
99
+
100
+ ---
101
+
102
+ ## 4. Configure AI Provider
103
+
104
+ Open `.env` in your project root and set your AI provider:
105
+
106
+ ```bash
107
+ # Recommended: Anthropic Claude
108
+ AI_PROVIDER=anthropic
109
+ ANTHROPIC_API_KEY=sk-ant-xxxxxxxxxxxxxxxx
110
+
111
+ # Or: OpenAI GPT-4o
112
+ AI_PROVIDER=openai
113
+ OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxx
114
+
115
+ # Or: Google Gemini
116
+ AI_PROVIDER=google
117
+ GOOGLE_API_KEY=AIzaxxxxxxxxxxxxxxxx
118
+
119
+ # Or: Groq (fast + free tier)
120
+ AI_PROVIDER=groq
121
+ GROQ_API_KEY=gsk_xxxxxxxxxxxxxxxx
122
+
123
+ # Or: Ollama (local, completely free)
124
+ AI_PROVIDER=ollama
125
+ OLLAMA_BASE_URL=http://localhost:11434
126
+ OLLAMA_MODEL=llama3.3
127
+ ```
128
+
129
+ See `.env.example` for all 12 supported providers including Azure OpenAI, Bedrock, DeepSeek, Together AI, Qwen, and Perplexity.
130
+
131
+ ---
132
+
133
+ ## 5. Configure Your App URL
134
+
135
+ Open `autotest.config.ts` and set `baseUrl` to your application's URL:
136
+
137
+ ```typescript
138
+ export default defineConfig({
139
+ baseUrl: 'http://localhost:3000', // ← change this to your app
140
+ browsers: ['chromium'],
141
+ headless: true,
142
+ timeout: 30000,
143
+ retries: 1,
144
+ parallel: 1,
145
+ screenshot: 'only-on-failure',
146
+ video: 'off',
147
+ trace: 'on-first-retry',
148
+ healing: {
149
+ enabled: true,
150
+ maxLevel: 5,
151
+ dailyBudget: 5.0,
152
+ autoPR: false,
153
+ },
154
+ studioPort: 4400,
155
+ });
156
+ ```
157
+
158
+ ---
159
+
160
+ ## 6. Start the Studio
161
+
162
+ ```bash
163
+ npx assuremind studio
164
+ ```
165
+
166
+ The Studio opens automatically at **http://localhost:4400**
167
+
168
+ Options:
169
+ ```bash
170
+ npx assuremind studio --port 5000 # Custom port
171
+ npx assuremind studio --no-open # Don't auto-open browser
172
+ ```
173
+
174
+ ---
175
+
176
+ ## 7. Create Your First Test Suite
177
+
178
+ 1. In the Studio, click **"New Suite"** in the sidebar
179
+ 2. Enter a name e.g. `Login Tests`
180
+ 3. Optionally add a description and tags (e.g. `smoke`, `auth`)
181
+ 4. Click **Create**
182
+
183
+ A suite is a collection of related test cases. For example:
184
+ - `Login Tests` — login, logout, password reset
185
+ - `Checkout Flow` — add to cart, checkout, payment
186
+ - `User Profile` — update name, change password, upload avatar
187
+
188
+ ---
189
+
190
+ ## 8. Write Test Steps
191
+
192
+ 1. Click your suite → click **"New Case"**
193
+ 2. Enter a test case name e.g. `User can log in with valid credentials`
194
+ 3. Click into the case to open the **Case Editor**
195
+ 4. Click **"Add Step"** and write plain-English instructions:
196
+
197
+ | Step | Instruction |
198
+ |------|-------------|
199
+ | 1 | `Go to the login page` |
200
+ | 2 | `Enter "admin@example.com" in the email field` |
201
+ | 3 | `Enter "password123" in the password field` |
202
+ | 4 | `Click the Login button` |
203
+ | 5 | `Verify the dashboard heading is visible` |
204
+ | 6 | `Verify the URL contains "/dashboard"` |
205
+
206
+ **Step writing tips:**
207
+ - Be specific: `Click the Submit button` not `Click something`
208
+ - Use quotes for literal values: `Enter "hello@example.com" in the email field`
209
+ - Use `{{VARIABLE}}` for dynamic values: `Enter "{{USERNAME}}" in the email field`
210
+ - Assertions start with: `Verify`, `Assert`, `Check`, `Confirm`
211
+ - Navigation: `Go to`, `Navigate to`, `Open`
212
+
213
+ ---
214
+
215
+ ## 9. Generate Code with AI
216
+
217
+ Once steps are written, click **"Generate All"** in the Case Editor toolbar.
218
+
219
+ The AI reads each plain-English step and generates Playwright TypeScript code, for example:
220
+
221
+ ```typescript
222
+ // Step: Go to the login page
223
+ await page.goto('/login');
224
+
225
+ // Step: Enter "admin@example.com" in the email field
226
+ await page.getByLabel('Email').fill('admin@example.com');
227
+
228
+ // Step: Click the Login button
229
+ await page.getByRole('button', { name: 'Login' }).click();
230
+
231
+ // Step: Verify the dashboard heading is visible
232
+ await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible();
233
+ ```
234
+
235
+ You can also:
236
+ - Generate code for a **single step** by clicking the ⚡ icon on that step row
237
+ - **Edit the generated code** manually in the code panel
238
+ - Re-generate if the code looks wrong
239
+
240
+ ---
241
+
242
+ ## 10. Run the Test
243
+
244
+ **From the Studio:**
245
+ - Open the case, click the **▶ Run** button in the toolbar
246
+ - Watch real-time progress in the run panel — each step lights up green/red
247
+
248
+ **From the CLI:**
249
+ ```bash
250
+ # Run a specific suite
251
+ npx assuremind run --suite "Login Tests"
252
+
253
+ # Run a single test
254
+ npx assuremind run --test "User can log in with valid credentials"
255
+
256
+ # Run all suites
257
+ npx assuremind run --all
258
+
259
+ # Watch the browser while running
260
+ npx assuremind run --all --headed
261
+
262
+ # Run in CI mode (exit code 0=pass, 1=fail)
263
+ npx assuremind run --all --ci
264
+ ```
265
+
266
+ ---
267
+
268
+ ## 11. View Results & Reports
269
+
270
+ After a run completes:
271
+
272
+ **In the Studio:**
273
+ - Click **Reports** in the sidebar to see run history
274
+ - Click any run to see per-suite, per-case, per-step results
275
+ - Screenshots and traces are linked directly in the result view
276
+ - Click the Allure icon (📊) on any run/case to open the full Allure HTML report
277
+
278
+ **Result files saved to:**
279
+ ```
280
+ results/
281
+ ├── screenshots/ ← PNG screenshots on failure
282
+ ├── videos/ ← MP4 recordings (if video enabled)
283
+ ├── traces/ ← Playwright .zip traces (open with trace viewer)
284
+ └── reports/ ← HTML and Allure reports
285
+ ```
286
+
287
+ **Open a trace in Playwright Trace Viewer:**
288
+ ```bash
289
+ npx playwright show-trace results/traces/my-test.zip
290
+ ```
291
+
292
+ ---
293
+
294
+ ## 12. Use Variables (Credentials & Dynamic Data)
295
+
296
+ Variables let you keep credentials and environment-specific values out of your test steps.
297
+
298
+ **Define variables** in `variables/global.json`:
299
+
300
+ ```json
301
+ {
302
+ "BASE_URL": "http://localhost:3000",
303
+ "USERNAME": "admin@example.com",
304
+ "PASSWORD": { "value": "supersecret", "secret": true }
305
+ }
306
+ ```
307
+
308
+ **Reference in steps** with `{{KEY}}`:
309
+ ```
310
+ Enter "{{USERNAME}}" in the email field
311
+ Enter "{{PASSWORD}}" in the password field
312
+ ```
313
+
314
+ **Environment-specific variables** (override globals per env):
315
+ - `variables/dev.env.json` — used with `--env dev`
316
+ - `variables/staging.env.json` — used with `--env staging`
317
+ - `variables/prod.env.json` — used with `--env prod`
318
+
319
+ ```bash
320
+ npx assuremind run --all --env staging
321
+ ```
322
+
323
+ **Manage via Studio:** Settings → Variables page lets you add/edit/delete variables with a UI.
324
+
325
+ ---
326
+
327
+ ## 13. Self-Healing
328
+
329
+ When a test step fails because the UI changed (e.g. a selector is stale), Assuremind automatically tries up to 6 healing strategies:
330
+
331
+ | Level | Strategy |
332
+ |-------|----------|
333
+ | 1 | Smart Retry — wait + retry the same code |
334
+ | 2 | AI Regeneration — AI rewrites the step code |
335
+ | 3 | Multi-Selector — try alternative selectors |
336
+ | 4 | Visual/SoM — screenshot + AI visual analysis |
337
+ | 5 | Decompose — break step into sub-actions |
338
+ | 6 | Manual — flag for human review |
339
+
340
+ Healed steps are saved as **pending suggestions** for you to review:
341
+
342
+ ```bash
343
+ # Interactive review in terminal
344
+ npx assuremind apply-healing
345
+
346
+ # Accept all silently (good for CI)
347
+ npx assuremind apply-healing --yes
348
+ ```
349
+
350
+ Or review in the Studio → **Self-Healing** page.
351
+
352
+ ---
353
+
354
+ ## 14. CI/CD Integration
355
+
356
+ **GitHub Actions example:**
357
+
358
+ ```yaml
359
+ name: E2E Tests
360
+ on: [push, pull_request]
361
+
362
+ jobs:
363
+ test:
364
+ runs-on: ubuntu-latest
365
+ steps:
366
+ - uses: actions/checkout@v4
367
+ - uses: actions/setup-node@v4
368
+ with:
369
+ node-version: '20'
370
+
371
+ - name: Install dependencies
372
+ run: npm ci
373
+
374
+ - name: Install Playwright browsers
375
+ run: npx playwright install --with-deps chromium
376
+
377
+ - name: Run E2E tests
378
+ env:
379
+ AI_PROVIDER: anthropic
380
+ ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
381
+ run: npx assuremind run --all --ci
382
+
383
+ - name: Upload test results
384
+ if: always()
385
+ uses: actions/upload-artifact@v4
386
+ with:
387
+ name: test-results
388
+ path: results/
389
+
390
+ - name: Apply healing suggestions (on failure)
391
+ if: failure()
392
+ run: npx assuremind apply-healing --yes
393
+ ```
394
+
395
+ **Environment variables for CI:**
396
+
397
+ ```bash
398
+ # Required
399
+ AI_PROVIDER=anthropic
400
+ ANTHROPIC_API_KEY=...
401
+
402
+ # Optional: disable healing in CI to save cost
403
+ HEALING_ENABLED=false
404
+ ```
405
+
406
+ ---
407
+
408
+ ## 15. Next Steps
409
+
410
+ | Topic | Resource |
411
+ |-------|----------|
412
+ | Full Studio UI walkthrough | `docs/STUDIO.md` |
413
+ | All CLI commands | `docs/CLI-REFERENCE.md` |
414
+ | Quick-reference cheat sheet | `TESTAUTOMIND.md` |
415
+ | All AI provider options | `.env.example` |
416
+
417
+ Run `npx assuremind doctor` at any time to check your setup health.