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/docs/STUDIO.md ADDED
@@ -0,0 +1,390 @@
1
+ # Assuremind Studio Guide
2
+
3
+ Assuremind Studio is a browser-based UI for writing tests, running them, reviewing results, and managing self-healing suggestions — all without touching the command line.
4
+
5
+ ---
6
+
7
+ ## Starting the Studio
8
+
9
+ ```bash
10
+ npx assuremind studio
11
+ ```
12
+
13
+ The server starts and your default browser opens at `http://localhost:4400`.
14
+
15
+ To use a different port:
16
+
17
+ ```bash
18
+ npx assuremind studio --port 5000
19
+ ```
20
+
21
+ To start the server without opening the browser (e.g., on a remote machine):
22
+
23
+ ```bash
24
+ npx assuremind studio --no-open
25
+ ```
26
+
27
+ The Studio port can also be set permanently in `autotest.config.ts`:
28
+
29
+ ```typescript
30
+ export default defineConfig({
31
+ studioPort: 4400,
32
+ // ...
33
+ });
34
+ ```
35
+
36
+ ---
37
+
38
+ ## Navigation
39
+
40
+ The sidebar on the left has these pages:
41
+
42
+ | Icon | Page | Purpose |
43
+ |------|------|---------|
44
+ | 📊 | Dashboard | Run summary, recent results, quick-action links |
45
+ | ✨ | Smart Tests | Generate test suites from user stories or Jira links |
46
+ | ✏️ | Test Editor | Create and manage suites, cases, and steps |
47
+ | ▶️ | Run Config | Configure and launch a test run |
48
+ | 📋 | Reports | Browse historical run results |
49
+ | 🔧 | Variables | Manage test variables and secrets |
50
+ | 🩺 | Self-Healing | Review and apply AI-generated selector fixes |
51
+ | ⚙️ | Settings | Environment, browsers, healing, capture settings |
52
+ | 🌿 | Git Control Center | Branch management, AI commits, push/pull, conflict resolution |
53
+
54
+ ---
55
+
56
+ ## Dashboard
57
+
58
+ The Dashboard shows at a glance:
59
+
60
+ - **Pass rate** — percentage of tests passing in the most recent run
61
+ - **Total tests** — suite and case counts
62
+ - **Last run** — time, duration, and status of the most recent run
63
+ - **Healing queue** — number of pending self-healing suggestions
64
+
65
+ **Quick actions:**
66
+
67
+ - **Run All** — starts a full run immediately
68
+ - **Open Studio** — returns to this page
69
+ - **Apply Healing** — jumps to the Self-Healing page
70
+
71
+ While data is loading, animated skeleton cards are shown so the layout never jumps.
72
+
73
+ ---
74
+
75
+ ## Test Editor
76
+
77
+ ### Suite Types
78
+
79
+ Assuremind supports three suite types:
80
+
81
+ | Type | Description |
82
+ |------|-------------|
83
+ | **UI** | Standard Playwright browser automation tests. Steps show a blue "UI" badge. |
84
+ | **API** | API-only tests using HTTP request/assertion steps. |
85
+ | **Audit** | Full Playwright automation with built-in Lighthouse non-functional checks. Steps show an amber "Audit" badge. Screenshot, video, and trace are disabled by default. Test files stored in `tests/audit/`. |
86
+
87
+ ### Audit Suites
88
+
89
+ Audit suites run exactly like UI suites (full Playwright automation) but add non-functional quality checks via Google Lighthouse.
90
+
91
+ **Audit Flag on Steps**
92
+
93
+ In Audit suites, each step has a `⚡ Audit` button. Clicking it marks that step as a Lighthouse checkpoint:
94
+ - When a marked step runs, Lighthouse audits `page.url()` at that point in the test
95
+ - Click `⚡ Audit` to mark, then confirm with **✓** to save or **✗** to cancel
96
+ - If no steps are marked, Lighthouse is skipped entirely even in Audit suites
97
+
98
+ **Non-Functional Checks**
99
+
100
+ Each test case in an Audit suite has a **Non-Functional Checks** section with three checkboxes:
101
+ - **⚡ Performance** — Lighthouse Performance score
102
+ - **♿ Accessibility** — Lighthouse Accessibility score
103
+ - **🔍 SEO** — Lighthouse SEO score
104
+
105
+ If all three are unchecked, Lighthouse is skipped for that case. A warning is shown if none are selected.
106
+
107
+ **Lighthouse Score Thresholds**
108
+
109
+ | Range | Rating | Effect |
110
+ |-------|--------|--------|
111
+ | 0–49 | Poor (red) | Test case **FAILS** |
112
+ | 50–89 | Needs Work (amber) | Warning only |
113
+ | 90–100 | Good (green) | Pass |
114
+
115
+ ### Creating a Suite
116
+
117
+ 1. Click the **+ New Suite** button (top right)
118
+ 2. Enter a **name** — this becomes the folder name under `tests/` (e.g., "Login Tests" → `tests/login-tests/`); Audit suites use `tests/audit/`
119
+ 3. Choose a **suite type**: UI, API, or Audit
120
+ 4. Optionally add a **description** and **tags**
121
+ 5. Click **Create**
122
+
123
+ ### Creating a Test Case
124
+
125
+ 1. Select a suite from the left panel
126
+ 2. Click **+ New Case**
127
+ 3. Enter a **name**, **priority** (`critical`, `high`, `medium`, `low`), and optional **tags**
128
+ 4. Click **Create**
129
+
130
+ ### Adding Steps
131
+
132
+ 1. Open a case by clicking it
133
+ 2. Click **+ Add Step** at the bottom of the step list
134
+ 3. Type a plain-English instruction, e.g.:
135
+ - `Go to the login page`
136
+ - `Enter "admin@example.com" in the email field`
137
+ - `Click the Login button`
138
+ - `Verify the page title contains "Dashboard"`
139
+ 4. Press **Enter** or click the checkmark
140
+
141
+ **Tips for writing good instructions:**
142
+ - Be specific about what to interact with: `Click the blue Submit button` rather than just `Submit`
143
+ - Use quotes for literal values: `Enter "admin@example.com" in the email field`
144
+ - Reference variables with double-braces: `Enter "{{ADMIN_EMAIL}}" in the email field`
145
+ - Include assertions: `Verify that the success banner is visible`
146
+
147
+ ### Generating Code
148
+
149
+ After adding steps, click **Generate Code** (or **Generate** on an individual step) to have the AI write the Playwright code.
150
+
151
+ - Steps with **green code** icons have generated code
152
+ - Steps with **grey code** icons are pending generation
153
+ - Click any step's code icon to see or edit the generated code
154
+
155
+ **The AI only runs once per unique (instruction, URL pattern) pair.** Subsequent runs use the cached code, making them free and instant.
156
+
157
+ ### Reordering Steps
158
+
159
+ Drag the ≡ handle on the left of any step to reorder it. The order numbers update automatically.
160
+
161
+ ### Deleting
162
+
163
+ - Delete a step: click the **×** on the right of the step row
164
+ - Delete a case: open the case, click **⋮** → **Delete Case**
165
+ - Delete a suite: select the suite, click **⋮** → **Delete Suite**
166
+
167
+ Deletions are permanent. There is no undo in the Studio — use Git to recover.
168
+
169
+ ---
170
+
171
+ ## Story Generator
172
+
173
+ Generate an entire test suite from a plain-English user story:
174
+
175
+ 1. Navigate to **Story Generator**
176
+ 2. Type your story in the text area:
177
+ ```
178
+ As a user I want to reset my password so I can regain access to my account.
179
+ Steps:
180
+ - I click "Forgot password" on the login page
181
+ - I enter my email address
182
+ - I receive a reset email
183
+ - I click the reset link
184
+ - I enter a new password and confirm it
185
+ - I am redirected to the login page with a success message
186
+ ```
187
+ 3. Optionally provide a **Suite Name** (AI generates one if blank)
188
+ 4. Click **Generate Suite**
189
+
190
+ The AI creates:
191
+ - A suite directory with `suite.json`
192
+ - One or more test case files with steps
193
+ - Playwright code for each step
194
+
195
+ The generated files appear in the Test Editor immediately.
196
+
197
+ ---
198
+
199
+ ## Run Config
200
+
201
+ Configure and start a test run without the command line:
202
+
203
+ 1. Navigate to **Run Config**
204
+ 2. Choose a **scope**:
205
+ - All suites
206
+ - Specific suite (dropdown)
207
+ - By tag (text input)
208
+ - Specific test (text input)
209
+ 3. Select **browsers**: Chromium, Firefox, WebKit (multi-select)
210
+ 4. Set **parallel workers** (slider, 1–8)
211
+ 5. Toggle **Headed mode** to watch the browser during the run
212
+ 6. Toggle **Self-Healing** on/off for this run
213
+ 7. Optionally select a **Device** for emulation (see below)
214
+ 8. Click **Start Run**
215
+
216
+ A live progress panel shows test results as they complete. The WebSocket connection streams updates in real time — no page refresh needed.
217
+
218
+ When the run finishes, you are offered a link to the full report.
219
+
220
+ ### Device Emulation
221
+
222
+ The **Device Emulation** card appears below the Browsers card. It lets you emulate a real mobile or tablet device using Playwright's built-in device descriptors. No manual viewport configuration needed — selecting a device automatically applies the correct viewport, user-agent, device pixel ratio, and touch/mobile flags.
223
+
224
+ **Categories:**
225
+
226
+ | Tab | What it shows |
227
+ |-----|---------------|
228
+ | **All** | All presets |
229
+ | **Desktop** | Viewport-only presets: 1920×1080, 1440×900, 1366×768, 1280×720, 1024×768 |
230
+ | **Mobile** | iPhone 15 Pro/15/14/SE, Pixel 7/5, Galaxy S9+/S8 |
231
+ | **Tablet** | iPad Pro 11″, iPad (gen 7), iPad Mini, Galaxy Tab S4 |
232
+
233
+ **How to use:**
234
+ 1. Click a device card — it highlights in teal and shows a device pill in the card header
235
+ 2. Click the **×** in the header or click **No Emulation** to clear
236
+ 3. An amber warning appears if a mobile/tablet device is selected without Chromium — mobile emulation works best on Chromium
237
+
238
+ **In Reports:** each case row shows a teal device badge (📱 / 🖥️ / tablet icon) when the run used device emulation.
239
+
240
+ **Equivalent CLI flag:** `--device "iPhone 15 Pro"`
241
+
242
+ ---
243
+
244
+ ## Reports
245
+
246
+ Browse all historical run results:
247
+
248
+ - Each run shows: status badge (✅ / ❌), date/time, duration, pass/fail/skip counts
249
+ - Click a run to see the **full result tree**: Suite → Case → Step
250
+ - Each step shows: status, duration, generated code, and screenshot (on failure)
251
+ - Failed steps show the error message and a screenshot thumbnail
252
+
253
+ ### Lighthouse Results (Audit Suites)
254
+
255
+ For Audit suite cases that have Lighthouse data, three tab buttons appear on the case row:
256
+ - **⚡ Speed** — Performance score
257
+ - **♿ A11y** — Accessibility score
258
+ - **🔍 SEO** — SEO score
259
+
260
+ Score colors follow the threshold rules: red for Poor (< 50), amber for Needs Work (50–89), green for Good (90+). A case row is highlighted red when any score is Poor (< 50).
261
+
262
+ **Allure Integration**: Audit cases produce three separate HTML report attachments per category — Performance Report, Accessibility Report, and SEO Report. The Allure test status is set to FAILED if any Lighthouse score is below 50.
263
+
264
+ **Filter and sort:**
265
+ - Use the search box to filter by run ID or date
266
+ - Use the **Status** filter to show only failed runs
267
+ - Use **Limit** to control how many runs are displayed (default: 20)
268
+
269
+ ---
270
+
271
+ ## Variables
272
+
273
+ Manage variables that can be referenced in step instructions:
274
+
275
+ ### Global variables
276
+
277
+ Available in all test runs regardless of environment.
278
+
279
+ 1. Click **+ Add Variable**
280
+ 2. Enter a **key** (e.g., `ADMIN_EMAIL`) and **value**
281
+ 3. Toggle **Secret** to mask the value in logs and UI
282
+ 4. Click **Save**
283
+
284
+ ### Environment-specific variables
285
+
286
+ Variables can be overridden per environment (`dev`, `staging`, `prod`).
287
+
288
+ 1. Select the environment tab
289
+ 2. Add variables that override globals for that environment
290
+ 3. Use `--env <name>` when running to load the overrides
291
+
292
+ ### Using variables in steps
293
+
294
+ Reference any variable in a step instruction using double-braces:
295
+
296
+ ```
297
+ Enter "{{ADMIN_EMAIL}}" in the email field
298
+ Navigate to "{{BASE_URL}}/login"
299
+ ```
300
+
301
+ Variables are interpolated into the generated Playwright code at run time.
302
+
303
+ ---
304
+
305
+ ## Self-Healing
306
+
307
+ When a test step fails and the AI generates a healed selector, it appears here for review.
308
+
309
+ ### Healing event list
310
+
311
+ Each event shows:
312
+ - **Suite / Case / Step** — where the failure occurred
313
+ - **Original code** — the code that failed
314
+ - **Healed code** — the AI's suggested fix
315
+ - **Healing level** — 1–6 (higher = more aggressive strategy)
316
+ - **Status** — `pending`, `accepted`, or `rejected`
317
+
318
+ ### Reviewing suggestions
319
+
320
+ - Click **Accept** to apply the healed code to the `.test.json` file
321
+ - Click **Reject** to dismiss the suggestion (original code is kept)
322
+ - Click **Accept All** to accept every pending suggestion in one click
323
+
324
+ Accepted changes are written immediately to the test files. The next run will use the healed code.
325
+
326
+ ### Healing statistics
327
+
328
+ The top of the page shows:
329
+ - Total heals applied this month
330
+ - Daily budget remaining (based on `healing.dailyBudget` in config)
331
+ - Most healed suite and case
332
+
333
+ ---
334
+
335
+ ## Settings
336
+
337
+ Edit `autotest.config.ts` from the browser:
338
+
339
+ | Setting | Description |
340
+ |---------|-------------|
341
+ | Base URL | The URL of the application under test |
342
+ | Browsers | Which browsers to use by default |
343
+ | Headless | Run headless by default |
344
+ | Timeout | Step timeout in milliseconds |
345
+ | Retries | Number of retries on failure |
346
+ | Parallel | Number of parallel workers |
347
+ | Screenshot | `on`, `off`, or `on-failure` |
348
+ | Video | `on`, `off`, or `on-failure` |
349
+ | Trace | `on`, `off`, or `on-failure` |
350
+ | Healing enabled | Master switch for self-healing |
351
+ | Healing max level | Maximum healing cascade level (1–6) |
352
+ | Daily budget | Maximum AI spend on healing per day (USD) |
353
+ | Studio port | Port for the Studio server |
354
+
355
+ Changes are saved immediately to both `autotest.config.json` and `autotest.config.ts`.
356
+
357
+ ---
358
+
359
+ ## WebSocket Live Updates
360
+
361
+ The Studio uses a WebSocket connection (`ws://localhost:<port>/ws`) to receive live updates:
362
+
363
+ | Event | Description |
364
+ |-------|-------------|
365
+ | `run:complete` | A run has finished — results available |
366
+ | `run:error` | A run failed to start |
367
+
368
+ The connection indicator in the top bar shows:
369
+ - **Green dot** — connected
370
+ - **Grey dot** — disconnected (Studio server not running)
371
+
372
+ ---
373
+
374
+ ## Keyboard Shortcuts
375
+
376
+ | Shortcut | Action |
377
+ |----------|--------|
378
+ | `Ctrl+S` | Save current changes |
379
+ | `Ctrl+Enter` | Generate code for selected step |
380
+ | `Ctrl+R` | Run all tests |
381
+ | `Esc` | Close modal / cancel edit |
382
+
383
+ ---
384
+
385
+ ## Tips
386
+
387
+ - **Browser auto-refresh** — the Studio does not auto-refresh when test files are edited externally (e.g., by `apply-healing`). Click the refresh icon or press `F5`.
388
+ - **Multiple windows** — you can open the Studio in multiple browser tabs. All tabs receive WebSocket events simultaneously.
389
+ - **Remote access** — start with `--no-open` on the server and open `http://<server-ip>:4400` in your local browser. Make sure the port is reachable.
390
+ - **Stopping the server** — press `Ctrl+C` in the terminal where `studio` is running.
package/package.json ADDED
@@ -0,0 +1,118 @@
1
+ {
2
+ "name": "assuremind",
3
+ "version": "1.0.0",
4
+ "description": "AI-powered codeless UI & API automation framework",
5
+ "author": "Deepak Hiremath",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "assuremind": "./dist/cli/index.js"
9
+ },
10
+ "main": "./dist/index.js",
11
+ "module": "./dist/index.mjs",
12
+ "types": "./dist/index.d.ts",
13
+ "exports": {
14
+ ".": {
15
+ "types": "./dist/index.d.ts",
16
+ "import": "./dist/index.mjs",
17
+ "require": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist/",
22
+ "templates/",
23
+ "ui/dist/",
24
+ "docs/",
25
+ "README.md",
26
+ "CONTRIBUTING.md",
27
+ "LICENSE"
28
+ ],
29
+ "engines": {
30
+ "node": ">=18"
31
+ },
32
+ "os": [
33
+ "darwin",
34
+ "linux",
35
+ "win32"
36
+ ],
37
+ "keywords": [
38
+ "testing",
39
+ "automation",
40
+ "playwright",
41
+ "ai",
42
+ "codeless",
43
+ "no-code",
44
+ "test-automation",
45
+ "qa",
46
+ "self-healing",
47
+ "claude",
48
+ "openai",
49
+ "gemini",
50
+ "ui-testing"
51
+ ],
52
+ "scripts": {
53
+ "prepare": "npm run build",
54
+ "build": "npm run build:lib && npm run build:ui",
55
+ "build:lib": "tsup",
56
+ "build:ui": "cd ui && npm install --ignore-scripts && npm run build",
57
+ "dev": "tsup --watch",
58
+ "dev:ui": "cd ui && npm run dev",
59
+ "test": "vitest run",
60
+ "test:watch": "vitest",
61
+ "test:coverage": "vitest run --coverage",
62
+ "lint": "eslint src/",
63
+ "lint:fix": "eslint src/ --fix",
64
+ "format": "prettier --write \"src/**/*.ts\"",
65
+ "typecheck": "tsc --noEmit"
66
+ },
67
+ "dependencies": {
68
+ "@anthropic-ai/sdk": "^0.30.0",
69
+ "@aws-sdk/client-bedrock-runtime": "^3.679.0",
70
+ "@fastify/cors": "^11.2.0",
71
+ "@fastify/static": "^9.0.0",
72
+ "@fastify/websocket": "^11.2.0",
73
+ "@google/generative-ai": "^0.21.0",
74
+ "@playwright/test": "^1.47.0",
75
+ "allure-commandline": "^2.38.1",
76
+ "allure-js-commons": "^3.0.0",
77
+ "allure-playwright": "^3.0.0",
78
+ "chalk": "^5.3.0",
79
+ "chokidar": "^4.0.0",
80
+ "commander": "^12.1.0",
81
+ "date-fns": "^4.1.0",
82
+ "dotenv": "^16.4.0",
83
+ "fast-glob": "^3.3.0",
84
+ "fastify": "^5.8.4",
85
+ "fs-extra": "^11.2.0",
86
+ "inquirer": "^9.3.0",
87
+ "js-yaml": "^4.1.1",
88
+ "lighthouse": "^13.0.3",
89
+ "lodash-es": "^4.17.21",
90
+ "nanoid": "^5.0.0",
91
+ "open": "^10.1.0",
92
+ "openai": "^4.67.0",
93
+ "ora": "^8.0.1",
94
+ "pino": "^9.4.0",
95
+ "pino-pretty": "^11.2.0",
96
+ "playwright": "^1.47.0",
97
+ "simple-git": "^3.33.0",
98
+ "uuid": "^10.0.0",
99
+ "zod": "^3.23.0"
100
+ },
101
+ "devDependencies": {
102
+ "@types/fs-extra": "^11.0.0",
103
+ "@types/js-yaml": "^4.0.9",
104
+ "@types/lodash-es": "^4.17.0",
105
+ "@types/node": "^22.7.0",
106
+ "@types/uuid": "^10.0.0",
107
+ "@types/ws": "^8.5.0",
108
+ "@typescript-eslint/eslint-plugin": "^8.8.0",
109
+ "@typescript-eslint/parser": "^8.8.0",
110
+ "@vitest/coverage-v8": "^2.1.0",
111
+ "docx": "^9.6.1",
112
+ "eslint": "^9.12.0",
113
+ "prettier": "^3.3.0",
114
+ "tsup": "^8.3.0",
115
+ "typescript": "^5.6.0",
116
+ "vitest": "^2.1.0"
117
+ }
118
+ }