@humanjs/playwright 0.6.0 → 0.8.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/dist/index.d.cts CHANGED
@@ -3,6 +3,14 @@ export { ActionResult, ActionType, BezierPathOptions, ComputeReadingDwellOptions
3
3
  import { Locator, BrowserContext, Page } from 'playwright';
4
4
  export { Browser, BrowserContext, BrowserContextOptions, ElementHandle, LaunchOptions, Locator, Page, chromium, firefox, webkit } from 'playwright';
5
5
 
6
+ /** Anything that can resolve to a click/move point. */
7
+ type MouseTarget = Locator | string | Point;
8
+
9
+ /** Values accepted by {@link executeSelectOption} — the Playwright `selectOption` shape. */
10
+ type SelectOptionValues = Parameters<Locator['selectOption']>[0];
11
+ /** Files accepted by {@link executeUpload} — the Playwright `setInputFiles` shape. */
12
+ type UploadFiles = Parameters<Locator['setInputFiles']>[0];
13
+
6
14
  /**
7
15
  * Modifier tokens accepted in a `human.press()` chord. `Mod` and `CmdOrCtrl` /
8
16
  * `CommandOrControl` are the magic auto-mapping tokens (Meta on Mac,
@@ -73,9 +81,6 @@ interface PressResult {
73
81
  readonly dispatched: string;
74
82
  }
75
83
 
76
- /** Anything that can resolve to a click/move point. */
77
- type MouseTarget = Locator | string | Point;
78
-
79
84
  /**
80
85
  * What to read:
81
86
  * - `string`: a Playwright-compatible selector (matches `click()` / `type()`).
@@ -163,6 +168,28 @@ interface CaptureResult {
163
168
  cleanup(): Promise<void>;
164
169
  }
165
170
 
171
+ /** Options for {@link generatePlaywrightTest} / `Recording.toPlaywright`. */
172
+ interface PlaywrightTestOptions {
173
+ /**
174
+ * Keep recorded `sleep()` pauses. Default `false` — a test shouldn't carry
175
+ * human-timing waits (slow + flaky in CI; Playwright auto-waits instead).
176
+ */
177
+ readonly keepSleeps?: boolean;
178
+ /** Test title. Defaults to the recording's name, else `'recorded session'`. */
179
+ readonly title?: string;
180
+ /**
181
+ * Wrap actions in `test.step(...)` groups — a new step per navigation — so
182
+ * they show as collapsible sections in the HTML report / trace. Default false.
183
+ */
184
+ readonly steps?: boolean;
185
+ /**
186
+ * When all `goto`s share one origin, emit them as relative paths and add a
187
+ * note to set `use.baseURL` in the Playwright config (portable across
188
+ * environments). Default false — absolute URLs that run without any config.
189
+ */
190
+ readonly baseUrl?: boolean;
191
+ }
192
+
166
193
  /**
167
194
  * Encoding quality preset. Picks the per-frame capture quality + the
168
195
  * ffmpeg encode settings used to assemble them into a video.
@@ -212,10 +239,18 @@ interface TimelineEvent {
212
239
  readonly durationMs: number;
213
240
  /** Error message, present only if the action threw. */
214
241
  readonly error?: string;
242
+ /**
243
+ * For `type` / `paste`: the actual text written, captured when
244
+ * `captureInputs` is on (the default). Omitted when capture is off or the
245
+ * target is a password field (always masked). Flows into exported code.
246
+ */
247
+ readonly inputValue?: string;
215
248
  }
216
249
  /** Structured action timeline of a recording. */
217
250
  interface Timeline {
218
251
  readonly version: 1;
252
+ /** Optional label for the recording (used as the generated test's title). */
253
+ readonly name?: string;
219
254
  readonly personality: string;
220
255
  readonly seed: string | null;
221
256
  readonly speed: string;
@@ -224,6 +259,7 @@ interface Timeline {
224
259
  }
225
260
  /** Metadata passed from `human.record()` into the Recording constructor. */
226
261
  interface RecordingTimelineSource {
262
+ readonly name?: string;
227
263
  readonly personality: string;
228
264
  readonly seed: string | null;
229
265
  readonly speed: string;
@@ -288,6 +324,30 @@ declare class Recording {
288
324
  * @returns the resolved output path.
289
325
  */
290
326
  toTimeline(outputPath: string): Promise<string>;
327
+ /**
328
+ * Generates a standalone, runnable HumanJS script from the timeline and
329
+ * writes it to `outputPath`. String selectors round-trip verbatim; typed
330
+ * values are included when `captureInputs` was on (passwords masked).
331
+ *
332
+ * Independent of frame capture — works on timeline-only recordings and is
333
+ * unaffected by `dispose()`.
334
+ *
335
+ * @returns the resolved output path.
336
+ */
337
+ toHumanJS(outputPath: string): Promise<string>;
338
+ /**
339
+ * Generates a `@playwright/test` spec from the timeline — a humanized test
340
+ * (uses `createHuman` + `human.*`), not raw Playwright — and writes it to
341
+ * `outputPath`. Runs instant in CI / recorded speed locally, drops timing
342
+ * `sleep()`s (pass `{ keepSleeps: true }` to keep them), and derives the
343
+ * assertions it safely can.
344
+ *
345
+ * Independent of frame capture — works on timeline-only recordings and is
346
+ * unaffected by `dispose()`.
347
+ *
348
+ * @returns the resolved output path.
349
+ */
350
+ toPlaywright(outputPath: string, options?: PlaywrightTestOptions): Promise<string>;
291
351
  /**
292
352
  * Releases the captured-frames temp directory. After this call, `toVideo()`
293
353
  * and `toGif()` throw — but `toTimeline()` and the in-memory `timeline`
@@ -481,6 +541,17 @@ interface Human {
481
541
  * `mouse.click({ button: 'right' })` at the coordinates.
482
542
  */
483
543
  rightClick(target: MouseTarget): Promise<void>;
544
+ /**
545
+ * Double-click `target`. Identical humanized approach to `click()` — same
546
+ * Bezier path, hover dwell, and occasional near-miss — but the final
547
+ * dispatch is a double-click (two presses within the OS double-click
548
+ * window). Accepts the same selector / `Locator` / `Point` targets.
549
+ *
550
+ * In `speed: 'instant'`, element targets fall back to
551
+ * `locator.click({ clickCount: 2 })`; a `Point` dispatches
552
+ * `mouse.click(x, y, { clickCount: 2 })`.
553
+ */
554
+ doubleClick(target: MouseTarget): Promise<void>;
484
555
  /**
485
556
  * Move the cursor to `target` along a humanized Bezier path and settle
486
557
  * on it — no click is dispatched. Useful for hover-triggered UI
@@ -547,6 +618,70 @@ interface Human {
547
618
  * by nature.
548
619
  */
549
620
  paste(target: Locator | string, value: string): Promise<void>;
621
+ /**
622
+ * Clear a text field `target` (input, textarea, or contenteditable) with a
623
+ * humanized gesture: click to focus, **select-all**, a beat, then **delete**
624
+ * — the real keyboard motion a person uses to wipe a field before retyping,
625
+ * not a silent value reset. Fires the keydown/up + `input` events the page
626
+ * expects.
627
+ *
628
+ * Pair with `type()` to edit an existing value:
629
+ * `await human.clear('#name'); await human.type('#name', 'New');`
630
+ *
631
+ * In `speed: 'instant'`, delegates to Playwright's native `locator.clear()`.
632
+ */
633
+ clear(target: Locator | string): Promise<void>;
634
+ /**
635
+ * Tick a checkbox or radio `target`. Moves the cursor to the control and
636
+ * clicks it with the same humanized motion as `click()` — but only when
637
+ * needed: if it already reports checked, no click fires (a real user
638
+ * doesn't re-click a box that's already ticked). The resulting state is
639
+ * verified; trying to `check` something that won't toggle throws.
640
+ *
641
+ * `target` is element-bound (selector or `Locator`). In `speed: 'instant'`,
642
+ * delegates to Playwright's native `locator.check()`.
643
+ */
644
+ check(target: Locator | string): Promise<void>;
645
+ /**
646
+ * Untick a checkbox `target`. Mirror of `check()` — humanized click only if
647
+ * currently checked, with state verification afterward. Radios can't be
648
+ * unchecked by clicking (select a different option instead); attempting it
649
+ * throws a clear error.
650
+ *
651
+ * In `speed: 'instant'`, delegates to `locator.uncheck()`.
652
+ */
653
+ uncheck(target: Locator | string): Promise<void>;
654
+ /**
655
+ * Choose option(s) in a native `<select>` `target`. The cursor moves to the
656
+ * dropdown and settles on it (humanized), then the value is set — native
657
+ * selects open an OS menu automation can't drive visually, so the *approach*
658
+ * is humanized while the choice itself is set programmatically (firing
659
+ * `input`/`change`), exactly as Playwright does. For custom DOM dropdowns,
660
+ * drive the rendered options with `click` instead.
661
+ *
662
+ * `values` takes the Playwright `selectOption` shape — a value string, an
663
+ * array of values, or `{ value | label | index }`. Returns the option
664
+ * values that ended up selected.
665
+ *
666
+ * In `speed: 'instant'`, sets the value with no cursor motion.
667
+ */
668
+ selectOption(target: Locator | string, values: SelectOptionValues): Promise<string[]>;
669
+ /**
670
+ * Attach file(s) to a file-input `target`. The cursor moves to the control
671
+ * (visible in recordings / the overlay), then the files are attached via
672
+ * `setInputFiles`. Unlike a real click this never opens the OS file dialog
673
+ * (which would hang) — files are set directly, the way Playwright models
674
+ * uploads.
675
+ *
676
+ * `target` should be the `<input type="file">`. For the common hidden-input-
677
+ * behind-a-styled-button pattern there's no visible control to approach, so
678
+ * the motion is skipped and the files are attached directly. `files` takes
679
+ * the Playwright `setInputFiles` shape (a path, an array of paths, or
680
+ * in-memory `{ name, mimeType, buffer }` payloads).
681
+ *
682
+ * In `speed: 'instant'`, attaches the files with no cursor motion.
683
+ */
684
+ upload(target: Locator | string, files: UploadFiles): Promise<void>;
550
685
  /**
551
686
  * Press a single key (`'Tab'`, `'Enter'`, `'Escape'`, `'ArrowDown'`, …)
552
687
  * or a keyboard chord (`'Mod+S'`, `'Cmd+Shift+P'`, `'Ctrl+C'`, …).
@@ -704,6 +839,22 @@ interface Human {
704
839
  * Not a humanized action: no plugin events fire.
705
840
  */
706
841
  content(): Promise<string>;
842
+ /**
843
+ * Accessibility-tree **outline** of the page (or a region) — every
844
+ * interactive element and landmark by its ARIA role + accessible name,
845
+ * rendered as compact YAML (Playwright's `ariaSnapshot`). The most
846
+ * token-efficient way for an AI agent to see what's actionable and pick a
847
+ * selector: the names map directly to `getByRole` / accessible-name
848
+ * selectors, which HumanJS already favors.
849
+ *
850
+ * Prefer this over {@link Human.content} when the question is "what can I
851
+ * click / fill"; reach for {@link Human.screenshot} when you need the
852
+ * visual layout. Pass `target` to scope the outline to a region.
853
+ *
854
+ * Not a humanized action: no plugin events fire. Requires Playwright ≥ 1.49
855
+ * (when `ariaSnapshot` landed).
856
+ */
857
+ outline(target?: Locator | string): Promise<string>;
707
858
  /**
708
859
  * Current URL of the page. Forwards to `page.url()`. Synchronous return
709
860
  * because Playwright's underlying API is sync.
@@ -777,6 +928,11 @@ interface Human {
777
928
  }
778
929
  /** Options for {@link Human.record}. */
779
930
  interface HumanRecordOptions {
931
+ /**
932
+ * Optional label for the recording. Stored on the timeline and used as the
933
+ * title of a generated `toPlaywright()` test.
934
+ */
935
+ readonly name?: string;
780
936
  /**
781
937
  * Whether to capture frames for video output. Defaults to `true`.
782
938
  * Set to `false` for timeline-only recordings (no capture loop, no
@@ -789,6 +945,21 @@ interface HumanRecordOptions {
789
945
  * Defaults to `'high'`. Ignored when `video: false`.
790
946
  */
791
947
  readonly quality?: RecordingQuality;
948
+ /**
949
+ * Capture the actual typed/pasted text into the timeline (and therefore
950
+ * into code generated by `toHumanJS()` / `toPlaywright()`). Defaults to
951
+ * `true`.
952
+ *
953
+ * Values typed/pasted into `input[type="password"]` are always masked
954
+ * (omitted) regardless of this flag — the video already renders them as
955
+ * dots, and freezing a cleartext secret into an artifact would leak more
956
+ * than the recording itself. Set `false` to record no input values at all;
957
+ * exporters then emit empty-string placeholders.
958
+ *
959
+ * Captured values land in the timeline JSON and any exported test, so treat
960
+ * those artifacts with the same care as the values themselves.
961
+ */
962
+ readonly captureInputs?: boolean;
792
963
  }
793
964
  /**
794
965
  * Creates a humanized session bound to a Playwright `Page`.
@@ -811,4 +982,4 @@ interface HumanRecordOptions {
811
982
  */
812
983
  declare function createHuman(page: Page, options?: CreateHumanOptions): Promise<Human>;
813
984
 
814
- export { type CreateHumanOptions, type FfmpegPreset, type FfmpegTune, type Human, type HumanRecordOptions, type InstallMouseHelperOptions, type KeyModifier, type KeyName, type KeyOrChord, type MouseTarget, type PressResult, type ReadOptions, type ReadResult, type ReadTarget, Recording, type RecordingQuality, type ScrollOptions, type ScrollResult, type ScrollTarget, type Speed, type Timeline, type TimelineEvent, type ToGifOptions, type ToVideoOptions, createHuman, installMouseHelper };
985
+ export { type CreateHumanOptions, type FfmpegPreset, type FfmpegTune, type Human, type HumanRecordOptions, type InstallMouseHelperOptions, type KeyModifier, type KeyName, type KeyOrChord, type MouseTarget, type PlaywrightTestOptions, type PressResult, type ReadOptions, type ReadResult, type ReadTarget, Recording, type RecordingQuality, type ScrollOptions, type ScrollResult, type ScrollTarget, type SelectOptionValues, type Speed, type Timeline, type TimelineEvent, type ToGifOptions, type ToVideoOptions, type UploadFiles, createHuman, installMouseHelper };
package/dist/index.d.ts CHANGED
@@ -3,6 +3,14 @@ export { ActionResult, ActionType, BezierPathOptions, ComputeReadingDwellOptions
3
3
  import { Locator, BrowserContext, Page } from 'playwright';
4
4
  export { Browser, BrowserContext, BrowserContextOptions, ElementHandle, LaunchOptions, Locator, Page, chromium, firefox, webkit } from 'playwright';
5
5
 
6
+ /** Anything that can resolve to a click/move point. */
7
+ type MouseTarget = Locator | string | Point;
8
+
9
+ /** Values accepted by {@link executeSelectOption} — the Playwright `selectOption` shape. */
10
+ type SelectOptionValues = Parameters<Locator['selectOption']>[0];
11
+ /** Files accepted by {@link executeUpload} — the Playwright `setInputFiles` shape. */
12
+ type UploadFiles = Parameters<Locator['setInputFiles']>[0];
13
+
6
14
  /**
7
15
  * Modifier tokens accepted in a `human.press()` chord. `Mod` and `CmdOrCtrl` /
8
16
  * `CommandOrControl` are the magic auto-mapping tokens (Meta on Mac,
@@ -73,9 +81,6 @@ interface PressResult {
73
81
  readonly dispatched: string;
74
82
  }
75
83
 
76
- /** Anything that can resolve to a click/move point. */
77
- type MouseTarget = Locator | string | Point;
78
-
79
84
  /**
80
85
  * What to read:
81
86
  * - `string`: a Playwright-compatible selector (matches `click()` / `type()`).
@@ -163,6 +168,28 @@ interface CaptureResult {
163
168
  cleanup(): Promise<void>;
164
169
  }
165
170
 
171
+ /** Options for {@link generatePlaywrightTest} / `Recording.toPlaywright`. */
172
+ interface PlaywrightTestOptions {
173
+ /**
174
+ * Keep recorded `sleep()` pauses. Default `false` — a test shouldn't carry
175
+ * human-timing waits (slow + flaky in CI; Playwright auto-waits instead).
176
+ */
177
+ readonly keepSleeps?: boolean;
178
+ /** Test title. Defaults to the recording's name, else `'recorded session'`. */
179
+ readonly title?: string;
180
+ /**
181
+ * Wrap actions in `test.step(...)` groups — a new step per navigation — so
182
+ * they show as collapsible sections in the HTML report / trace. Default false.
183
+ */
184
+ readonly steps?: boolean;
185
+ /**
186
+ * When all `goto`s share one origin, emit them as relative paths and add a
187
+ * note to set `use.baseURL` in the Playwright config (portable across
188
+ * environments). Default false — absolute URLs that run without any config.
189
+ */
190
+ readonly baseUrl?: boolean;
191
+ }
192
+
166
193
  /**
167
194
  * Encoding quality preset. Picks the per-frame capture quality + the
168
195
  * ffmpeg encode settings used to assemble them into a video.
@@ -212,10 +239,18 @@ interface TimelineEvent {
212
239
  readonly durationMs: number;
213
240
  /** Error message, present only if the action threw. */
214
241
  readonly error?: string;
242
+ /**
243
+ * For `type` / `paste`: the actual text written, captured when
244
+ * `captureInputs` is on (the default). Omitted when capture is off or the
245
+ * target is a password field (always masked). Flows into exported code.
246
+ */
247
+ readonly inputValue?: string;
215
248
  }
216
249
  /** Structured action timeline of a recording. */
217
250
  interface Timeline {
218
251
  readonly version: 1;
252
+ /** Optional label for the recording (used as the generated test's title). */
253
+ readonly name?: string;
219
254
  readonly personality: string;
220
255
  readonly seed: string | null;
221
256
  readonly speed: string;
@@ -224,6 +259,7 @@ interface Timeline {
224
259
  }
225
260
  /** Metadata passed from `human.record()` into the Recording constructor. */
226
261
  interface RecordingTimelineSource {
262
+ readonly name?: string;
227
263
  readonly personality: string;
228
264
  readonly seed: string | null;
229
265
  readonly speed: string;
@@ -288,6 +324,30 @@ declare class Recording {
288
324
  * @returns the resolved output path.
289
325
  */
290
326
  toTimeline(outputPath: string): Promise<string>;
327
+ /**
328
+ * Generates a standalone, runnable HumanJS script from the timeline and
329
+ * writes it to `outputPath`. String selectors round-trip verbatim; typed
330
+ * values are included when `captureInputs` was on (passwords masked).
331
+ *
332
+ * Independent of frame capture — works on timeline-only recordings and is
333
+ * unaffected by `dispose()`.
334
+ *
335
+ * @returns the resolved output path.
336
+ */
337
+ toHumanJS(outputPath: string): Promise<string>;
338
+ /**
339
+ * Generates a `@playwright/test` spec from the timeline — a humanized test
340
+ * (uses `createHuman` + `human.*`), not raw Playwright — and writes it to
341
+ * `outputPath`. Runs instant in CI / recorded speed locally, drops timing
342
+ * `sleep()`s (pass `{ keepSleeps: true }` to keep them), and derives the
343
+ * assertions it safely can.
344
+ *
345
+ * Independent of frame capture — works on timeline-only recordings and is
346
+ * unaffected by `dispose()`.
347
+ *
348
+ * @returns the resolved output path.
349
+ */
350
+ toPlaywright(outputPath: string, options?: PlaywrightTestOptions): Promise<string>;
291
351
  /**
292
352
  * Releases the captured-frames temp directory. After this call, `toVideo()`
293
353
  * and `toGif()` throw — but `toTimeline()` and the in-memory `timeline`
@@ -481,6 +541,17 @@ interface Human {
481
541
  * `mouse.click({ button: 'right' })` at the coordinates.
482
542
  */
483
543
  rightClick(target: MouseTarget): Promise<void>;
544
+ /**
545
+ * Double-click `target`. Identical humanized approach to `click()` — same
546
+ * Bezier path, hover dwell, and occasional near-miss — but the final
547
+ * dispatch is a double-click (two presses within the OS double-click
548
+ * window). Accepts the same selector / `Locator` / `Point` targets.
549
+ *
550
+ * In `speed: 'instant'`, element targets fall back to
551
+ * `locator.click({ clickCount: 2 })`; a `Point` dispatches
552
+ * `mouse.click(x, y, { clickCount: 2 })`.
553
+ */
554
+ doubleClick(target: MouseTarget): Promise<void>;
484
555
  /**
485
556
  * Move the cursor to `target` along a humanized Bezier path and settle
486
557
  * on it — no click is dispatched. Useful for hover-triggered UI
@@ -547,6 +618,70 @@ interface Human {
547
618
  * by nature.
548
619
  */
549
620
  paste(target: Locator | string, value: string): Promise<void>;
621
+ /**
622
+ * Clear a text field `target` (input, textarea, or contenteditable) with a
623
+ * humanized gesture: click to focus, **select-all**, a beat, then **delete**
624
+ * — the real keyboard motion a person uses to wipe a field before retyping,
625
+ * not a silent value reset. Fires the keydown/up + `input` events the page
626
+ * expects.
627
+ *
628
+ * Pair with `type()` to edit an existing value:
629
+ * `await human.clear('#name'); await human.type('#name', 'New');`
630
+ *
631
+ * In `speed: 'instant'`, delegates to Playwright's native `locator.clear()`.
632
+ */
633
+ clear(target: Locator | string): Promise<void>;
634
+ /**
635
+ * Tick a checkbox or radio `target`. Moves the cursor to the control and
636
+ * clicks it with the same humanized motion as `click()` — but only when
637
+ * needed: if it already reports checked, no click fires (a real user
638
+ * doesn't re-click a box that's already ticked). The resulting state is
639
+ * verified; trying to `check` something that won't toggle throws.
640
+ *
641
+ * `target` is element-bound (selector or `Locator`). In `speed: 'instant'`,
642
+ * delegates to Playwright's native `locator.check()`.
643
+ */
644
+ check(target: Locator | string): Promise<void>;
645
+ /**
646
+ * Untick a checkbox `target`. Mirror of `check()` — humanized click only if
647
+ * currently checked, with state verification afterward. Radios can't be
648
+ * unchecked by clicking (select a different option instead); attempting it
649
+ * throws a clear error.
650
+ *
651
+ * In `speed: 'instant'`, delegates to `locator.uncheck()`.
652
+ */
653
+ uncheck(target: Locator | string): Promise<void>;
654
+ /**
655
+ * Choose option(s) in a native `<select>` `target`. The cursor moves to the
656
+ * dropdown and settles on it (humanized), then the value is set — native
657
+ * selects open an OS menu automation can't drive visually, so the *approach*
658
+ * is humanized while the choice itself is set programmatically (firing
659
+ * `input`/`change`), exactly as Playwright does. For custom DOM dropdowns,
660
+ * drive the rendered options with `click` instead.
661
+ *
662
+ * `values` takes the Playwright `selectOption` shape — a value string, an
663
+ * array of values, or `{ value | label | index }`. Returns the option
664
+ * values that ended up selected.
665
+ *
666
+ * In `speed: 'instant'`, sets the value with no cursor motion.
667
+ */
668
+ selectOption(target: Locator | string, values: SelectOptionValues): Promise<string[]>;
669
+ /**
670
+ * Attach file(s) to a file-input `target`. The cursor moves to the control
671
+ * (visible in recordings / the overlay), then the files are attached via
672
+ * `setInputFiles`. Unlike a real click this never opens the OS file dialog
673
+ * (which would hang) — files are set directly, the way Playwright models
674
+ * uploads.
675
+ *
676
+ * `target` should be the `<input type="file">`. For the common hidden-input-
677
+ * behind-a-styled-button pattern there's no visible control to approach, so
678
+ * the motion is skipped and the files are attached directly. `files` takes
679
+ * the Playwright `setInputFiles` shape (a path, an array of paths, or
680
+ * in-memory `{ name, mimeType, buffer }` payloads).
681
+ *
682
+ * In `speed: 'instant'`, attaches the files with no cursor motion.
683
+ */
684
+ upload(target: Locator | string, files: UploadFiles): Promise<void>;
550
685
  /**
551
686
  * Press a single key (`'Tab'`, `'Enter'`, `'Escape'`, `'ArrowDown'`, …)
552
687
  * or a keyboard chord (`'Mod+S'`, `'Cmd+Shift+P'`, `'Ctrl+C'`, …).
@@ -704,6 +839,22 @@ interface Human {
704
839
  * Not a humanized action: no plugin events fire.
705
840
  */
706
841
  content(): Promise<string>;
842
+ /**
843
+ * Accessibility-tree **outline** of the page (or a region) — every
844
+ * interactive element and landmark by its ARIA role + accessible name,
845
+ * rendered as compact YAML (Playwright's `ariaSnapshot`). The most
846
+ * token-efficient way for an AI agent to see what's actionable and pick a
847
+ * selector: the names map directly to `getByRole` / accessible-name
848
+ * selectors, which HumanJS already favors.
849
+ *
850
+ * Prefer this over {@link Human.content} when the question is "what can I
851
+ * click / fill"; reach for {@link Human.screenshot} when you need the
852
+ * visual layout. Pass `target` to scope the outline to a region.
853
+ *
854
+ * Not a humanized action: no plugin events fire. Requires Playwright ≥ 1.49
855
+ * (when `ariaSnapshot` landed).
856
+ */
857
+ outline(target?: Locator | string): Promise<string>;
707
858
  /**
708
859
  * Current URL of the page. Forwards to `page.url()`. Synchronous return
709
860
  * because Playwright's underlying API is sync.
@@ -777,6 +928,11 @@ interface Human {
777
928
  }
778
929
  /** Options for {@link Human.record}. */
779
930
  interface HumanRecordOptions {
931
+ /**
932
+ * Optional label for the recording. Stored on the timeline and used as the
933
+ * title of a generated `toPlaywright()` test.
934
+ */
935
+ readonly name?: string;
780
936
  /**
781
937
  * Whether to capture frames for video output. Defaults to `true`.
782
938
  * Set to `false` for timeline-only recordings (no capture loop, no
@@ -789,6 +945,21 @@ interface HumanRecordOptions {
789
945
  * Defaults to `'high'`. Ignored when `video: false`.
790
946
  */
791
947
  readonly quality?: RecordingQuality;
948
+ /**
949
+ * Capture the actual typed/pasted text into the timeline (and therefore
950
+ * into code generated by `toHumanJS()` / `toPlaywright()`). Defaults to
951
+ * `true`.
952
+ *
953
+ * Values typed/pasted into `input[type="password"]` are always masked
954
+ * (omitted) regardless of this flag — the video already renders them as
955
+ * dots, and freezing a cleartext secret into an artifact would leak more
956
+ * than the recording itself. Set `false` to record no input values at all;
957
+ * exporters then emit empty-string placeholders.
958
+ *
959
+ * Captured values land in the timeline JSON and any exported test, so treat
960
+ * those artifacts with the same care as the values themselves.
961
+ */
962
+ readonly captureInputs?: boolean;
792
963
  }
793
964
  /**
794
965
  * Creates a humanized session bound to a Playwright `Page`.
@@ -811,4 +982,4 @@ interface HumanRecordOptions {
811
982
  */
812
983
  declare function createHuman(page: Page, options?: CreateHumanOptions): Promise<Human>;
813
984
 
814
- export { type CreateHumanOptions, type FfmpegPreset, type FfmpegTune, type Human, type HumanRecordOptions, type InstallMouseHelperOptions, type KeyModifier, type KeyName, type KeyOrChord, type MouseTarget, type PressResult, type ReadOptions, type ReadResult, type ReadTarget, Recording, type RecordingQuality, type ScrollOptions, type ScrollResult, type ScrollTarget, type Speed, type Timeline, type TimelineEvent, type ToGifOptions, type ToVideoOptions, createHuman, installMouseHelper };
985
+ export { type CreateHumanOptions, type FfmpegPreset, type FfmpegTune, type Human, type HumanRecordOptions, type InstallMouseHelperOptions, type KeyModifier, type KeyName, type KeyOrChord, type MouseTarget, type PlaywrightTestOptions, type PressResult, type ReadOptions, type ReadResult, type ReadTarget, Recording, type RecordingQuality, type ScrollOptions, type ScrollResult, type ScrollTarget, type SelectOptionValues, type Speed, type Timeline, type TimelineEvent, type ToGifOptions, type ToVideoOptions, type UploadFiles, createHuman, installMouseHelper };