@monkeytestai/monkeytester 0.6.1 → 0.7.0-beta.2

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 (117) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +5 -3
  3. package/dist/checks/axe.d.ts +24 -0
  4. package/dist/checks/axe.d.ts.map +1 -0
  5. package/dist/checks/axe.js +57 -0
  6. package/dist/checks/axe.js.map +1 -0
  7. package/dist/checks/console.d.ts +17 -0
  8. package/dist/checks/console.d.ts.map +1 -0
  9. package/dist/checks/console.js +32 -0
  10. package/dist/checks/console.js.map +1 -0
  11. package/dist/checks/execute.d.ts +34 -0
  12. package/dist/checks/execute.d.ts.map +1 -0
  13. package/dist/checks/execute.js +424 -0
  14. package/dist/checks/execute.js.map +1 -0
  15. package/dist/checks/http.d.ts +27 -0
  16. package/dist/checks/http.d.ts.map +1 -0
  17. package/dist/checks/http.js +90 -0
  18. package/dist/checks/http.js.map +1 -0
  19. package/dist/checks/meta.d.ts +23 -0
  20. package/dist/checks/meta.d.ts.map +1 -0
  21. package/dist/checks/meta.js +39 -0
  22. package/dist/checks/meta.js.map +1 -0
  23. package/dist/checks/mobile.d.ts +30 -0
  24. package/dist/checks/mobile.d.ts.map +1 -0
  25. package/dist/checks/mobile.js +61 -0
  26. package/dist/checks/mobile.js.map +1 -0
  27. package/dist/checks/noise.d.ts +10 -0
  28. package/dist/checks/noise.d.ts.map +1 -0
  29. package/dist/checks/noise.js +53 -0
  30. package/dist/checks/noise.js.map +1 -0
  31. package/dist/checks/plan.d.ts +35 -0
  32. package/dist/checks/plan.d.ts.map +1 -0
  33. package/dist/checks/plan.js +108 -0
  34. package/dist/checks/plan.js.map +1 -0
  35. package/dist/cli.js +64 -26
  36. package/dist/cli.js.map +1 -1
  37. package/dist/depth.d.ts +44 -1
  38. package/dist/depth.d.ts.map +1 -1
  39. package/dist/depth.js +38 -3
  40. package/dist/depth.js.map +1 -1
  41. package/dist/explorer/index.d.ts.map +1 -1
  42. package/dist/explorer/index.js +122 -16
  43. package/dist/explorer/index.js.map +1 -1
  44. package/dist/explorer/queue.d.ts +18 -0
  45. package/dist/explorer/queue.d.ts.map +1 -1
  46. package/dist/explorer/queue.js +77 -6
  47. package/dist/explorer/queue.js.map +1 -1
  48. package/dist/index.d.ts +8 -3
  49. package/dist/index.d.ts.map +1 -1
  50. package/dist/index.js +5 -2
  51. package/dist/index.js.map +1 -1
  52. package/dist/llm/prices.d.ts +17 -0
  53. package/dist/llm/prices.d.ts.map +1 -0
  54. package/dist/llm/prices.js +41 -0
  55. package/dist/llm/prices.js.map +1 -0
  56. package/dist/monkey.d.ts +6 -0
  57. package/dist/monkey.d.ts.map +1 -1
  58. package/dist/monkey.js +29 -10
  59. package/dist/monkey.js.map +1 -1
  60. package/dist/outcome.d.ts +10 -0
  61. package/dist/outcome.d.ts.map +1 -1
  62. package/dist/outcome.js +44 -8
  63. package/dist/outcome.js.map +1 -1
  64. package/dist/planner/authNegative.d.ts +31 -0
  65. package/dist/planner/authNegative.d.ts.map +1 -0
  66. package/dist/planner/authNegative.js +240 -0
  67. package/dist/planner/authNegative.js.map +1 -0
  68. package/dist/planner/dedupe.d.ts +16 -0
  69. package/dist/planner/dedupe.d.ts.map +1 -0
  70. package/dist/planner/dedupe.js +94 -0
  71. package/dist/planner/dedupe.js.map +1 -0
  72. package/dist/planner/focus.d.ts.map +1 -1
  73. package/dist/planner/focus.js +16 -5
  74. package/dist/planner/focus.js.map +1 -1
  75. package/dist/planner/forms.d.ts.map +1 -1
  76. package/dist/planner/forms.js +3 -1
  77. package/dist/planner/forms.js.map +1 -1
  78. package/dist/planner/index.d.ts +13 -2
  79. package/dist/planner/index.d.ts.map +1 -1
  80. package/dist/planner/index.js +86 -12
  81. package/dist/planner/index.js.map +1 -1
  82. package/dist/planner/inventory.d.ts +6 -0
  83. package/dist/planner/inventory.d.ts.map +1 -1
  84. package/dist/planner/inventory.js +23 -2
  85. package/dist/planner/inventory.js.map +1 -1
  86. package/dist/planner/verdict.d.ts.map +1 -1
  87. package/dist/planner/verdict.js +2 -0
  88. package/dist/planner/verdict.js.map +1 -1
  89. package/dist/runner/actions.d.ts +8 -2
  90. package/dist/runner/actions.d.ts.map +1 -1
  91. package/dist/runner/actions.js +14 -5
  92. package/dist/runner/actions.js.map +1 -1
  93. package/dist/runner/authNegative.d.ts +33 -0
  94. package/dist/runner/authNegative.d.ts.map +1 -0
  95. package/dist/runner/authNegative.js +291 -0
  96. package/dist/runner/authNegative.js.map +1 -0
  97. package/dist/runner/index.d.ts +11 -0
  98. package/dist/runner/index.d.ts.map +1 -1
  99. package/dist/runner/index.js +137 -1
  100. package/dist/runner/index.js.map +1 -1
  101. package/dist/runner/replay.d.ts.map +1 -1
  102. package/dist/runner/replay.js +52 -14
  103. package/dist/runner/replay.js.map +1 -1
  104. package/dist/trace/serialize.d.ts.map +1 -1
  105. package/dist/trace/serialize.js +1 -0
  106. package/dist/trace/serialize.js.map +1 -1
  107. package/dist/triager/index.d.ts +5 -0
  108. package/dist/triager/index.d.ts.map +1 -1
  109. package/dist/triager/index.js +14 -4
  110. package/dist/triager/index.js.map +1 -1
  111. package/dist/types.d.ts +95 -6
  112. package/dist/types.d.ts.map +1 -1
  113. package/dist/version.d.ts +11 -0
  114. package/dist/version.d.ts.map +1 -0
  115. package/dist/version.js +20 -0
  116. package/dist/version.js.map +1 -0
  117. package/package.json +2 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,40 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.0-beta.2] — 2026-11-01
11
+
12
+ ### Added
13
+
14
+ - Deterministic page checks in `src/checks/`, with no model call. One engine flow per check, reserved id `check-*`, kind `accessibility` or `visual`, and one step per crawled page. The five checks are console errors, same-site failed requests and broken links (about 20 link probes), axe-core WCAG A/AA, mobile overflow and tap targets at 375px, and title / description / lang / viewport / h1. They sit outside the LLM flow budget and are not dropped as phantom flows. Serious or critical axe violations are bugs. Missing `autocomplete` on a login field is minor. Title and viewport gaps are minor. Description, lang, and h1 count are info. Console noise from extensions, third parties, and `isOwnAutomationBug` is ignored. Steps record `tool: 'check'`. Replay re-runs a `check` step, or skips it when the check id is missing.
15
+ - `BASIC_PRESET` from `depth.ts`: 6 pages, 5 LLM flows, engine caps of 5 checks and 6 auth-negative flows, 10s step timeout, 25s flow timeout, 12s page timeout, and a 120s total budget. Past that budget, remaining page checks are skipped instead of failing the run as a timeout. `--depth basic` uses these numbers.
16
+ - The planner asks for a success check and an error or edge check on each form journey. When the plan is thinner than 5 flows and the cap allows it, it asks once more, still only against crawled pages and controls. Quick pass may use a non-submit auth control such as Sign up or Forgot password. Engine flows win when an LLM flow repeats them.
17
+ - `--planner-model <id>` and `MonkeyConfig.plannerModel`. Per-page summaries stay on the cheap model (`gpt-4o-mini` for OpenAI). The runner model is unchanged.
18
+ - `scripts/bakeoff.ts` compares planner models. Each run writes JSON (case count, real bugs, invented flows, false-positive candidates, planner latency, wall time, tokens, and USD) and the process prints a table. Prices live in `MODEL_PRICES`.
19
+
20
+ ### Changed
21
+
22
+ - Quick pass plans 5 LLM flows instead of 4. `severityIfFails` is copied onto the flow result so triage uses it. A step may set `severity` when a check finding is minor.
23
+
24
+ ## [0.7.0-beta.1] — 2026-10-31
25
+
26
+ ### Added
27
+
28
+ - Auth-negative checks for a crawled password field. Reserved flow ids `auth-neg-*`, kind `edge_case`. They do not use the planner flow budget and they are not removed when a model flow names a control the page does not have. The cases are empty submit, invalid email, one wrong-password attempt per run (`monkeytest+<rand>@example.invalid`), password visibility (a missing toggle is info, not a bug), a forgot-password link, and a sign-up link. Sign-up and reset forms are not submitted. Captcha, phone, and payment fields are not handled. The runner fills the scripted values and uses at most one model fallback step per flow.
29
+ - Login-only runs set `outcome_reason` to `login_required` when `public_screens` is `0` and at least one page was crawled, including when `outcome` is `clean` or `bugs_found`. `outcome_detail` says deeper journeys need an account. `public_screens` is the number of crawled pages that are not auth-gated.
30
+ - `ENGINE_VERSION` on the package entry, read from `package.json`. `RunResult.engine_version` is that string (for example `0.7.0-beta.1`).
31
+ - Reserved, unset signup fields for a later inbox provider: `signup_attempted?`, `signup_verified?`, `signup_status?` (`verified` | `unverified` | `not_tested` | `blocked`), `signup_reason?` (`no_inbox` | `captcha` | `phone` | `payment` | `timeout` | `cap_reached` | `no_signup_form`).
32
+
33
+ ### Fixed
34
+
35
+ - The crawl follows links on an auth-gated page. Auth URLs have a separate budget of 3, so `/?mode=signup` and `/forgot-password` are visited. Auth is detected from a password field or a path/query token (`login`, `signin`, `signup`, `register`, `forgot`, `reset`, `otp`, `auth`, including `?mode=` and hyphen or underscore forms). The model flag is only a secondary signal.
36
+ - The crawl seeds the site root, the start URL without its query string, and same-origin URLs from `sitemap.xml` and `robots.txt` when those files exist, within the page cap. `[role=link]` and same-origin `[data-href]` are followed.
37
+ - Flows that click the same control on the same page collapse to one. Clicks that leave the site, including "Continue with Google", are dropped. The planner is told to use only crawled pages and controls.
38
+ - A login-only site no longer ends `inconclusive` just because the only model journey was `auth_required`. The auth checks above decide `clean` or `bugs_found`.
39
+
40
+ ### Changed
41
+
42
+ - npm prerelease tags `v*.*.*-beta.*` publish under the dist-tag `next`. Stable tags stay on `latest`.
43
+
10
44
  ## [0.6.1] — 2026-10-31
11
45
 
12
46
  ### Fixed
@@ -214,6 +248,7 @@ First public npm release.
214
248
  - `EventBus` for live activity streams
215
249
  - OpenAI and Gemini LLM backends
216
250
 
251
+ [0.7.0-beta.1]: https://github.com/monkeytestai/monkeytester/releases/tag/v0.7.0-beta.1
217
252
  [0.6.1]: https://github.com/monkeytestai/monkeytester/releases/tag/v0.6.1
218
253
  [0.6.0]: https://github.com/monkeytestai/monkeytester/releases/tag/v0.6.0
219
254
  [0.5.1]: https://github.com/monkeytestai/monkeytester/releases/tag/v0.5.1
package/README.md CHANGED
@@ -86,15 +86,17 @@ export GEMINI_API_KEY="paste-your-key"
86
86
  npx monkeytest run https://example.com --depth basic
87
87
  ```
88
88
 
89
- `--depth basic` is the free **Quick pass**: at most 6 pages and 4 flows, biased toward forms, search, and primary buttons. `standard` and `deep` are the broader presets. `--max` and `--flows` still override the preset.
89
+ `--depth basic` is the free **Quick pass**: 6 pages, 5 LLM flows, and deterministic page checks outside that budget, with a 120 second cap. `standard` and `deep` are the broader presets. `--max` and `--flows` still override the page and flow caps. Import `BASIC_PRESET` from the package for the same numbers.
90
90
 
91
91
  A finished run includes:
92
92
 
93
93
  | Field | Values |
94
94
  | ----- | ------ |
95
95
  | `outcome` | `bugs_found`, `clean`, `inconclusive`, `could_not_test` |
96
- | `outcome_reason` | Short code such as `automation_error`, `all_flows_skipped`, `site_unreachable`, `login_required` (only when a login wall was seen) |
97
- | `outcome_detail` | A sentence that matches the confirmed bug count, plus a next step |
96
+ | `outcome_reason` | Short code such as `automation_error`, `all_flows_skipped`, `site_unreachable`, `login_required`. `login_required` is also set on `clean` and `bugs_found` when `public_screens` is `0` |
97
+ | `outcome_detail` | A sentence that matches the confirmed bug count, plus a next step. On a login-only site it says deeper journeys need an account |
98
+ | `public_screens` | Number of crawled pages that are not auth-gated. `0` is a login-only site |
99
+ | `engine_version` | Engine that produced the run, for example `0.7.0-beta.1` (`ENGINE_VERSION`) |
98
100
 
99
101
  `could_not_test` means nothing was tested. Playwright errors from the runner are `inconclusive`, not bugs. Map these three fields straight onto `audit_run`.
100
102
 
@@ -0,0 +1,24 @@
1
+ /**
2
+ * axe-core WCAG A/AA.
3
+ *
4
+ * Serious and critical violations fail the step. Moderate and minor hits
5
+ * are info. Missing `autocomplete` on a login field is minor even when axe
6
+ * ranks that rule as serious.
7
+ */
8
+ import type { Page } from 'playwright';
9
+ import type { Result } from 'axe-core';
10
+ export interface AxeJudgement {
11
+ serious: {
12
+ id: string;
13
+ impact: string;
14
+ help: string;
15
+ }[];
16
+ /** Missing autocomplete on login fields. Minor, not serious. */
17
+ autocomplete: string[];
18
+ info: string[];
19
+ }
20
+ export declare function splitAxeViolations(violations: Result[]): AxeJudgement;
21
+ export declare function runAxe(page: Page): Promise<AxeJudgement>;
22
+ /** Login fields with no autocomplete attribute. Axe does not always flag the absence. */
23
+ export declare function readMissingLoginAutocomplete(): string[];
24
+ //# sourceMappingURL=axe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axe.d.ts","sourceRoot":"","sources":["../../src/checks/axe.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIvC,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,gEAAgE;IAChE,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAID,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,EAAE,GAAG,YAAY,CAyBrE;AAED,wBAAsB,MAAM,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO,CAAC,YAAY,CAAC,CAG9D;AAED,yFAAyF;AACzF,wBAAgB,4BAA4B,IAAI,MAAM,EAAE,CAavD"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * axe-core WCAG A/AA.
3
+ *
4
+ * Serious and critical violations fail the step. Moderate and minor hits
5
+ * are info. Missing `autocomplete` on a login field is minor even when axe
6
+ * ranks that rule as serious.
7
+ */
8
+ import AxeBuilder from '@axe-core/playwright';
9
+ const TAGS = ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'];
10
+ const LOGIN_FIELD = /type=["']?(?:password|email)|name=["']?(?:email|user|login|password)|autocomplete=["']?(?:username|email|current-password|new-password)/i;
11
+ export function splitAxeViolations(violations) {
12
+ const serious = [];
13
+ const autocomplete = [];
14
+ const info = [];
15
+ for (const violation of violations) {
16
+ const impact = violation.impact || 'minor';
17
+ const loginAutocomplete = violation.id === 'autocomplete-valid' && violation.nodes.some(node => LOGIN_FIELD.test(`${node.html} ${(node.target || []).join(' ')}`));
18
+ if (loginAutocomplete) {
19
+ autocomplete.push(violation.help || 'Login fields are missing autocomplete.');
20
+ continue;
21
+ }
22
+ if (impact === 'serious' || impact === 'critical') {
23
+ serious.push({
24
+ id: violation.id,
25
+ impact,
26
+ help: violation.help || violation.description || violation.id,
27
+ });
28
+ }
29
+ else {
30
+ info.push(`${violation.id}: ${violation.help || violation.description || impact}`);
31
+ }
32
+ }
33
+ return { serious, autocomplete, info };
34
+ }
35
+ export async function runAxe(page) {
36
+ const results = await new AxeBuilder({ page }).withTags(TAGS).analyze();
37
+ return splitAxeViolations(results.violations);
38
+ }
39
+ /** Login fields with no autocomplete attribute. Axe does not always flag the absence. */
40
+ export function readMissingLoginAutocomplete() {
41
+ const fields = [];
42
+ for (const node of Array.from(document.querySelectorAll('input'))) {
43
+ const el = node;
44
+ if (el.disabled || el.type === 'hidden' || el.type === 'submit' || el.type === 'button')
45
+ continue;
46
+ const type = (el.type || '').toLowerCase();
47
+ const name = `${el.getAttribute('name') || ''} ${el.id || ''}`.toLowerCase();
48
+ const login = type === 'password' || type === 'email' || /user|login|email|password/.test(name);
49
+ if (!login)
50
+ continue;
51
+ if ((el.getAttribute('autocomplete') || '').trim())
52
+ continue;
53
+ fields.push(el.getAttribute('name') || el.id || type);
54
+ }
55
+ return fields;
56
+ }
57
+ //# sourceMappingURL=axe.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"axe.js","sourceRoot":"","sources":["../../src/checks/axe.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,UAAU,MAAM,sBAAsB,CAAC;AAI9C,MAAM,IAAI,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AAS1D,MAAM,WAA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AC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * First-party console errors and uncaught exceptions on load.
3
+ */
4
+ import type { ConsoleErrorEvidence } from '../types.js';
5
+ export interface ConsoleHit {
6
+ message: string;
7
+ sourceUrl?: string;
8
+ /** `pageerror` is an uncaught exception. `console` is console.error. */
9
+ kind: 'pageerror' | 'console';
10
+ }
11
+ export interface ConsoleJudgement {
12
+ bugs: ConsoleHit[];
13
+ ignored: number;
14
+ }
15
+ export declare function judgeConsole(hits: ConsoleHit[], pageUrl: string): ConsoleJudgement;
16
+ export declare function consoleEvidence(bugs: ConsoleHit[]): ConsoleErrorEvidence[];
17
+ //# sourceMappingURL=console.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../src/checks/console.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAGxD,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,IAAI,EAAE,WAAW,GAAG,SAAS,CAAC;CAC/B;AAED,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAiBlF;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,GAAG,oBAAoB,EAAE,CAM1E"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * First-party console errors and uncaught exceptions on load.
3
+ */
4
+ import { isIgnoredConsoleMessage } from './noise.js';
5
+ export function judgeConsole(hits, pageUrl) {
6
+ const bugs = [];
7
+ const seen = new Set();
8
+ let ignored = 0;
9
+ for (const hit of hits) {
10
+ const message = hit.message.replace(/\s+/g, ' ').trim();
11
+ if (!message)
12
+ continue;
13
+ if (isIgnoredConsoleMessage(message, hit.sourceUrl, pageUrl)) {
14
+ ignored += 1;
15
+ continue;
16
+ }
17
+ const key = message.slice(0, 180);
18
+ if (seen.has(key))
19
+ continue;
20
+ seen.add(key);
21
+ bugs.push({ ...hit, message });
22
+ }
23
+ return { bugs, ignored };
24
+ }
25
+ export function consoleEvidence(bugs) {
26
+ return bugs.slice(0, 8).map(hit => ({
27
+ message: hit.message.slice(0, 300),
28
+ level: 'error',
29
+ ...(hit.sourceUrl ? { url: hit.sourceUrl } : {}),
30
+ }));
31
+ }
32
+ //# sourceMappingURL=console.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"console.js","sourceRoot":"","sources":["../../src/checks/console.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAcrD,MAAM,UAAU,YAAY,CAAC,IAAkB,EAAE,OAAe;IAC9D,MAAM,IAAI,GAAiB,EAAE,CAAC;IAC9B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;QACxD,IAAI,CAAC,OAAO;YAAE,SAAS;QACvB,IAAI,uBAAuB,CAAC,OAAO,EAAE,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,CAAC;YAC7D,OAAO,IAAI,CAAC,CAAC;YACb,SAAS;QACX,CAAC;QACD,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAClC,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAAE,SAAS;QAC5B,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,CAAC,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAkB;IAChD,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClC,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC;QAClC,KAAK,EAAE,OAAgB;QACvB,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjD,CAAC,CAAC,CAAC;AACN,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Run the reserved page checks in one browser pass.
3
+ *
4
+ * Each crawled URL is opened once. Every check type records its own step
5
+ * with `tool: 'check'`. A failure on one page does not skip the other pages.
6
+ * When `deadlineAt` has passed, the remaining pages are skipped. That is
7
+ * not a timeout error.
8
+ */
9
+ import type { Browser, Page } from 'playwright';
10
+ import type { ConsoleErrorEvidence, FlowResult, NetworkFailureEvidence, PageCheck, StepResult, TestFlow } from '../types.js';
11
+ export interface CheckStepOutcome {
12
+ status: 'passed' | 'failed' | 'skipped';
13
+ observation: string;
14
+ error?: string;
15
+ severity?: 'critical' | 'major' | 'minor';
16
+ consoleErrors?: ConsoleErrorEvidence[];
17
+ networkFailures?: NetworkFailureEvidence[];
18
+ }
19
+ export interface LinkBudget {
20
+ remaining: number;
21
+ }
22
+ export interface ExecuteChecksOptions {
23
+ screenshotsDir: string;
24
+ stepTimeoutMs: number;
25
+ /** Epoch ms. Pages not started by then are skipped. */
26
+ deadlineAt?: number;
27
+ onFlowStart?: (flow: TestFlow) => void;
28
+ onStep?: (flow: TestFlow, result: StepResult) => void;
29
+ onFlowComplete?: (result: FlowResult) => void;
30
+ }
31
+ export declare function replayPageCheck(page: Page, kind: PageCheck, url: string, timeoutMs: number): Promise<CheckStepOutcome>;
32
+ export declare function executePageChecks(browser: Browser, flows: TestFlow[], opts: ExecuteChecksOptions): Promise<FlowResult[]>;
33
+ export declare function shotPath(dir: string, flowId: string, index: number, status: string): string;
34
+ //# sourceMappingURL=execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/checks/execute.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAY,MAAM,YAAY,CAAC;AAC1D,OAAO,KAAK,EACV,oBAAoB,EACpB,UAAU,EACV,sBAAsB,EACtB,SAAS,EACT,UAAU,EACV,QAAQ,EAET,MAAM,aAAa,CAAC;AAkBrB,MAAM,WAAW,gBAAgB;IAC/B,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;IAC1C,aAAa,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACvC,eAAe,CAAC,EAAE,sBAAsB,EAAE,CAAC;CAC5C;AAOD,MAAM,WAAW,UAAU;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IACvC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,KAAK,IAAI,CA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