@monkeytestai/monkeytester 0.0.0-stage → 0.5.1

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 (113) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/LICENSE +661 -0
  3. package/NOTICE +12 -0
  4. package/README.md +196 -2
  5. package/dist/cli.d.ts +43 -0
  6. package/dist/cli.d.ts.map +1 -0
  7. package/dist/cli.js +774 -0
  8. package/dist/cli.js.map +1 -0
  9. package/dist/diff/index.d.ts +78 -0
  10. package/dist/diff/index.d.ts.map +1 -0
  11. package/dist/diff/index.js +119 -0
  12. package/dist/diff/index.js.map +1 -0
  13. package/dist/events.d.ts +66 -0
  14. package/dist/events.d.ts.map +1 -0
  15. package/dist/events.js +77 -0
  16. package/dist/events.js.map +1 -0
  17. package/dist/explorer/index.d.ts +131 -0
  18. package/dist/explorer/index.d.ts.map +1 -0
  19. package/dist/explorer/index.js +675 -0
  20. package/dist/explorer/index.js.map +1 -0
  21. package/dist/explorer/queue.d.ts +94 -0
  22. package/dist/explorer/queue.d.ts.map +1 -0
  23. package/dist/explorer/queue.js +277 -0
  24. package/dist/explorer/queue.js.map +1 -0
  25. package/dist/index.d.ts +36 -0
  26. package/dist/index.d.ts.map +1 -0
  27. package/dist/index.js +22 -0
  28. package/dist/index.js.map +1 -0
  29. package/dist/llm/coerce.d.ts +59 -0
  30. package/dist/llm/coerce.d.ts.map +1 -0
  31. package/dist/llm/coerce.js +246 -0
  32. package/dist/llm/coerce.js.map +1 -0
  33. package/dist/llm/index.d.ts +79 -0
  34. package/dist/llm/index.d.ts.map +1 -0
  35. package/dist/llm/index.js +392 -0
  36. package/dist/llm/index.js.map +1 -0
  37. package/dist/llm/presets.d.ts +61 -0
  38. package/dist/llm/presets.d.ts.map +1 -0
  39. package/dist/llm/presets.js +101 -0
  40. package/dist/llm/presets.js.map +1 -0
  41. package/dist/monkey.d.ts +151 -0
  42. package/dist/monkey.d.ts.map +1 -0
  43. package/dist/monkey.js +323 -0
  44. package/dist/monkey.js.map +1 -0
  45. package/dist/persistence/index.d.ts +118 -0
  46. package/dist/persistence/index.d.ts.map +1 -0
  47. package/dist/persistence/index.js +196 -0
  48. package/dist/persistence/index.js.map +1 -0
  49. package/dist/planner/faults.d.ts +24 -0
  50. package/dist/planner/faults.d.ts.map +1 -0
  51. package/dist/planner/faults.js +128 -0
  52. package/dist/planner/faults.js.map +1 -0
  53. package/dist/planner/forms.d.ts +33 -0
  54. package/dist/planner/forms.d.ts.map +1 -0
  55. package/dist/planner/forms.js +163 -0
  56. package/dist/planner/forms.js.map +1 -0
  57. package/dist/planner/index.d.ts +31 -0
  58. package/dist/planner/index.d.ts.map +1 -0
  59. package/dist/planner/index.js +252 -0
  60. package/dist/planner/index.js.map +1 -0
  61. package/dist/planner/salvage.d.ts +16 -0
  62. package/dist/planner/salvage.d.ts.map +1 -0
  63. package/dist/planner/salvage.js +107 -0
  64. package/dist/planner/salvage.js.map +1 -0
  65. package/dist/runner/actions.d.ts +91 -0
  66. package/dist/runner/actions.d.ts.map +1 -0
  67. package/dist/runner/actions.js +659 -0
  68. package/dist/runner/actions.js.map +1 -0
  69. package/dist/runner/evidence.d.ts +37 -0
  70. package/dist/runner/evidence.d.ts.map +1 -0
  71. package/dist/runner/evidence.js +122 -0
  72. package/dist/runner/evidence.js.map +1 -0
  73. package/dist/runner/http5xx.d.ts +40 -0
  74. package/dist/runner/http5xx.d.ts.map +1 -0
  75. package/dist/runner/http5xx.js +189 -0
  76. package/dist/runner/http5xx.js.map +1 -0
  77. package/dist/runner/index.d.ts +88 -0
  78. package/dist/runner/index.d.ts.map +1 -0
  79. package/dist/runner/index.js +600 -0
  80. package/dist/runner/index.js.map +1 -0
  81. package/dist/runner/replay.d.ts +42 -0
  82. package/dist/runner/replay.d.ts.map +1 -0
  83. package/dist/runner/replay.js +458 -0
  84. package/dist/runner/replay.js.map +1 -0
  85. package/dist/runner/timeout.d.ts +16 -0
  86. package/dist/runner/timeout.d.ts.map +1 -0
  87. package/dist/runner/timeout.js +38 -0
  88. package/dist/runner/timeout.js.map +1 -0
  89. package/dist/trace/fingerprint.d.ts +78 -0
  90. package/dist/trace/fingerprint.d.ts.map +1 -0
  91. package/dist/trace/fingerprint.js +273 -0
  92. package/dist/trace/fingerprint.js.map +1 -0
  93. package/dist/trace/serialize.d.ts +15 -0
  94. package/dist/trace/serialize.d.ts.map +1 -0
  95. package/dist/trace/serialize.js +86 -0
  96. package/dist/trace/serialize.js.map +1 -0
  97. package/dist/triager/index.d.ts +86 -0
  98. package/dist/triager/index.d.ts.map +1 -0
  99. package/dist/triager/index.js +322 -0
  100. package/dist/triager/index.js.map +1 -0
  101. package/dist/types.d.ts +497 -0
  102. package/dist/types.d.ts.map +1 -0
  103. package/dist/types.js +10 -0
  104. package/dist/types.js.map +1 -0
  105. package/dist/verify/index.d.ts +52 -0
  106. package/dist/verify/index.d.ts.map +1 -0
  107. package/dist/verify/index.js +140 -0
  108. package/dist/verify/index.js.map +1 -0
  109. package/dist/verify/verdict.d.ts +34 -0
  110. package/dist/verify/verdict.d.ts.map +1 -0
  111. package/dist/verify/verdict.js +89 -0
  112. package/dist/verify/verdict.js.map +1 -0
  113. package/package.json +90 -4
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Replay a recorded action trace without asking the LLM.
3
+ *
4
+ * Each step is executed from the stored locator (test id, then role+name,
5
+ * label, placeholder, text, then the CSS fallback). `--heal` is the only
6
+ * path that calls the model: when every recorded locator misses, the step's
7
+ * original instruction is re-resolved and the result is marked `healed`.
8
+ */
9
+ import { type Browser } from 'playwright';
10
+ import type { LLM } from '../llm/index.js';
11
+ import type { FlowTrace, RunResult } from '../types.js';
12
+ export interface ReplayOptions {
13
+ screenshotsDir: string;
14
+ stepTimeoutMs?: number;
15
+ flowTimeoutMs?: number;
16
+ headless?: boolean;
17
+ /** Default true. Tests turn this off; video is not required to replay. */
18
+ recordVideo?: boolean;
19
+ /**
20
+ * Same switch as `RunnerOptions.strictOracles`. Default false so a library
21
+ * replay does not grow new bugs. The CLI passes true.
22
+ */
23
+ strictOracles?: boolean;
24
+ /**
25
+ * Same switch as `RunnerOptions.failOn5xx`. Default false. The CLI passes
26
+ * the value of `--fail-on-5xx` (on unless `--no-fail-on-5xx`).
27
+ */
28
+ failOn5xx?: boolean;
29
+ /**
30
+ * Reuse a browser across calls. The caller owns its lifecycle; replay will
31
+ * not close it. `verify` uses this so N repeats share one Chromium.
32
+ */
33
+ browser?: Browser;
34
+ /**
35
+ * When a recorded locator matches nothing, ask `llm` to re-resolve that
36
+ * step from its original instruction. The step is marked `healed`.
37
+ */
38
+ heal?: boolean;
39
+ llm?: LLM;
40
+ }
41
+ export declare function replayTraces(traces: FlowTrace[], opts: ReplayOptions): Promise<RunResult>;
42
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/runner/replay.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAY,KAAK,OAAO,EAAkC,MAAM,YAAY,CAAC;AAGpF,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,EAGV,SAAS,EACT,SAAS,EAKV,MAAM,aAAa,CAAC;AAarB,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0EAA0E;IAC1E,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;OAGG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,GAAG,CAAC,EAAE,GAAG,CAAC;CACX;AAED,wBAAsB,YAAY,CAChC,MAAM,EAAE,SAAS,EAAE,EACnB,IAAI,EAAE,aAAa,GAClB,OAAO,CAAC,SAAS,CAAC,CA6BpB"}
@@ -0,0 +1,458 @@
1
+ /**
2
+ * Replay a recorded action trace without asking the LLM.
3
+ *
4
+ * Each step is executed from the stored locator (test id, then role+name,
5
+ * label, placeholder, text, then the CSS fallback). `--heal` is the only
6
+ * path that calls the model: when every recorded locator misses, the step's
7
+ * original instruction is re-resolved and the result is marked `healed`.
8
+ */
9
+ import { chromium } from 'playwright';
10
+ import { mkdirSync } from 'node:fs';
11
+ import { join, resolve } from 'node:path';
12
+ import { logModelDetail } from '../llm/coerce.js';
13
+ import { buildLocator, captureLocator, executeAction, resolveAction, skeletonForLLM, } from './actions.js';
14
+ import { createFlowTimeout } from './timeout.js';
15
+ import { applyPassedOracles, attachStepEvidence, flushStepEvents } from './evidence.js';
16
+ import { collectOrigins, outcomeWithSameOrigin5xx, promoteRecordedSteps } from './http5xx.js';
17
+ export async function replayTraces(traces, opts) {
18
+ const screenshotsDir = resolve(opts.screenshotsDir);
19
+ mkdirSync(screenshotsDir, { recursive: true });
20
+ const startedAt = new Date().toISOString();
21
+ const flows = [];
22
+ if (traces.length === 0) {
23
+ return emptyReplay(startedAt);
24
+ }
25
+ const owned = !opts.browser;
26
+ const browser = opts.browser ?? await chromium.launch({ headless: opts.headless ?? true });
27
+ try {
28
+ for (const trace of traces) {
29
+ flows.push(await runOneTrace(browser, trace, { ...opts, screenshotsDir }));
30
+ }
31
+ }
32
+ finally {
33
+ if (owned)
34
+ await browser.close().catch(() => { });
35
+ }
36
+ return {
37
+ startUrl: traces[0]?.startUrl || '',
38
+ startedAt,
39
+ finishedAt: new Date().toISOString(),
40
+ flows,
41
+ bugs: [],
42
+ stats: aggregate(flows),
43
+ };
44
+ }
45
+ async function runOneTrace(browser, trace, opts) {
46
+ const started = Date.now();
47
+ const timeoutMs = opts.flowTimeoutMs ?? 180_000;
48
+ const abort = new AbortController();
49
+ const timeout = createFlowTimeout(trace.name || trace.flowId, timeoutMs, () => abort.abort());
50
+ const work = replayFlow(browser, trace, opts, abort.signal);
51
+ // If the timeout wins the race, replayFlow may still reject once the
52
+ // context closes. Observe that rejection so it cannot surface later.
53
+ work.catch(() => { });
54
+ try {
55
+ // `timeout.promise` rejects when the budget is hit and only resolves if
56
+ // `cancel()` runs — which is the `finally` below, after this race.
57
+ const winner = await Promise.race([work, timeout.promise]);
58
+ if (!winner || !('flowId' in winner)) {
59
+ throw new Error(`flow "${trace.name || trace.flowId}" exceeded ${timeoutMs}ms`);
60
+ }
61
+ return winner;
62
+ }
63
+ catch (err) {
64
+ abort.abort();
65
+ return {
66
+ flowId: trace.flowId,
67
+ name: trace.name || trace.flowId,
68
+ description: trace.description || '',
69
+ kind: trace.kind || 'happy_path',
70
+ startUrl: trace.startUrl,
71
+ status: 'error',
72
+ failureReason: err instanceof Error ? err.message : String(err),
73
+ steps: [],
74
+ durationMs: Date.now() - started,
75
+ bugIds: [],
76
+ };
77
+ }
78
+ finally {
79
+ timeout.cancel();
80
+ }
81
+ }
82
+ async function replayFlow(browser, trace, opts, signal) {
83
+ const started = Date.now();
84
+ const stepTimeout = opts.stepTimeoutMs ?? 15_000;
85
+ const context = await openContext(browser, opts);
86
+ const onAbort = () => { void context.close().catch(() => { }); };
87
+ if (signal.aborted) {
88
+ await context.close().catch(() => { });
89
+ throw new Error('flow aborted');
90
+ }
91
+ signal.addEventListener('abort', onAbort, { once: true });
92
+ const page = await context.newPage();
93
+ const evidence = attachStepEvidence(page);
94
+ const origins = collectOrigins([trace.startUrl]);
95
+ const steps = [];
96
+ const traceSteps = [];
97
+ let failed = false;
98
+ let failureReason;
99
+ try {
100
+ for (const recorded of trace.steps) {
101
+ if (signal.aborted)
102
+ throw new Error('flow aborted');
103
+ evidence.stepIndex = recorded.index;
104
+ if (failed) {
105
+ const blocked = blockedResult(recorded, 'Earlier step failed; not attempted.');
106
+ blocked.screenshotPath = await shot(page, opts.screenshotsDir, trace.flowId, recorded.index, 'blocked');
107
+ steps.push(blocked);
108
+ continue;
109
+ }
110
+ const urlBefore = page.url();
111
+ const startedAt = new Date().toISOString();
112
+ const stepStart = Date.now();
113
+ const played = await playStep(page, trace, recorded, opts, stepTimeout);
114
+ if (opts.strictOracles) {
115
+ played.outcome = await applyPassedOracles(page, evidence, recorded.index, played.outcome);
116
+ }
117
+ if (opts.failOn5xx) {
118
+ if (!opts.strictOracles)
119
+ await flushStepEvents(page);
120
+ played.outcome = outcomeWithSameOrigin5xx(played.outcome, evidence.networkByStep.get(recorded.index), origins);
121
+ }
122
+ const urlAfter = safeUrl(page);
123
+ const result = {
124
+ index: recorded.index,
125
+ action: recorded.action || played.action.tool,
126
+ expectation: recorded.expectation,
127
+ status: played.outcome.status,
128
+ observation: played.outcome.observation,
129
+ tool: played.action.tool,
130
+ target: played.action.target,
131
+ locator: played.locator,
132
+ resolution: played.resolution,
133
+ durationMs: Date.now() - stepStart,
134
+ screenshotPath: await shot(page, opts.screenshotsDir, trace.flowId, recorded.index, played.outcome.status),
135
+ consoleErrors: evidence.consoleByStep.get(recorded.index),
136
+ networkFailures: evidence.networkByStep.get(recorded.index),
137
+ ...(played.outcome.error ? { error: played.outcome.error } : {}),
138
+ };
139
+ steps.push(result);
140
+ traceSteps.push({
141
+ index: recorded.index,
142
+ action: recorded.action,
143
+ expectation: recorded.expectation,
144
+ tool: played.action.tool,
145
+ locator: played.locator,
146
+ value: played.action.value,
147
+ urlBefore,
148
+ urlAfter,
149
+ startedAt,
150
+ durationMs: result.durationMs,
151
+ status: result.status,
152
+ observation: result.observation,
153
+ error: result.error,
154
+ screenshotPath: result.screenshotPath,
155
+ consoleErrors: result.consoleErrors,
156
+ networkFailures: result.networkFailures,
157
+ resolution: played.resolution,
158
+ });
159
+ if (result.status === 'failed') {
160
+ failed = true;
161
+ failureReason = result.error || result.observation;
162
+ }
163
+ }
164
+ if (opts.failOn5xx)
165
+ await flushStepEvents(page);
166
+ }
167
+ finally {
168
+ signal.removeEventListener('abort', onAbort);
169
+ await context.close().catch(() => { });
170
+ }
171
+ if (opts.failOn5xx) {
172
+ const promoted = promoteRecordedSteps(steps, traceSteps, origins);
173
+ if (promoted.changed) {
174
+ steps.splice(0, steps.length, ...promoted.steps);
175
+ traceSteps.splice(0, traceSteps.length, ...promoted.traceSteps);
176
+ if (promoted.failed) {
177
+ failed = true;
178
+ failureReason = failureReason || promoted.failureReason;
179
+ }
180
+ }
181
+ }
182
+ const status = failed ? 'failed' : 'passed';
183
+ return {
184
+ flowId: trace.flowId,
185
+ name: trace.name || trace.flowId,
186
+ description: trace.description || '',
187
+ kind: trace.kind || 'happy_path',
188
+ startUrl: trace.startUrl,
189
+ status,
190
+ failureReason,
191
+ steps,
192
+ durationMs: Date.now() - started,
193
+ bugIds: [],
194
+ trace: {
195
+ version: 1,
196
+ flowId: trace.flowId,
197
+ name: trace.name || trace.flowId,
198
+ description: trace.description,
199
+ kind: trace.kind,
200
+ startUrl: trace.startUrl,
201
+ expectation: trace.expectation,
202
+ steps: traceSteps,
203
+ },
204
+ };
205
+ }
206
+ async function playStep(page, trace, recorded, opts, timeoutMs) {
207
+ if (!needsElement(recorded)) {
208
+ const action = actionFromRecorded(recorded);
209
+ const outcome = await executeAction(page, action, timeoutMs, { strictOracles: opts.strictOracles });
210
+ return { action, locator: recorded.locator, outcome, resolution: 'recorded' };
211
+ }
212
+ const matched = await firstMatch(page, recorded);
213
+ if (matched) {
214
+ const outcome = await executeAction(page, matched, timeoutMs, { strictOracles: opts.strictOracles });
215
+ const locator = await captureLocator(page, matched).catch(() => recorded.locator);
216
+ return { action: matched, locator: locator || recorded.locator, outcome, resolution: 'recorded' };
217
+ }
218
+ if (opts.heal && opts.llm && recorded.action) {
219
+ let healed;
220
+ try {
221
+ healed = await healStep(page, trace, recorded, opts.llm);
222
+ }
223
+ catch (err) {
224
+ const detail = err instanceof Error ? err.message : String(err);
225
+ logModelDetail('runner.resolveAction', detail);
226
+ return {
227
+ action: actionFromRecorded(recorded),
228
+ locator: recorded.locator,
229
+ resolution: 'recorded',
230
+ outcome: {
231
+ status: 'failed',
232
+ observation: 'Recorded locator no longer matches, and the model could not propose a replacement.',
233
+ error: 'locator_mismatch',
234
+ },
235
+ };
236
+ }
237
+ const outcome = await executeAction(page, healed, timeoutMs, { strictOracles: opts.strictOracles });
238
+ const locator = await captureLocator(page, healed).catch(() => undefined);
239
+ return {
240
+ action: healed,
241
+ locator,
242
+ outcome: {
243
+ ...outcome,
244
+ observation: `Healed (recorded locator missed). ${outcome.observation}`,
245
+ },
246
+ resolution: 'healed',
247
+ };
248
+ }
249
+ // The original run already continued past this step. A locator miss here
250
+ // must not become a hard failure, or verify never reaches the later bug
251
+ // (a placeholder fill that timed out, then a form POST that returned 500).
252
+ // A step that originally passed or failed still stops the flow.
253
+ if (recorded.status === 'skipped') {
254
+ return {
255
+ action: actionFromRecorded(recorded),
256
+ locator: recorded.locator,
257
+ resolution: 'recorded',
258
+ outcome: {
259
+ status: 'skipped',
260
+ observation: `Recorded step was skipped and its locator still does not match for ${recorded.tool} (${describeLocator(recorded)}). Left skipped so later steps still run.`,
261
+ },
262
+ };
263
+ }
264
+ return {
265
+ action: actionFromRecorded(recorded),
266
+ locator: recorded.locator,
267
+ resolution: 'recorded',
268
+ outcome: {
269
+ status: 'failed',
270
+ observation: `Recorded locator no longer matches for ${recorded.tool} (${describeLocator(recorded)}).`,
271
+ error: 'locator_mismatch',
272
+ },
273
+ };
274
+ }
275
+ async function healStep(page, trace, recorded, llm) {
276
+ const flow = {
277
+ id: trace.flowId,
278
+ name: trace.name || trace.flowId,
279
+ description: trace.description || '',
280
+ kind: trace.kind || 'happy_path',
281
+ startUrl: trace.startUrl,
282
+ expectation: trace.expectation || '',
283
+ severityIfFails: 'major',
284
+ steps: trace.steps
285
+ .filter(step => step.action)
286
+ .map(step => ({ action: step.action, expectation: step.expectation })),
287
+ };
288
+ const step = { action: recorded.action || '', expectation: recorded.expectation };
289
+ const skeleton = await skeletonForLLM(page);
290
+ return resolveAction(llm, flow, step, skeleton);
291
+ }
292
+ function needsElement(step) {
293
+ if (step.tool === 'goto' || step.tool === 'noop' || step.tool === 'assert_text')
294
+ return false;
295
+ if (step.tool === 'press' && !step.locator)
296
+ return false;
297
+ return true;
298
+ }
299
+ function actionFromRecorded(step) {
300
+ if (step.tool === 'goto') {
301
+ return { tool: 'goto', target: step.locator?.target || step.urlAfter || '' };
302
+ }
303
+ if (step.tool === 'assert_text') {
304
+ return { tool: 'assert_text', target: step.locator?.target || step.action };
305
+ }
306
+ if (step.tool === 'noop') {
307
+ return { tool: 'noop', rationale: step.observation };
308
+ }
309
+ if (step.tool === 'press' && !step.locator) {
310
+ return { tool: 'press', value: step.value };
311
+ }
312
+ const locator = step.locator;
313
+ return {
314
+ tool: step.tool,
315
+ locator: locator?.strategy === 'testid' ? 'testid' : (locator?.strategy || 'css'),
316
+ target: locator?.target || '',
317
+ value: step.value,
318
+ };
319
+ }
320
+ async function firstMatch(page, step) {
321
+ const locator = step.locator;
322
+ if (!locator)
323
+ return null;
324
+ const candidates = [];
325
+ const push = (action) => {
326
+ const key = `${action.locator}|${action.target}`;
327
+ if (candidates.some(existing => `${existing.locator}|${existing.target}` === key))
328
+ return;
329
+ candidates.push(action);
330
+ };
331
+ if (locator.testId)
332
+ push({ tool: step.tool, locator: 'testid', target: locator.testId, value: step.value });
333
+ if (locator.role && (locator.name || locator.target)) {
334
+ const name = locator.name || locator.target;
335
+ push({ tool: step.tool, locator: 'role', target: `${locator.role}:${name}`, value: step.value });
336
+ }
337
+ if (locator.label)
338
+ push({ tool: step.tool, locator: 'label', target: locator.label, value: step.value });
339
+ if (locator.placeholder)
340
+ push({ tool: step.tool, locator: 'placeholder', target: locator.placeholder, value: step.value });
341
+ if (locator.text)
342
+ push({ tool: step.tool, locator: 'text', target: locator.text, value: step.value });
343
+ if (locator.css)
344
+ push({ tool: step.tool, locator: 'css', target: locator.css, value: step.value });
345
+ if (locator.strategy === 'css' && locator.target && locator.target !== locator.css) {
346
+ push({ tool: step.tool, locator: 'css', target: locator.target, value: step.value });
347
+ }
348
+ if (locator.strategy && locator.strategy !== 'css' && locator.target) {
349
+ push({
350
+ tool: step.tool,
351
+ locator: locator.strategy,
352
+ target: locator.strategy === 'role' && locator.role && locator.name
353
+ ? `${locator.role}:${locator.name}`
354
+ : locator.target,
355
+ value: step.value,
356
+ });
357
+ }
358
+ for (const candidate of candidates) {
359
+ try {
360
+ const count = await buildLocator(page, candidate).count();
361
+ if (count > 0)
362
+ return candidate;
363
+ }
364
+ catch {
365
+ /* a stale CSS selector can throw on parse; try the next candidate */
366
+ }
367
+ }
368
+ return null;
369
+ }
370
+ function describeLocator(step) {
371
+ const locator = step.locator;
372
+ if (!locator)
373
+ return 'no locator';
374
+ const bits = [
375
+ locator.testId && `testid=${locator.testId}`,
376
+ locator.role && `role=${locator.role}`,
377
+ locator.name && `name=${locator.name}`,
378
+ locator.css && `css=${locator.css}`,
379
+ ].filter(Boolean);
380
+ return bits.join(' ') || `${locator.strategy}:${locator.target}`;
381
+ }
382
+ function blockedResult(recorded, observation) {
383
+ return {
384
+ index: recorded.index,
385
+ action: recorded.action || recorded.tool,
386
+ expectation: recorded.expectation,
387
+ status: 'blocked',
388
+ observation,
389
+ resolution: 'recorded',
390
+ };
391
+ }
392
+ async function openContext(browser, opts) {
393
+ return browser.newContext({
394
+ userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 13_0) AppleWebKit/537.36 '
395
+ + '(KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 monkeytest.ai',
396
+ viewport: { width: 1280, height: 800 },
397
+ ...(opts.recordVideo === false ? {} : {
398
+ recordVideo: { dir: opts.screenshotsDir, size: { width: 1280, height: 800 } },
399
+ }),
400
+ });
401
+ }
402
+ async function shot(page, dir, flowId, index, status) {
403
+ const filename = `replay-${slug(flowId)}-step-${String(index).padStart(2, '0')}-${status}.png`;
404
+ const fullPath = join(dir, filename);
405
+ try {
406
+ await page.screenshot({ path: fullPath, fullPage: false });
407
+ return fullPath;
408
+ }
409
+ catch {
410
+ return undefined;
411
+ }
412
+ }
413
+ function safeUrl(page) {
414
+ try {
415
+ return page.url();
416
+ }
417
+ catch {
418
+ return undefined;
419
+ }
420
+ }
421
+ function slug(s) {
422
+ return s.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 60) || 'flow';
423
+ }
424
+ function aggregate(flows) {
425
+ let stepsTotal = 0, stepsPassed = 0, stepsFailed = 0;
426
+ for (const flow of flows) {
427
+ for (const step of flow.steps) {
428
+ stepsTotal++;
429
+ if (step.status === 'passed')
430
+ stepsPassed++;
431
+ if (step.status === 'failed')
432
+ stepsFailed++;
433
+ }
434
+ }
435
+ return {
436
+ flowsTotal: flows.length,
437
+ flowsPassed: flows.filter(flow => flow.status === 'passed').length,
438
+ flowsFailed: flows.filter(flow => flow.status === 'failed' || flow.status === 'error').length,
439
+ flowsBlocked: flows.filter(flow => flow.status === 'blocked').length,
440
+ stepsTotal, stepsPassed, stepsFailed,
441
+ bugsCritical: 0, bugsMajor: 0, bugsMinor: 0,
442
+ };
443
+ }
444
+ function emptyReplay(startedAt) {
445
+ return {
446
+ startUrl: '',
447
+ startedAt,
448
+ finishedAt: new Date().toISOString(),
449
+ flows: [],
450
+ bugs: [],
451
+ stats: {
452
+ flowsTotal: 0, flowsPassed: 0, flowsFailed: 0, flowsBlocked: 0,
453
+ stepsTotal: 0, stepsPassed: 0, stepsFailed: 0,
454
+ bugsCritical: 0, bugsMajor: 0, bugsMinor: 0,
455
+ },
456
+ };
457
+ }
458
+ //# sourceMappingURL=replay.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.js","sourceRoot":"","sources":["../../src/runner/replay.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAgD,MAAM,YAAY,CAAC;AACpF,OAAO,EAAE,SAAS,EAAE,MA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` inside `Promise.race`. When the
5
+ * flow finished first the timer kept running (and could reject with nobody
6
+ * listening). When the timer won, the Playwright context was left open until
7
+ * the whole browser closed. `cancel()` clears the timer, and `onFire` is how
8
+ * the runner aborts the context the moment the budget is exceeded.
9
+ */
10
+ export interface FlowTimeout {
11
+ promise: Promise<void>;
12
+ /** Stop the timer. Safe to call more than once, including after it fired. */
13
+ cancel: () => void;
14
+ }
15
+ export declare function createFlowTimeout(flowName: string, timeoutMs: number, onFire?: () => void): FlowTimeout;
16
+ //# sourceMappingURL=timeout.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout.d.ts","sourceRoot":"","sources":["../../src/runner/timeout.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,6EAA6E;IAC7E,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAED,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,IAAI,GAClB,WAAW,CA2Bb"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Wall-clock guard for a single flow.
3
+ *
4
+ * The previous guard was a bare `setTimeout` inside `Promise.race`. When the
5
+ * flow finished first the timer kept running (and could reject with nobody
6
+ * listening). When the timer won, the Playwright context was left open until
7
+ * the whole browser closed. `cancel()` clears the timer, and `onFire` is how
8
+ * the runner aborts the context the moment the budget is exceeded.
9
+ */
10
+ export function createFlowTimeout(flowName, timeoutMs, onFire) {
11
+ let timer;
12
+ let settle;
13
+ const promise = new Promise((resolve, reject) => {
14
+ settle = resolve;
15
+ timer = setTimeout(() => {
16
+ timer = undefined;
17
+ try {
18
+ onFire?.();
19
+ }
20
+ catch { /* closing the context must not mask the timeout */ }
21
+ reject(new Error(`flow "${flowName}" exceeded ${timeoutMs}ms`));
22
+ }, timeoutMs);
23
+ });
24
+ return {
25
+ promise,
26
+ cancel() {
27
+ if (timer !== undefined) {
28
+ clearTimeout(timer);
29
+ timer = undefined;
30
+ }
31
+ // Settle so a cancelled guard cannot reject later and is not left pending.
32
+ const resolve = settle;
33
+ settle = undefined;
34
+ resolve?.();
35
+ },
36
+ };
37
+ }
38
+ //# sourceMappingURL=timeout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"timeout.js","sourceRoot":"","sources":["../../src/runner/timeout.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAQH,MAAM,UAAU,iBAAiB,CAC/B,QAAgB,EAChB,SAAiB,EACjB,MAAmB;IAEnB,IAAI,KAAgD,CAAC;IACrD,IAAI,MAAgC,CAAC;IAErC,MAAM,OAAO,GAAG,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACpD,MAAM,GAAG,OAAO,CAAC;QACjB,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YACtB,KAAK,GAAG,SAAS,CAAC;YAClB,IAAI,CAAC;gBAAC,MAAM,EAAE,EAAE,CAAC;YAAC,CAAC;YACnB,MAAM,CAAC,CAAC,mDAAmD,CAAC,CAAC;YAC7D,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,QAAQ,cAAc,SAAS,IAAI,CAAC,CAAC,CAAC;QAClE,CAAC,EAAE,SAAS,CAAC,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,OAAO;QACP,MAAM;YACJ,IAAI,KAAK,KAAK,SAAS,EAAC,CAAC;gBACvB,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,KAAK,GAAG,SAAS,CAAC;YACpB,CAAC;YACD,2EAA2E;YAC3E,MAAM,OAAO,GAAG,MAAM,CAAC;YACvB,MAAM,GAAG,SAAS,CAAC;YACnB,OAAO,EAAE,EAAE,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC"}