@ia-qa/qa-discovery 0.11.2 → 0.12.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/README.md CHANGED
@@ -25,6 +25,7 @@ npx -p @ia-qa/qa-discovery ia-qa-discover scan https://your-app.example.com --sa
25
25
  | my app is behind a login | `login` — a visible browser, you log in, the session is reused |
26
26
  | most of the inputs are behind a menu or a tab | `scan --deep` — opens them one level and captures what they reveal |
27
27
  | **what does my test suite not test?** | **`coverage`** — the gap, ranked; needs `@ia-qa/self-healing` and one watched run |
28
+ | **I have test scenarios, I want tests that run** | **`scenarios`** — Gherkin in, Playwright out, each test proven able to fail |
28
29
  | what changed since last time? | `history` |
29
30
  | what is each entry point *for*, and how sensitive? | `ia-qa-discover-ai classify` (optional, your own key) |
30
31
  | what does somebody come to this page to **do**? | `ia-qa-discover-ai plan` (optional, your own key) |
@@ -37,12 +38,12 @@ ia-qa-discover skill --print # read it
37
38
  ia-qa-discover skill --install # drop it in .claude/skills/, where agents actually look
38
39
  ```
39
40
 
40
- `ia-qa-discover <verb> --help` for flags. Nothing here emits a verdict and nothing here gates
41
- CI: a page count is not coverage, and a gap is a decision for a human.
41
+ `ia-qa-discover <verb> --help` for flags. Nothing here gates CI: a page count is not coverage,
42
+ a gap is a decision for a human, and `scenarios` judges the tests it writes, never your app.
42
43
 
43
44
  **Same operations for an AI agent** — one contract served twice, never a simplified view for
44
45
  one of them. `ia-qa-discover-mcp` exposes `scan_app`, `coverage_map`, `classify_app`,
45
- `plan_pages` and `discovery_history`. `login` is deliberately not a tool: it waits for a
46
+ `plan_pages`, `prove_scenarios` and `discovery_history`. `login` is deliberately not a tool: it waits for a
46
47
  person at a browser.
47
48
 
48
49
  > **New here?** The [step-by-step tutorial](https://www.ia-qa.com/devtools/qa-discovery/tutorial)
@@ -317,6 +318,20 @@ Files land in `.ia-qa-discovery/generated/` and nothing is added to your suite.
317
318
 
318
319
  `--out <dir>` to write them where your suite lives, `--json` for a machine-readable summary, or name pages explicitly to generate for them anyway.
319
320
 
321
+ ### `scenarios [dir|file]`
322
+
323
+ ```bash
324
+ npx ia-qa-discover scenarios --base-url https://your.app/
325
+ ```
326
+
327
+ You write (or review) what is tested; this verb writes how. Scenarios are Gherkin files in `scenarios/` — English or French keywords — in a closed vocabulary: `I open`, `I click`, `I fill … with`, `I select … in`, `I choose`, `I check`, `I see`, `I don't see`, `the URL contains` (`j'ouvre`, `je clique sur`, `je vois`…). A scenario tagged `@draft` is a proposal and is not run; removing the tag is the validation, visible in the diff.
328
+
329
+ Each step is bound on the **live page** to the one element Playwright's own `getByRole` / `getByLabel` / `getByText` counts for it — never re-implemented, never guessed. None or several is a question for you, answered with what the page actually shows. Then every test is **proven**: green twice in fresh browsers, *and* red when what each check reads is altered on the page. That second half is the one generators skip, and it is where most generated tests fail: `the URL contains "my.app"` holds on every page of the site, so it is reported **blind** instead of being counted as a test.
330
+
331
+ Every scenario lands in exactly one column — ✅ proven · 🙈 blind · ❔ not proven (the page undid the alteration) · 🎲 flaky · ❌ fails on the app as it is (the app or the scenario is wrong, and only you can say which) · ✋ needs you · ⏸ not run. One spec per feature in `.ia-qa-discovery/generated/`, byte-identical when nothing moved, never overwritten without `--force`; lines `ia-qa-heal` cannot repair (a test id, a text) say so in the file. A browser on this machine and nothing else: no model, nothing sent. An app behind a login uses the session `scan` would use (one saved by `ia-qa-heal login` included, or `--session <storageState>`); the spec then says your Playwright config must give its tests a session too. The same run is the MCP tool `prove_scenarios`, where an agent may draft scenarios only with `@draft`, and a scenario opening another origin than the base URL is refused.
332
+
333
+ Measured on [Sandbox Bazaar](https://jeteste-qa.github.io/?scenario=bz-100): three scenarios written against the plain shop gave three proven tests, and the same files, run unchanged with `npx playwright test` against the shop's trapped variants, failed exactly where a total changed — a hidden fee (`53.40 EUR` instead of `46.90 EUR`) and a pre-checked subscription (`51.89 EUR`) — and stayed green where the trap does not touch what they check.
334
+
320
335
  ### `history`
321
336
 
322
337
  The trend no single scan can reconstruct: pages, forms, API surface, and what changed run over run.
package/ROADMAP.md CHANGED
@@ -278,6 +278,17 @@ assertion beyond what the app itself declares. What a submission *produces* stay
278
278
  That is the deterministic floor. Everything below — deriving *intent* rather than structure —
279
279
  is still net-new, and still needs the grid.
280
280
 
281
+ **Shipped next (lot 1 of `SPEC-scenarios-to-tests.md`, unpublished): `ia-qa-discover
282
+ scenarios`.** The other direction: the intent comes from a person's Gherkin scenario, and the
283
+ verb supplies the binding, the code and the proof. Steps are bound on the live page by
284
+ Playwright's own counts; a test is *proven* only when it passes twice in fresh browsers **and**
285
+ fails when what each check reads is altered. Measured on Sandbox Bazaar: 3 of 3 proven on the
286
+ plain shop, and the same files failed with the real runner exactly where a trapped variant
287
+ changed the total. **Not built yet, in order:** a BYOK model to bind the steps exact matching
288
+ could not (choosing only among elements the page offers, the names sent as data), a skill that
289
+ drafts `@draft` scenarios, `needs` answered by the tool asking (session via `ia-qa-heal login`,
290
+ secrets via the OS store), the `pal` and MCP doors, a second app we did not write.
291
+
281
292
  **The audit found the assumed inputs do not exist.** There is no closed grid of test
282
293
  patterns anywhere in the ecosystem to derive from — `QA_AGENT_RECIPES` and
283
294
  `AUGMENTED_QA_PLAYBOOK` are editorial content, not structured data. So the intent→scenario
package/TUTORIAL.md CHANGED
@@ -29,6 +29,7 @@ suite, a ranked list of the pages nobody tests.
29
29
  7. [The four ways a page count lies](#7-the-four-ways-a-page-count-lies)
30
30
  8. [What my suite does not test](#8-what-my-suite-does-not-test)
31
31
  9. [Doing this every week](#9-doing-this-every-week)
32
+ 9b. [From your test scenarios to tests that run](#9b-from-your-test-scenarios-to-tests-that-run)
32
33
  10. [Optional: what is each entry point *for*?](#10-optional-what-is-each-entry-point-for)
33
34
  11. [Optional: what does somebody come here to *do*?](#11-optional-what-does-somebody-come-here-to-do)
34
35
  12. [Troubleshooting](#12-troubleshooting)
@@ -421,6 +422,74 @@ down in a file a reviewer can see.
421
422
 
422
423
  ---
423
424
 
425
+ ## 9b. From your test scenarios to tests that run
426
+
427
+ The gap tells you which pages no test visits. If you already know **what** to test on them — in a
428
+ test-management tool, a ticket, your head — write it as scenarios and let this write the tests.
429
+
430
+ **1. Write the scenarios.** One file per feature in `scenarios/`, in plain Gherkin (English or
431
+ French keywords):
432
+
433
+ ```gherkin
434
+ Feature: Buying headphones
435
+
436
+ Scenario: The total includes standard delivery
437
+ Given I open "/?scenario=bz-100"
438
+ When I click "Studio 2 over-ear headphones"
439
+ And I click "Add to cart"
440
+ And I click "Cart (1)"
441
+ And I click "Go to checkout"
442
+ And I choose "Standard delivery"
443
+ Then I see "46.90 EUR"
444
+ ```
445
+
446
+ The steps it understands: `I open`, `I click`, `I fill "<label>" with "<value>"`,
447
+ `I select "<option>" in "<label>"`, `I choose`, `I check` / `I uncheck`, `I see`,
448
+ `I don't see`, `the URL contains` (`j'ouvre`, `je clique sur`, `je vois`…). Anything else is
449
+ not guessed: the scenario comes back asking you to rewrite that step. A scenario tagged `@draft`
450
+ is a proposal — an AI agent may draft them, always with that tag — and is not run until **you**
451
+ remove the tag.
452
+
453
+ **2. Run it.**
454
+
455
+ ```bash
456
+ npx ia-qa-discover scenarios --base-url https://your.app/
457
+ ```
458
+
459
+ What it prints, on the example shop used above (real output):
460
+
461
+ ```console
462
+ 3 proven · 1 needs-input · 1 not-run
463
+
464
+ ✅ Proven — green twice, and red when what it checks is altered
465
+ · The total includes standard delivery (scenarios/checkout.feature:10)
466
+ …
467
+ ✋ Needs you — a step the page cannot answer on its own
468
+ · A promo code lowers the total (scenarios/checkout.feature:25)
469
+ step 28: I click "Apply promo code"
470
+ nothing on the page answers to a button or link named "Apply promo code"
471
+ the page shows: button "Add to cart", link "Audio", link "Kitchen", … link "Cart (0)"
472
+ ```
473
+
474
+ **3. Read the columns, all of them.** Each step was matched to the **one** element Playwright
475
+ counts for it on the live page — none or several comes back to you with what the page shows.
476
+ Then each test was **proven**: it passed twice in fresh browsers, *and* it failed when the text it
477
+ checks was altered on the page. That second half is the one to care about:
478
+
479
+ - **✅ proven** — it can fail. Read it, then move it into your suite.
480
+ - **🙈 blind** — it runs green and checks nothing that can change: `the URL contains "your.app"`
481
+ holds on every page of the site. Not a test yet; sharpen the `Then` step.
482
+ - **❌ fails on the app as it is** — the app or the scenario is wrong. Only you can say which;
483
+ never edit the expected text to what the page shows, or a bug report becomes a passing test.
484
+ - **✋ needs you**, **🎲 flaky**, **❔ not proven**, **⏸ not run** — each says why.
485
+
486
+ The specs land in `.ia-qa-discovery/generated/`, one per feature, never overwritten without
487
+ `--force`, byte-identical when nothing moved. Nothing is added to your suite and nothing is sent
488
+ anywhere: a browser on your machine, no model. Behind a login, the session `scan` uses is used
489
+ here too (`--session <file>` to name another).
490
+
491
+ ---
492
+
424
493
  ## 10. Optional: what is each entry point *for*?
425
494
 
426
495
  Everything above is deterministic and local. This section is neither, and it is a separate
package/dist/cli/args.js CHANGED
@@ -25,6 +25,7 @@ exports.KNOWN_FLAGS = {
25
25
  history: ['--json', '--limit'],
26
26
  coverage: ['--json', '--report', '--open'],
27
27
  generate: ['--json', '--out', '--force', '--include-login-walls', '--include-error-pages'],
28
+ scenarios: ['--json', '--out', '--force', '--base-url', '--session'],
28
29
  };
29
30
  function rejectUnknownFlags(command, args) {
30
31
  const known = exports.KNOWN_FLAGS[command];
@@ -1 +1 @@
1
- {"version":3,"file":"args.js","sourceRoot":"","sources":["../../src/cli/args.ts"],"names":[],"mappings":";;;AAyBA,gDAQC;AAjCD,sGAAsG;AACzF,QAAA,WAAW,GAAsC;IAC5D,KAAK,EAAE,CAAC,WAAW,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,CAAC;IAC7D,IAAI,EAAE;QACJ,SAAS;QACT,OAAO;QACP,aAAa;QACb,eAAe;QACf,WAAW;QACX,cAAc;QACd,cAAc;QACd,QAAQ;QACR,eAAe;QACf,qBAAqB;QACrB,QAAQ;QACR,QAAQ;QACR,UAAU;QACV,QAAQ;KACT;IACD,KAAK,EAAE,CAAC,O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AAE,QAAQ,CAAC;IAC1C,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,uBAAuB,EAAE,uBAAuB,CAAC;IAC1F,SAAS,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,CAAC;CACrE,CAAC;AAEF,SAAgB,kBAAkB,CAAC,OAAe,EAAE,IAAc;IAChE,MAAM,KAAK,GAAG,mBAAW,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO;IAChC,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;QACrB,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC;YAAE,SAAS;QACjC,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;YAAE,SAAS;QAChC,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,yBAAyB,OAAO,kDAAkD,CAAC,CAAC;IACxH,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- declare const HELP = "ia-qa-discover \u2014 deterministic surface reconnaissance for a web app\n\nF1 of QA Discovery: crawl an app's same-origin pages and capture what each one\nis structurally about \u2014 title, headings, forms, and observed API calls. No\nLLM, no verdict: this is recon, not a gate. Runs entirely on your machine;\nnothing is uploaded anywhere.\n\n[FOR AI AGENTS] You are driving this for a human. Run `scan` to capture the\napp's surface, then read .ia-qa-discovery/capture/surface.json (the index) and\nthe per-page files it points at \u2014 that is the evidence for anything you\nreport about this app. Never assert a page's purpose or risk from the URL\nalone; ground it in the captured meta/headings/forms/apiCalls. Never read a\npage count as coverage: if scan warns that pages still show a login form, you\nmeasured the wall, not the app. You CANNOT run `login` \u2014 it waits for a human\nat a browser; ask them to run it, then scan again.\n`coverage` answers \"what does their suite NOT test\" \u2014 but only from a suite that was\nwatched running (one `ia-qa-heal run`, or one `ia-qa-pal tour --suite`). If it says there is no\nmeasurement, report that, never \"the suite covers nothing\": a contract means someone\nconfigured a page, only a watched run means a test went there.\n\nUsage:\n ia-qa-discover login Open a visible browser, log in by hand, keep the\n session (.ia-qa-discovery/session.json) for scan\n to reuse. The general answer to a login wall: it\n models nothing, so SSO, MFA, a consent screen or\n a magic link all work \u2014 you do them.\n Needs a terminal, refuses under CI. The file holds\n live cookies: gitignored, stays on this machine.\n Nothing to confirm afterwards: the window is\n watched and the session is saved the moment it\n actually opens the app. Already logged in with\n ia-qa-heal login? You do not need this at all \u2014\n scan picks that session up and says so.\n --wait <s> how long to watch (0 = press Enter)\n --url <path> page to open (default: your baseUrl)\n --session <f> where to write it\n Already have a storageState (a Playwright globalSetup\n writes one)? Skip this verb: point scan at it with\n --session <file> or \"session\" in config.json.\n ia-qa-discover scan [url] Crawl same-origin pages from <url> (or the saved\n baseUrl) and capture each page's structure.\n Writes .ia-qa-discovery/capture/, diffs against\n the previous run, appends history.jsonl.\n --depth <n> crawl link-depth (default 2)\n --max <n> page cap (default 60)\n --deep also open menus, tabs and dialogs one level\n down and capture the fields they reveal. Every\n non-GET request is blocked for the duration,\n so a click cannot mutate anything server-side.\n --deep-budget <n> max controls clicked per page (default 60)\n --no-sitemap do not read sitemap.xml / robots.txt\n --no-reveal do not open menus/dropdowns for hidden links\n --strict-host treat www./apex as different hosts\n --session <file> reuse an existing storageState (login) file\n --no-network skip API/network-call capture this run\n --network-threshold <n> shared-call promotion threshold 0-1 (default 0.6)\n --save persist this baseUrl to config.json\n --json machine-readable summary on stdout\n --report [file.html] branded ia-qa.com HTML dossier of the\n app (default ia-qa-discover-report.html)\n --open open that report in the browser\n ia-qa-discover coverage What your test suite does NOT test. Compares the\n pages this scan found against the pages your suite\n was OBSERVED visiting, ranks the gap by what each\n page takes as input, and writes coverage-map.json.\n Reads local files only \u2014 no browser, no network.\n Needs one watched run of your suite \u2014\n \"ia-qa-heal run\" or \"ia-qa-pal tour --suite\":\n without a watched run there is no measurement, and\n it says so instead of showing a number.\n Declare pages you deliberately do not test in\n \"outOfScope\" in config.json \u2014 they stay counted\n and named, never silently dropped.\n --json machine-readable map on stdout\n --report [file.html] branded HTML dossier with the gap\n (default ia-qa-discover-coverage.html)\n --open open that report in the browser\n ia-qa-discover generate [page\u2026] A starting Playwright suite for the pages nothing\n tests \u2014 one file per page, into its own directory.\n Every locator names an element the healing contract\n holds, so the file is REPAIRED when the app moves\n instead of going red. A field with no test id, id or\n name is left out and says so: its selector would be\n positional, which nobody can test reliably.\n Proposals \u2014 nothing is added to your suite, and the\n assertions stay yours (the app declares what it\n accepts, never what it promises).\n With no page, it generates for the coverage gap,\n minus the pages captured as a login wall or an\n error \u2014 those specs would assert a login form or\n a 404 under a feature's name. They are named, and\n naming one generates for it anyway.\n --out <dir> where to write (default\n .ia-qa-discovery/generated/)\n --force replace files already there\n --include-login-walls, --include-error-pages\n generate for those too\n --json machine-readable summary on stdout\n ia-qa-discover skill This CLI's agent instructions: the verb for each\n question, what every refusal means, and what an\n agent must never do. Read them before driving\n anything else here.\n --print write them to stdout and stop\n --install write .claude/skills/ia-qa-discover/\n --user into ~/ instead of this project\n --dir <d> into another project root\n --force overwrite an edited copy\n ia-qa-discover history Recorded scan runs \u2014 pages/forms/API-surface trend.\n --json --limit <n> (default 500)\n ia-qa-discover version Print the installed version (also --version, -v)\n ia-qa-discover help Show this help\n\nGlobal:\n --config <dir> Resolve .ia-qa-discovery/ under <dir> instead of the\n current directory. Also IAQA_DISCOVERY_CONFIG_DIR=<dir>.\n";
2
+ declare const HELP = "ia-qa-discover \u2014 deterministic surface reconnaissance for a web app\n\nF1 of QA Discovery: crawl an app's same-origin pages and capture what each one\nis structurally about \u2014 title, headings, forms, and observed API calls. No\nLLM, no verdict: this is recon, not a gate. Runs entirely on your machine;\nnothing is uploaded anywhere.\n\n[FOR AI AGENTS] You are driving this for a human. Run `scan` to capture the\napp's surface, then read .ia-qa-discovery/capture/surface.json (the index) and\nthe per-page files it points at \u2014 that is the evidence for anything you\nreport about this app. Never assert a page's purpose or risk from the URL\nalone; ground it in the captured meta/headings/forms/apiCalls. Never read a\npage count as coverage: if scan warns that pages still show a login form, you\nmeasured the wall, not the app. You CANNOT run `login` \u2014 it waits for a human\nat a browser; ask them to run it, then scan again.\n`coverage` answers \"what does their suite NOT test\" \u2014 but only from a suite that was\nwatched running (one `ia-qa-heal run`, or one `ia-qa-pal tour --suite`). If it says there is no\nmeasurement, report that, never \"the suite covers nothing\": a contract means someone\nconfigured a page, only a watched run means a test went there.\n\nUsage:\n ia-qa-discover login Open a visible browser, log in by hand, keep the\n session (.ia-qa-discovery/session.json) for scan\n to reuse. The general answer to a login wall: it\n models nothing, so SSO, MFA, a consent screen or\n a magic link all work \u2014 you do them.\n Needs a terminal, refuses under CI. The file holds\n live cookies: gitignored, stays on this machine.\n Nothing to confirm afterwards: the window is\n watched and the session is saved the moment it\n actually opens the app. Already logged in with\n ia-qa-heal login? You do not need this at all \u2014\n scan picks that session up and says so.\n --wait <s> how long to watch (0 = press Enter)\n --url <path> page to open (default: your baseUrl)\n --session <f> where to write it\n Already have a storageState (a Playwright globalSetup\n writes one)? Skip this verb: point scan at it with\n --session <file> or \"session\" in config.json.\n ia-qa-discover scan [url] Crawl same-origin pages from <url> (or the saved\n baseUrl) and capture each page's structure.\n Writes .ia-qa-discovery/capture/, diffs against\n the previous run, appends history.jsonl.\n --depth <n> crawl link-depth (default 2)\n --max <n> page cap (default 60)\n --deep also open menus, tabs and dialogs one level\n down and capture the fields they reveal. Every\n non-GET request is blocked for the duration,\n so a click cannot mutate anything server-side.\n --deep-budget <n> max controls clicked per page (default 60)\n --no-sitemap do not read sitemap.xml / robots.txt\n --no-reveal do not open menus/dropdowns for hidden links\n --strict-host treat www./apex as different hosts\n --session <file> reuse an existing storageState (login) file\n --no-network skip API/network-call capture this run\n --network-threshold <n> shared-call promotion threshold 0-1 (default 0.6)\n --save persist this baseUrl to config.json\n --json machine-readable summary on stdout\n --report [file.html] branded ia-qa.com HTML dossier of the\n app (default ia-qa-discover-report.html)\n --open open that report in the browser\n ia-qa-discover coverage What your test suite does NOT test. Compares the\n pages this scan found against the pages your suite\n was OBSERVED visiting, ranks the gap by what each\n page takes as input, and writes coverage-map.json.\n Reads local files only \u2014 no browser, no network.\n Needs one watched run of your suite \u2014\n \"ia-qa-heal run\" or \"ia-qa-pal tour --suite\":\n without a watched run there is no measurement, and\n it says so instead of showing a number.\n Declare pages you deliberately do not test in\n \"outOfScope\" in config.json \u2014 they stay counted\n and named, never silently dropped.\n --json machine-readable map on stdout\n --report [file.html] branded HTML dossier with the gap\n (default ia-qa-discover-coverage.html)\n --open open that report in the browser\n ia-qa-discover generate [page\u2026] A starting Playwright suite for the pages nothing\n tests \u2014 one file per page, into its own directory.\n Every locator names an element the healing contract\n holds, so the file is REPAIRED when the app moves\n instead of going red. A field with no test id, id or\n name is left out and says so: its selector would be\n positional, which nobody can test reliably.\n Proposals \u2014 nothing is added to your suite, and the\n assertions stay yours (the app declares what it\n accepts, never what it promises).\n With no page, it generates for the coverage gap,\n minus the pages captured as a login wall or an\n error \u2014 those specs would assert a login form or\n a 404 under a feature's name. They are named, and\n naming one generates for it anyway.\n --out <dir> where to write (default\n .ia-qa-discovery/generated/)\n --force replace files already there\n --include-login-walls, --include-error-pages\n generate for those too\n --json machine-readable summary on stdout\n ia-qa-discover scenarios [dir|file] Validated Gherkin scenarios in, proven Playwright tests\n out (default dir: scenarios/). Each step is bound to\n the ONE element Playwright counts for it on the live\n page \u2014 none or several is a question for you, never\n a guess. A test is \"proven\" when it passes twice in\n fresh browsers AND fails when what each check reads\n is altered on the page; one that stays green is\n reported blind. @draft scenarios are not run.\n Steps: I open / click / fill \u2026 with / select \u2026 in /\n choose / check / see / don't see / the URL contains\n (French: j'ouvre, je clique sur, je vois\u2026).\n Local: a browser on this machine, no model, nothing\n sent. One spec per feature, never overwritten\n without --force.\n --base-url <url> resolves \"I open \"/path\"\" (default:\n config.json baseUrl)\n --session <f> a storageState for an app behind a login\n (default: the one scan would use,\n ia-qa-heal login's included)\n --out <dir> where to write (default\n .ia-qa-discovery/generated/)\n --force replace a spec that differs\n --json machine-readable report on stdout\n ia-qa-discover skill This CLI's agent instructions: the verb for each\n question, what every refusal means, and what an\n agent must never do. Read them before driving\n anything else here.\n --print write them to stdout and stop\n --install write .claude/skills/ia-qa-discover/\n --user into ~/ instead of this project\n --dir <d> into another project root\n --force overwrite an edited copy\n ia-qa-discover history Recorded scan runs \u2014 pages/forms/API-surface trend.\n --json --limit <n> (default 500)\n ia-qa-discover version Print the installed version (also --version, -v)\n ia-qa-discover help Show this help\n\nGlobal:\n --config <dir> Resolve .ia-qa-discovery/ under <dir> instead of the\n current directory. Also IAQA_DISCOVERY_CONFIG_DIR=<dir>.\n";
3
3
  declare function verbHelp(command: string | undefined): string | null;
4
4
  declare function main(): Promise<void>;
5
5
  export { HELP, verbHelp, main };
package/dist/cli/index.js CHANGED
@@ -12,6 +12,7 @@ const history_1 = require("./history");
12
12
  const coverage_1 = require("./coverage");
13
13
  const generate_1 = require("./generate");
14
14
  const skill_1 = require("./skill");
15
+ const scenarios_1 = require("./scenarios");
15
16
  // dist/cli/ → package root; npm ships package.json in every tarball.
16
17
  const VERSION = require('../../package.json').version;
17
18
  const HELP = `ia-qa-discover — deterministic surface reconnaissance for a web app
@@ -112,7 +113,30 @@ Usage:
112
113
  --include-login-walls, --include-error-pages
113
114
  generate for those too
114
115
  --json machine-readable summary on stdout
115
- ia-qa-discover skill This CLI's agent instructions: the verb for each
116
+ ia-qa-discover scenarios [dir|file] Validated Gherkin scenarios in, proven Playwright tests
117
+ out (default dir: scenarios/). Each step is bound to
118
+ the ONE element Playwright counts for it on the live
119
+ page — none or several is a question for you, never
120
+ a guess. A test is "proven" when it passes twice in
121
+ fresh browsers AND fails when what each check reads
122
+ is altered on the page; one that stays green is
123
+ reported blind. @draft scenarios are not run.
124
+ Steps: I open / click / fill … with / select … in /
125
+ choose / check / see / don't see / the URL contains
126
+ (French: j'ouvre, je clique sur, je vois…).
127
+ Local: a browser on this machine, no model, nothing
128
+ sent. One spec per feature, never overwritten
129
+ without --force.
130
+ --base-url <url> resolves "I open "/path"" (default:
131
+ config.json baseUrl)
132
+ --session <f> a storageState for an app behind a login
133
+ (default: the one scan would use,
134
+ ia-qa-heal login's included)
135
+ --out <dir> where to write (default
136
+ .ia-qa-discovery/generated/)
137
+ --force replace a spec that differs
138
+ --json machine-readable report on stdout
139
+ ia-qa-discover skill This CLI's agent instructions: the verb for each
116
140
  question, what every refusal means, and what an
117
141
  agent must never do. Read them before driving
118
142
  anything else here.
@@ -199,6 +223,9 @@ async function main() {
199
223
  case 'generate':
200
224
  await (0, generate_1.runGenerate)(rest);
201
225
  break;
226
+ case 'scenarios':
227
+ await (0, scenarios_1.runScenarios)(rest);
228
+ break;
202
229
  case 'history':
203
230
  await (0, history_1.runHistory)(rest);
204
231
  break;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";;;;AA8Oe,4BAAQ;AAAE,oBAAI;AA7O7B,sCAAuC;AACvC,iCAAyD;AACzD,iCAAiC;AACjC,mCAAmC;AACnC,uCAAuC;AACvC,yCAAyC;AACzC,yCAAyC;AACzC,mCAAmC;AAEnC,qEAAqE;AACrE,MAAM,OAAO,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC,OAAiB,CAAC;AAEhE,MAAM,IAAI,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmHZ,CAAC;AA8GO,oBAAI;AA5Gb,SAAS,gBAAgB,CAAC,IAAc;IACtC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,GAAuB,CAAC;IAC5B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC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C,IAAI,CAAC,CAAC;YACvB,MAAM;QACR,KAAK,OAAO;YACV,MAAM,IAAA,gBAAQ,EAAC,IAAI,CAAC,CAAC;YACrB,MAAM;QACR,KAAK,SAAS,CAAC;QACf,KAAK,WAAW,CAAC;QACjB,KAAK,IAAI;YACP,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACrB,MAAM;QACR,KAAK,MAAM,CAAC;QACZ,KAAK,QAAQ,CAAC;QACd,KAAK,IAAI,CAAC;QACV,KAAK,SAAS;YACZ,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAClB,MAAM;QACR;YACE,OAAO,CAAC,KAAK,CAAC,oBAAoB,OAAO,SAAS,IAAI,EAAE,CAAC,CAAC;YAC1D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;IAAE,GAAG,EAAE,CAAC;AAEnC,SAAS,GAAG;IACV,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QAC5B,OAAO,CAAC,KAAK,CAAC,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACzE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function runScenarios(args: string[]): Promise<void>;
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.runScenarios = runScenarios;
37
+ const path = __importStar(require("path"));
38
+ const config_1 = require("../config");
39
+ const run_1 = require("../scenarios/run");
40
+ const generate_1 = require("./generate");
41
+ /**
42
+ * `ia-qa-discover scenarios [dir|file]` — validated Gherkin scenarios in, proven Playwright tests out.
43
+ *
44
+ * The person decides WHAT is tested and what the page should show; this verb decides HOW:
45
+ * which element each step means (counted on the live page), the code, and whether the test
46
+ * can actually fail. A scenario tagged `@draft` is not validated and is not run.
47
+ *
48
+ * Every scenario ends in exactly one column of the report, including the ones nothing could
49
+ * be written for — a scenario that silently produced no test would read as covered.
50
+ */
51
+ const TITLE = {
52
+ proven: '✅ Proven — green twice, and red when what it checks is altered',
53
+ blind: '🙈 Blind — runs green, but a check stays green when its target changes',
54
+ unverified: '❔ Not proven — the page undid the alteration, so whether the check can fail is unknown',
55
+ flaky: '🎲 Flaky — passed, then failed on a replay',
56
+ failing: '❌ Fails on the app as it is now — either the app or the scenario is wrong, and only you can say which',
57
+ 'needs-input': '✋ Needs you — a step the page cannot answer on its own',
58
+ 'not-run': '⏸ Not run',
59
+ };
60
+ function takeValue(args, flag) {
61
+ const at = args.indexOf(flag);
62
+ if (at === -1)
63
+ return { rest: args };
64
+ const value = args[at + 1];
65
+ if (value === undefined || value.startsWith('-'))
66
+ throw new Error(`${flag} needs a value.`);
67
+ return { value, rest: [...args.slice(0, at), ...args.slice(at + 2)] };
68
+ }
69
+ async function runScenarios(args) {
70
+ const json = args.includes('--json');
71
+ const force = args.includes('--force');
72
+ let rest = args.filter((a) => a !== '--json' && a !== '--force');
73
+ const base = takeValue(rest, '--base-url');
74
+ const out = takeValue(base.rest, '--out');
75
+ const session = takeValue(out.rest, '--session');
76
+ rest = session.rest;
77
+ const outDir = out.value ? path.resolve(process.cwd(), out.value) : (0, generate_1.generatedDir)();
78
+ const named = rest.filter((a) => !a.startsWith('-'));
79
+ const source = path.resolve(process.cwd(), named[0] ?? path.join((0, config_1.baseDir)(), 'scenarios'));
80
+ const log = json ? (s) => console.error(s) : (s) => console.log(s);
81
+ log(`\n🧪 Scenarios from ${path.relative(process.cwd(), source) || source}`);
82
+ log(` Each one is run in a real browser on this machine; nothing is sent anywhere else.`);
83
+ const run = await (0, run_1.runScenarioSuite)({ source, outDir, baseUrl: base.value, session: session.value, force, onProgress: log });
84
+ if (!run.ran) {
85
+ process.exitCode = 2;
86
+ if (json)
87
+ console.log(JSON.stringify(run, null, 2));
88
+ else
89
+ console.log(`\nℹ️ ${run.reason}\n\n${(run.help ?? []).map((h) => ` ${h}`).join('\n')}`);
90
+ return;
91
+ }
92
+ if (run.session)
93
+ log(` Session: ${run.session}${run.sessionSource === 'healing' ? ' (saved by ia-qa-heal login)' : ''}`);
94
+ const reach = (0, generate_1.healingReach)(outDir);
95
+ if (json) {
96
+ console.log(JSON.stringify({ ...run, healingCanRepair: reach.covered }, null, 2));
97
+ return;
98
+ }
99
+ printReport(run.features, reach);
100
+ }
101
+ function printReport(reports, reach) {
102
+ const all = reports.flatMap((r) => r.results.map((res) => ({ file: r.file, res })));
103
+ const counts = run_1.STATUS_ORDER.map((s) => [s, all.filter((a) => a.res.status === s).length]).filter(([, n]) => n > 0);
104
+ console.log(`\n ${counts.map(([s, n]) => `${n} ${s}`).join(' · ')}`);
105
+ for (const status of run_1.STATUS_ORDER) {
106
+ const rows = all.filter((a) => a.res.status === status);
107
+ if (rows.length === 0)
108
+ continue;
109
+ console.log(`\n${TITLE[status]}`);
110
+ for (const { file, res } of rows) {
111
+ console.log(` · ${res.name} (${file}:${res.line})`);
112
+ if (res.step)
113
+ console.log(` step ${res.step.line}: ${res.step.text}`);
114
+ if (res.reason && status !== 'proven')
115
+ console.log(` ${res.reason}`);
116
+ for (const b of res.blind ?? [])
117
+ console.log(` line ${b.line} "${b.text}": ${b.why}`);
118
+ if (res.candidates?.length)
119
+ console.log(` the page shows: ${res.candidates.join(', ')}`);
120
+ for (const a of res.also ?? [])
121
+ console.log(` and ${a}`);
122
+ }
123
+ }
124
+ const specs = reports.filter((r) => r.spec);
125
+ if (specs.length > 0) {
126
+ console.log('');
127
+ for (const r of specs) {
128
+ const s = r.spec;
129
+ const what = s.state === 'written' ? 'written' : s.state === 'unchanged' ? 'unchanged' : 'left untouched (it differs; --force to replace)';
130
+ console.log(` 📄 ${s.file} — ${what}`);
131
+ }
132
+ if (!reach.covered) {
133
+ console.log(`\n ⚠ ia-qa-heal cannot see these files, so it will not repair them when the app moves.\n` +
134
+ ` ${reach.why}\n` +
135
+ ` Write them where your suite lives (--out <dir under your testPaths>), or add this\n` +
136
+ ` directory to "testPaths" in .ia-qa/config.json and run: ia-qa-heal ingest`);
137
+ }
138
+ }
139
+ console.log(`\n These tests are proposals: nothing was added to your suite. Proven means the test can\n` +
140
+ ` fail when what it checks changes; it does not mean the scenario asks the right question.`);
141
+ }
142
+ //# sourceMappingURL=scenarios.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scenarios.js","sourceRoot":"","sources":["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AC,GAAG,CAAC,SAAS,CAAC,CAAC,IAAI,MAAM,IAAI,EAAE,CAAC,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACnB,OAAO,CAAC,GAAG,CACT,4FAA4F;gBAC1F,QAAQ,KAAK,CAAC,GAAG,IAAI;gBACrB,0FAA0F;gBAC1F,gFAAgF,CACnF,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,CACT,8FAA8F;QAC5F,6FAA6F,CAChG,CAAC;AACJ,CAAC"}
@@ -48,6 +48,9 @@ declare const TOOLS: ({
48
48
  model?: undefined;
49
49
  api_key_env?: undefined;
50
50
  all?: undefined;
51
+ scenarios?: undefined;
52
+ out?: undefined;
53
+ force?: undefined;
51
54
  limit?: undefined;
52
55
  };
53
56
  };
@@ -98,6 +101,9 @@ declare const TOOLS: ({
98
101
  network?: undefined;
99
102
  network_threshold?: undefined;
100
103
  all?: undefined;
104
+ scenarios?: undefined;
105
+ out?: undefined;
106
+ force?: undefined;
101
107
  limit?: undefined;
102
108
  };
103
109
  };
@@ -151,6 +157,9 @@ declare const TOOLS: ({
151
157
  session?: undefined;
152
158
  network?: undefined;
153
159
  network_threshold?: undefined;
160
+ scenarios?: undefined;
161
+ out?: undefined;
162
+ force?: undefined;
154
163
  limit?: undefined;
155
164
  };
156
165
  };
@@ -182,6 +191,55 @@ declare const TOOLS: ({
182
191
  model?: undefined;
183
192
  api_key_env?: undefined;
184
193
  all?: undefined;
194
+ scenarios?: undefined;
195
+ out?: undefined;
196
+ force?: undefined;
197
+ limit?: undefined;
198
+ };
199
+ };
200
+ } | {
201
+ name: string;
202
+ description: string;
203
+ inputSchema: {
204
+ type: string;
205
+ properties: {
206
+ scenarios: {
207
+ type: string;
208
+ description: string;
209
+ };
210
+ base_url: {
211
+ type: string;
212
+ description: string;
213
+ };
214
+ session: {
215
+ type: string;
216
+ description: string;
217
+ };
218
+ out: {
219
+ type: string;
220
+ description: string;
221
+ };
222
+ force: {
223
+ type: string;
224
+ description: string;
225
+ };
226
+ out_dir: {
227
+ type: string;
228
+ description: string;
229
+ };
230
+ url?: undefined;
231
+ max_depth?: undefined;
232
+ max_pages?: undefined;
233
+ reveal?: undefined;
234
+ network?: undefined;
235
+ network_threshold?: undefined;
236
+ write?: undefined;
237
+ page?: undefined;
238
+ provider?: undefined;
239
+ dry_run?: undefined;
240
+ model?: undefined;
241
+ api_key_env?: undefined;
242
+ all?: undefined;
185
243
  limit?: undefined;
186
244
  };
187
245
  };
@@ -211,6 +269,9 @@ declare const TOOLS: ({
211
269
  model?: undefined;
212
270
  api_key_env?: undefined;
213
271
  all?: undefined;
272
+ scenarios?: undefined;
273
+ out?: undefined;
274
+ force?: undefined;
214
275
  };
215
276
  };
216
277
  })[];
@@ -51,6 +51,8 @@ const plan_1 = require("../ai/plan");
51
51
  const overviewFile_1 = require("../overviewFile");
52
52
  const taxonomy_1 = require("../taxonomy");
53
53
  const sandbox_1 = require("./sandbox");
54
+ const run_1 = require("../scenarios/run");
55
+ const generate_1 = require("../cli/generate");
54
56
  /**
55
57
  * @ia-qa/qa-discovery — local stdio MCP server.
56
58
  *
@@ -139,6 +141,21 @@ const TOOLS = [
139
141
  },
140
142
  },
141
143
  },
144
+ {
145
+ name: 'prove_scenarios',
146
+ description: "Turn the human's validated Gherkin scenarios (scenarios/*.feature by default) into Playwright tests, and prove each test can FAIL. Local headless browser on this machine; no model, nothing sent anywhere. Each step is bound on the live page to the ONE element Playwright counts for it (getByRole / getByLabel / getByText); none or several is returned under `needs-input` with what the page shows in `candidates` — relay that to the human, never pick one yourself. A test is `proven` only when it passes twice in fresh browsers AND each of its checks fails when what it reads is altered on the page. Every scenario lands in exactly one status, and you must relay all of them, not only `proven`: `blind` (runs green but a check stays green when its target changes — it is NOT a test, never present it as coverage), `unverified` (the page undid the alteration; unknown), `flaky`, `failing` (the app as it is does not do what the scenario says: the app OR the scenario is wrong, and only the human can say which — never edit the scenario's expected text to what the page shows, that turns a bug report into a passing test), `needs-input`, `not-run`. Vocabulary (English or French): I open \"<url>\", I click \"<name>\" [button|link|tab], I fill \"<label>\" with \"<value>\", I select \"<option>\" in \"<label>\", I choose \"<radio>\", I check / uncheck \"<label>\", I see \"<text>\", I don't see \"<text>\", the URL contains \"<text>\". YOU MAY DRAFT scenarios for the human, but every one you write MUST carry the tag @draft — a @draft scenario is never run, and removing the tag is the human's validation, never yours. Scenarios opening another origin than the base URL are refused from this door. Writes one spec per feature into .ia-qa-discovery/generated/ (or `out`), never replacing a file that differs unless `force`. An app behind a login uses the session scan_app would use (one saved by ia-qa-heal login included); this is not a gate.",
147
+ inputSchema: {
148
+ type: 'object',
149
+ properties: {
150
+ scenarios: { type: 'string', description: 'A .feature file or a folder of them, inside the project. Default: scenarios/.' },
151
+ base_url: { type: 'string', description: 'Resolves I open "/path". Default: the baseUrl in .ia-qa-discovery/config.json. Must be same-origin with it when both exist.' },
152
+ session: { type: 'string', description: 'Path to a Playwright storageState inside the project. Default: the one scan_app would use.' },
153
+ out: { type: 'string', description: 'Folder to write the specs into, inside the project. Default .ia-qa-discovery/generated/.' },
154
+ force: { type: 'boolean', description: 'Replace a spec that differs from this run. Default false.' },
155
+ out_dir: { type: 'string', description: 'Resolve .ia-qa-discovery/ under this directory instead of the current one.' },
156
+ },
157
+ },
158
+ },
142
159
  {
143
160
  name: 'discovery_history',
144
161
  description: 'Read-only. The recon trend no single scan can reconstruct — pages/forms/API-surface over time, what changed run over run. Reads .ia-qa-discovery/history.jsonl, written by every scan_app call that persists.',
@@ -413,6 +430,35 @@ async function callTool(name, args) {
413
430
  (0, config_1.setBaseDir)(null);
414
431
  }
415
432
  }
433
+ if (name === 'prove_scenarios') {
434
+ const outDir = args?.out_dir;
435
+ if (outDir)
436
+ (0, config_1.setBaseDir)((0, sandbox_1.assertInsideProject)(outDir, 'out_dir'));
437
+ try {
438
+ const root = (0, config_1.baseDir)();
439
+ const source = (0, sandbox_1.assertInsideProject)(args?.scenarios ?? 'scenarios', 'scenarios', root);
440
+ const out = args?.out ? (0, sandbox_1.assertInsideProject)(args.out, 'out', root) : path.join(root, config_1.CONFIG_DIR, generate_1.GENERATED_DIRNAME);
441
+ if (args?.session)
442
+ (0, sandbox_1.assertInsideProject)(args.session, 'session', root);
443
+ const configured = (0, config_1.configExists)() ? (0, config_1.loadConfig)().baseUrl : undefined;
444
+ if (args?.base_url)
445
+ (0, sandbox_1.assertUrlAllowed)(args.base_url, configured);
446
+ const run = await (0, run_1.runScenarioSuite)({
447
+ source,
448
+ outDir: out,
449
+ baseUrl: args?.base_url,
450
+ session: args?.session ? path.resolve(root, args.session) : undefined,
451
+ force: args?.force === true,
452
+ sameOriginOnly: true,
453
+ onProgress: (line) => process.stderr.write(line + '\n'),
454
+ });
455
+ return JSON.stringify({ ...run, healingCanRepair: (0, generate_1.healingReach)(out, root).covered }, null, 2);
456
+ }
457
+ finally {
458
+ if (outDir)
459
+ (0, config_1.setBaseDir)(null);
460
+ }
461
+ }
416
462
  if (name === 'discovery_history') {
417
463
  const entries = (0, history_1.readHistory)(typeof args?.limit === 'number' ? args.limit : undefined);
418
464
  return JSON.stringify(entries, null, 2);