looking-glass-mcp 2.1.0 → 2.2.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 (3) hide show
  1. package/README.md +69 -3
  2. package/build/index.js +781 -477
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -132,7 +132,7 @@ These tools exist because an AI is the operator — they would be useless to a h
132
132
 
133
133
  | Tool | What it does |
134
134
  |------|-------------|
135
- | `test_scenario_run` | Execute multi-step test scenarios defined in JSON |
135
+ | `test_scenario_run` | Execute multi-step test scenarios with smart element resolution, self-healing selectors, composite steps, and data-driven testing |
136
136
  | `test_scenario_status` | Check progress of a running scenario |
137
137
  | `test_assert` | Run a single assertion (12 types: exists, textContains, urlEquals, isVisible, etc.) |
138
138
  | `test_fill_form` | Auto-fill form fields by selector mapping |
@@ -169,7 +169,9 @@ These tools exist because an AI is the operator — they would be useless to a h
169
169
 
170
170
  ## Test Scenarios
171
171
 
172
- Define multi-step test flows in JSON and run them with `test_scenario_run`:
172
+ Define multi-step test flows in JSON and run them with `test_scenario_run`. Steps support **smart element resolution** — use `query` for natural language element matching, `selector` for CSS selectors, or both (selector is tried first, query is the self-healing fallback).
173
+
174
+ ### Basic scenario with CSS selectors
173
175
 
174
176
  ```json
175
177
  {
@@ -185,7 +187,71 @@ Define multi-step test flows in JSON and run them with `test_scenario_run`:
185
187
  }
186
188
  ```
187
189
 
188
- **14 step actions**: navigate, click, type, select, hover, scroll, press, waitForSelector, waitForText, waitForNavigation, waitForNetworkIdle, assert, screenshot, evaluate, sleep
190
+ ### Smart scenario with natural language queries
191
+
192
+ ```json
193
+ {
194
+ "name": "Login Flow (smart)",
195
+ "steps": [
196
+ { "name": "Navigate", "action": "navigate", "url": "http://localhost:3000/login" },
197
+ { "name": "Enter email", "action": "type", "query": "email input", "value": "user@test.com" },
198
+ { "name": "Enter password", "action": "type", "query": "password field", "value": "secret" },
199
+ { "name": "Submit", "action": "click", "query": "sign in button" },
200
+ { "name": "Verify redirect", "action": "assert", "type": "urlContains", "expected": "/dashboard" }
201
+ ]
202
+ }
203
+ ```
204
+
205
+ ### Self-healing selectors
206
+
207
+ Provide both `selector` and `query`. The selector is tried first (fast). If it fails (DOM changed, class renamed), the query resolves the element semantically via the accessibility tree. The step is marked `[HEALED]` in the results so you know it happened.
208
+
209
+ ```json
210
+ { "name": "Submit", "action": "click", "selector": "button.btn-login", "query": "the login button" }
211
+ ```
212
+
213
+ ### Composite steps
214
+
215
+ High-level actions that replace 5-6 atomic steps:
216
+
217
+ ```json
218
+ { "name": "Log in", "action": "login", "url": "/login", "value": "admin@co.com", "password": "P@ssw0rd", "waitForSelector": ".dashboard" }
219
+ ```
220
+
221
+ ```json
222
+ { "name": "Fill signup", "action": "fill_form", "fields": { "Email": "test@co.com", "Name": "Jane" }, "selector": "button.submit" }
223
+ ```
224
+
225
+ ```json
226
+ { "name": "Wait for page", "action": "wait_stable", "timeout": 5000 }
227
+ ```
228
+
229
+ ### Data-driven testing
230
+
231
+ Use `{{variable}}` placeholders and provide `dataSets` to run the same scenario with multiple inputs:
232
+
233
+ ```json
234
+ {
235
+ "name": "Login with {{role}} user",
236
+ "steps": [
237
+ { "name": "Enter email", "action": "type", "query": "email input", "value": "{{username}}" },
238
+ { "name": "Enter password", "action": "type", "query": "password field", "value": "{{password}}" },
239
+ { "name": "Submit", "action": "click", "query": "sign in button" },
240
+ { "name": "Verify", "action": "assert", "type": "urlContains", "expected": "{{expectedUrl}}" }
241
+ ],
242
+ "dataSets": [
243
+ { "label": "admin", "variables": { "role": "admin", "username": "admin@co.com", "password": "Admin1!", "expectedUrl": "/dashboard" } },
244
+ { "label": "viewer", "variables": { "role": "viewer", "username": "view@co.com", "password": "View1!", "expectedUrl": "/readonly" } },
245
+ { "label": "invalid", "variables": { "role": "invalid", "username": "bad@co.com", "password": "wrong", "expectedUrl": "/login" } }
246
+ ]
247
+ }
248
+ ```
249
+
250
+ ### Full observability
251
+
252
+ Every step automatically captures a screenshot, page state (URL, console errors, network failures), and resolution details (method, confidence score, whether self-healing was used). Scenario results include aggregated resolution metrics.
253
+
254
+ **18 step actions**: navigate, click, type, select, hover, scroll, press, waitForSelector, waitForText, waitForNavigation, waitForNetworkIdle, assert, screenshot, evaluate, sleep, login, fill_form, wait_stable
189
255
 
190
256
  **12 assertion types**: exists, notExists, textContains, textEquals, hasAttribute, hasClass, isVisible, isEnabled, urlContains, urlEquals, countEquals, consoleNoErrors
191
257