@humanjs/playwright 0.8.0 → 0.9.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/{chunk-CCZEDNOF.js → chunk-3TXDODCO.js} +200 -118
- package/dist/chunk-3TXDODCO.js.map +1 -0
- package/dist/{chunk-RCMSDC3N.cjs → chunk-3X36PFTS.cjs} +201 -117
- package/dist/chunk-3X36PFTS.cjs.map +1 -0
- package/dist/index.cjs +31 -23
- package/dist/index.d.cts +63 -14
- package/dist/index.d.ts +63 -14
- package/dist/index.js +1 -1
- package/dist/test.cjs +5 -2
- package/dist/test.cjs.map +1 -1
- package/dist/test.js +4 -1
- package/dist/test.js.map +1 -1
- package/package.json +2 -2
- package/dist/chunk-CCZEDNOF.js.map +0 -1
- package/dist/chunk-RCMSDC3N.cjs.map +0 -1
package/dist/index.cjs
CHANGED
|
@@ -1,96 +1,104 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3X36PFTS_cjs = require('./chunk-3X36PFTS.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
Object.defineProperty(exports, "Recording", {
|
|
8
8
|
enumerable: true,
|
|
9
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunk3X36PFTS_cjs.Recording; }
|
|
10
10
|
});
|
|
11
11
|
Object.defineProperty(exports, "applyMicroJitter", {
|
|
12
12
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
13
|
+
get: function () { return chunk3X36PFTS_cjs.applyMicroJitter; }
|
|
14
14
|
});
|
|
15
15
|
Object.defineProperty(exports, "applyVelocityProfile", {
|
|
16
16
|
enumerable: true,
|
|
17
|
-
get: function () { return
|
|
17
|
+
get: function () { return chunk3X36PFTS_cjs.applyVelocityProfile; }
|
|
18
18
|
});
|
|
19
19
|
Object.defineProperty(exports, "bezierPath", {
|
|
20
20
|
enumerable: true,
|
|
21
|
-
get: function () { return
|
|
21
|
+
get: function () { return chunk3X36PFTS_cjs.bezierPath; }
|
|
22
22
|
});
|
|
23
23
|
Object.defineProperty(exports, "blend", {
|
|
24
24
|
enumerable: true,
|
|
25
|
-
get: function () { return
|
|
25
|
+
get: function () { return chunk3X36PFTS_cjs.blend; }
|
|
26
26
|
});
|
|
27
27
|
Object.defineProperty(exports, "careful", {
|
|
28
28
|
enumerable: true,
|
|
29
|
-
get: function () { return
|
|
29
|
+
get: function () { return chunk3X36PFTS_cjs.careful; }
|
|
30
30
|
});
|
|
31
31
|
Object.defineProperty(exports, "chromium", {
|
|
32
32
|
enumerable: true,
|
|
33
|
-
get: function () { return
|
|
33
|
+
get: function () { return chunk3X36PFTS_cjs.chromium; }
|
|
34
34
|
});
|
|
35
35
|
Object.defineProperty(exports, "computeReadingDwellMs", {
|
|
36
36
|
enumerable: true,
|
|
37
|
-
get: function () { return
|
|
37
|
+
get: function () { return chunk3X36PFTS_cjs.computeReadingDwellMs; }
|
|
38
38
|
});
|
|
39
39
|
Object.defineProperty(exports, "countWords", {
|
|
40
40
|
enumerable: true,
|
|
41
|
-
get: function () { return
|
|
41
|
+
get: function () { return chunk3X36PFTS_cjs.countWords; }
|
|
42
42
|
});
|
|
43
43
|
Object.defineProperty(exports, "createHuman", {
|
|
44
44
|
enumerable: true,
|
|
45
|
-
get: function () { return
|
|
45
|
+
get: function () { return chunk3X36PFTS_cjs.createHuman; }
|
|
46
46
|
});
|
|
47
47
|
Object.defineProperty(exports, "createRng", {
|
|
48
48
|
enumerable: true,
|
|
49
|
-
get: function () { return
|
|
49
|
+
get: function () { return chunk3X36PFTS_cjs.createRng; }
|
|
50
50
|
});
|
|
51
51
|
Object.defineProperty(exports, "distracted", {
|
|
52
52
|
enumerable: true,
|
|
53
|
-
get: function () { return
|
|
53
|
+
get: function () { return chunk3X36PFTS_cjs.distracted; }
|
|
54
54
|
});
|
|
55
55
|
Object.defineProperty(exports, "fast", {
|
|
56
56
|
enumerable: true,
|
|
57
|
-
get: function () { return
|
|
57
|
+
get: function () { return chunk3X36PFTS_cjs.fast; }
|
|
58
58
|
});
|
|
59
59
|
Object.defineProperty(exports, "firefox", {
|
|
60
60
|
enumerable: true,
|
|
61
|
-
get: function () { return
|
|
61
|
+
get: function () { return chunk3X36PFTS_cjs.firefox; }
|
|
62
|
+
});
|
|
63
|
+
Object.defineProperty(exports, "generateHumanJS", {
|
|
64
|
+
enumerable: true,
|
|
65
|
+
get: function () { return chunk3X36PFTS_cjs.generateHumanJS; }
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, "generatePlaywrightTest", {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () { return chunk3X36PFTS_cjs.generatePlaywrightTest; }
|
|
62
70
|
});
|
|
63
71
|
Object.defineProperty(exports, "humanizePath", {
|
|
64
72
|
enumerable: true,
|
|
65
|
-
get: function () { return
|
|
73
|
+
get: function () { return chunk3X36PFTS_cjs.humanizePath; }
|
|
66
74
|
});
|
|
67
75
|
Object.defineProperty(exports, "installMouseHelper", {
|
|
68
76
|
enumerable: true,
|
|
69
|
-
get: function () { return
|
|
77
|
+
get: function () { return chunk3X36PFTS_cjs.installMouseHelper; }
|
|
70
78
|
});
|
|
71
79
|
Object.defineProperty(exports, "planScroll", {
|
|
72
80
|
enumerable: true,
|
|
73
|
-
get: function () { return
|
|
81
|
+
get: function () { return chunk3X36PFTS_cjs.planScroll; }
|
|
74
82
|
});
|
|
75
83
|
Object.defineProperty(exports, "planTypeKeystrokes", {
|
|
76
84
|
enumerable: true,
|
|
77
|
-
get: function () { return
|
|
85
|
+
get: function () { return chunk3X36PFTS_cjs.planTypeKeystrokes; }
|
|
78
86
|
});
|
|
79
87
|
Object.defineProperty(exports, "precise", {
|
|
80
88
|
enumerable: true,
|
|
81
|
-
get: function () { return
|
|
89
|
+
get: function () { return chunk3X36PFTS_cjs.precise; }
|
|
82
90
|
});
|
|
83
91
|
Object.defineProperty(exports, "resolvePersonality", {
|
|
84
92
|
enumerable: true,
|
|
85
|
-
get: function () { return
|
|
93
|
+
get: function () { return chunk3X36PFTS_cjs.resolvePersonality; }
|
|
86
94
|
});
|
|
87
95
|
Object.defineProperty(exports, "sleep", {
|
|
88
96
|
enumerable: true,
|
|
89
|
-
get: function () { return
|
|
97
|
+
get: function () { return chunk3X36PFTS_cjs.sleep; }
|
|
90
98
|
});
|
|
91
99
|
Object.defineProperty(exports, "webkit", {
|
|
92
100
|
enumerable: true,
|
|
93
|
-
get: function () { return
|
|
101
|
+
get: function () { return chunk3X36PFTS_cjs.webkit; }
|
|
94
102
|
});
|
|
95
103
|
//# sourceMappingURL=index.cjs.map
|
|
96
104
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -81,6 +81,22 @@ interface PressResult {
|
|
|
81
81
|
readonly dispatched: string;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/** Options for {@link installMouseHelper}. */
|
|
85
|
+
interface InstallMouseHelperOptions {
|
|
86
|
+
/** Cursor fill color. Defaults to the HumanJS amber `#f5a55c`. */
|
|
87
|
+
readonly color?: string;
|
|
88
|
+
/** Cursor visual size in pixels. Defaults to 22. */
|
|
89
|
+
readonly size?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Render a ripple at each `mousedown` position so clicks read on video.
|
|
92
|
+
* Defaults to `true`.
|
|
93
|
+
*/
|
|
94
|
+
readonly showClicks?: boolean;
|
|
95
|
+
/** Halo opacity behind the cursor. Defaults to `0.18`. */
|
|
96
|
+
readonly haloOpacity?: number;
|
|
97
|
+
}
|
|
98
|
+
declare function installMouseHelper(target: BrowserContext | Page, options?: InstallMouseHelperOptions): Promise<void>;
|
|
99
|
+
|
|
84
100
|
/**
|
|
85
101
|
* What to read:
|
|
86
102
|
* - `string`: a Playwright-compatible selector (matches `click()` / `type()`).
|
|
@@ -168,6 +184,12 @@ interface CaptureResult {
|
|
|
168
184
|
cleanup(): Promise<void>;
|
|
169
185
|
}
|
|
170
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Generates a standalone, runnable HumanJS script that replays the recorded
|
|
189
|
+
* session. String selectors round-trip verbatim; raw coordinates and
|
|
190
|
+
* un-captured inputs are emitted with a flag so they're easy to fix up.
|
|
191
|
+
*/
|
|
192
|
+
declare function generateHumanJS(timeline: Timeline): string;
|
|
171
193
|
/** Options for {@link generatePlaywrightTest} / `Recording.toPlaywright`. */
|
|
172
194
|
interface PlaywrightTestOptions {
|
|
173
195
|
/**
|
|
@@ -189,6 +211,15 @@ interface PlaywrightTestOptions {
|
|
|
189
211
|
*/
|
|
190
212
|
readonly baseUrl?: boolean;
|
|
191
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Generates a `@playwright/test` spec that replays the session through
|
|
216
|
+
* HumanJS — a humanized test, not raw Playwright, since the humanization is
|
|
217
|
+
* the point. Uses the `@humanjs/playwright/test` fixture for the `human`
|
|
218
|
+
* (recorded personality / seed / speed applied via `test.use({ humanOptions })`),
|
|
219
|
+
* runs instant in CI / recorded speed locally, drops timing `sleep()`s by
|
|
220
|
+
* default, and derives the assertions it safely can.
|
|
221
|
+
*/
|
|
222
|
+
declare function generatePlaywrightTest(timeline: Timeline, options?: PlaywrightTestOptions): string;
|
|
192
223
|
|
|
193
224
|
/**
|
|
194
225
|
* Encoding quality preset. Picks the per-frame capture quality + the
|
|
@@ -463,22 +494,15 @@ interface ScrollResult {
|
|
|
463
494
|
readonly durationMs: number;
|
|
464
495
|
}
|
|
465
496
|
|
|
466
|
-
/** Options for {@link
|
|
467
|
-
interface
|
|
468
|
-
/** Cursor fill color. Defaults to the HumanJS amber `#f5a55c`. */
|
|
469
|
-
readonly color?: string;
|
|
470
|
-
/** Cursor visual size in pixels. Defaults to 22. */
|
|
471
|
-
readonly size?: number;
|
|
497
|
+
/** Options for {@link Human.selectText}. */
|
|
498
|
+
interface SelectTextOptions {
|
|
472
499
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
500
|
+
* Select only this substring of the element's text instead of all of it.
|
|
501
|
+
* Located inside the element whitespace-tolerantly (first match); falls back
|
|
502
|
+
* to selecting the whole element when not found.
|
|
475
503
|
*/
|
|
476
|
-
|
|
477
|
-
/** Halo opacity behind the cursor. Defaults to `0.18`. */
|
|
478
|
-
readonly haloOpacity?: number;
|
|
504
|
+
text?: string;
|
|
479
505
|
}
|
|
480
|
-
declare function installMouseHelper(target: BrowserContext | Page, options?: InstallMouseHelperOptions): Promise<void>;
|
|
481
|
-
|
|
482
506
|
/**
|
|
483
507
|
* How fast the humanized session runs.
|
|
484
508
|
* - `'human'` — full humanization (default)
|
|
@@ -496,6 +520,14 @@ interface CreateHumanOptions {
|
|
|
496
520
|
readonly speed?: Speed;
|
|
497
521
|
/** Plugins installed on this session, invoked in registration order. */
|
|
498
522
|
readonly plugins?: readonly HumanPlugin[];
|
|
523
|
+
/**
|
|
524
|
+
* Visual cursor overlay ({@link installMouseHelper}) so humanized motion is
|
|
525
|
+
* visible in headed runs and recordings. **On by default.** Pass `false` to
|
|
526
|
+
* opt out — do this for `speed: 'instant'` / CI, where there's no motion to
|
|
527
|
+
* show and the injected cursor would land in test DOM and screenshots. Pass
|
|
528
|
+
* an options object to style it (color, size, …).
|
|
529
|
+
*/
|
|
530
|
+
readonly cursor?: boolean | InstallMouseHelperOptions;
|
|
499
531
|
/**
|
|
500
532
|
* Starting cursor position used as the origin of the first humanized path.
|
|
501
533
|
* Defaults to `{ x: 0, y: 0 }`. Set this if you've already moved the cursor
|
|
@@ -666,6 +698,23 @@ interface Human {
|
|
|
666
698
|
* In `speed: 'instant'`, sets the value with no cursor motion.
|
|
667
699
|
*/
|
|
668
700
|
selectOption(target: Locator | string, values: SelectOptionValues): Promise<string[]>;
|
|
701
|
+
/**
|
|
702
|
+
* Select text inside `target` (a paragraph, heading, input, …). The cursor
|
|
703
|
+
* moves to the element (humanized), then the text is highlighted — the
|
|
704
|
+
* "select this" gesture before copying, replacing, or triggering a highlight
|
|
705
|
+
* menu.
|
|
706
|
+
*
|
|
707
|
+
* By default the element's whole text is selected. Pass `{ text }` to select
|
|
708
|
+
* just that substring: HumanJS finds it inside the element (whitespace-
|
|
709
|
+
* tolerant, mapped to exact offsets, first match) and selects only that
|
|
710
|
+
* range — so a recorded partial highlight reproduces as itself, not the whole
|
|
711
|
+
* element. If the text can't be located, it falls back to selecting all of
|
|
712
|
+
* the element.
|
|
713
|
+
*
|
|
714
|
+
* `target` is element-bound (selector or `Locator`). In `speed: 'instant'`
|
|
715
|
+
* the cursor motion is skipped; the selection is still applied.
|
|
716
|
+
*/
|
|
717
|
+
selectText(target: Locator | string, options?: SelectTextOptions): Promise<void>;
|
|
669
718
|
/**
|
|
670
719
|
* Attach file(s) to a file-input `target`. The cursor moves to the control
|
|
671
720
|
* (visible in recordings / the overlay), then the files are attached via
|
|
@@ -982,4 +1031,4 @@ interface HumanRecordOptions {
|
|
|
982
1031
|
*/
|
|
983
1032
|
declare function createHuman(page: Page, options?: CreateHumanOptions): Promise<Human>;
|
|
984
1033
|
|
|
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 };
|
|
1034
|
+
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 SelectTextOptions, type Speed, type Timeline, type TimelineEvent, type ToGifOptions, type ToVideoOptions, type UploadFiles, createHuman, generateHumanJS, generatePlaywrightTest, installMouseHelper };
|
package/dist/index.d.ts
CHANGED
|
@@ -81,6 +81,22 @@ interface PressResult {
|
|
|
81
81
|
readonly dispatched: string;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
/** Options for {@link installMouseHelper}. */
|
|
85
|
+
interface InstallMouseHelperOptions {
|
|
86
|
+
/** Cursor fill color. Defaults to the HumanJS amber `#f5a55c`. */
|
|
87
|
+
readonly color?: string;
|
|
88
|
+
/** Cursor visual size in pixels. Defaults to 22. */
|
|
89
|
+
readonly size?: number;
|
|
90
|
+
/**
|
|
91
|
+
* Render a ripple at each `mousedown` position so clicks read on video.
|
|
92
|
+
* Defaults to `true`.
|
|
93
|
+
*/
|
|
94
|
+
readonly showClicks?: boolean;
|
|
95
|
+
/** Halo opacity behind the cursor. Defaults to `0.18`. */
|
|
96
|
+
readonly haloOpacity?: number;
|
|
97
|
+
}
|
|
98
|
+
declare function installMouseHelper(target: BrowserContext | Page, options?: InstallMouseHelperOptions): Promise<void>;
|
|
99
|
+
|
|
84
100
|
/**
|
|
85
101
|
* What to read:
|
|
86
102
|
* - `string`: a Playwright-compatible selector (matches `click()` / `type()`).
|
|
@@ -168,6 +184,12 @@ interface CaptureResult {
|
|
|
168
184
|
cleanup(): Promise<void>;
|
|
169
185
|
}
|
|
170
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Generates a standalone, runnable HumanJS script that replays the recorded
|
|
189
|
+
* session. String selectors round-trip verbatim; raw coordinates and
|
|
190
|
+
* un-captured inputs are emitted with a flag so they're easy to fix up.
|
|
191
|
+
*/
|
|
192
|
+
declare function generateHumanJS(timeline: Timeline): string;
|
|
171
193
|
/** Options for {@link generatePlaywrightTest} / `Recording.toPlaywright`. */
|
|
172
194
|
interface PlaywrightTestOptions {
|
|
173
195
|
/**
|
|
@@ -189,6 +211,15 @@ interface PlaywrightTestOptions {
|
|
|
189
211
|
*/
|
|
190
212
|
readonly baseUrl?: boolean;
|
|
191
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Generates a `@playwright/test` spec that replays the session through
|
|
216
|
+
* HumanJS — a humanized test, not raw Playwright, since the humanization is
|
|
217
|
+
* the point. Uses the `@humanjs/playwright/test` fixture for the `human`
|
|
218
|
+
* (recorded personality / seed / speed applied via `test.use({ humanOptions })`),
|
|
219
|
+
* runs instant in CI / recorded speed locally, drops timing `sleep()`s by
|
|
220
|
+
* default, and derives the assertions it safely can.
|
|
221
|
+
*/
|
|
222
|
+
declare function generatePlaywrightTest(timeline: Timeline, options?: PlaywrightTestOptions): string;
|
|
192
223
|
|
|
193
224
|
/**
|
|
194
225
|
* Encoding quality preset. Picks the per-frame capture quality + the
|
|
@@ -463,22 +494,15 @@ interface ScrollResult {
|
|
|
463
494
|
readonly durationMs: number;
|
|
464
495
|
}
|
|
465
496
|
|
|
466
|
-
/** Options for {@link
|
|
467
|
-
interface
|
|
468
|
-
/** Cursor fill color. Defaults to the HumanJS amber `#f5a55c`. */
|
|
469
|
-
readonly color?: string;
|
|
470
|
-
/** Cursor visual size in pixels. Defaults to 22. */
|
|
471
|
-
readonly size?: number;
|
|
497
|
+
/** Options for {@link Human.selectText}. */
|
|
498
|
+
interface SelectTextOptions {
|
|
472
499
|
/**
|
|
473
|
-
*
|
|
474
|
-
*
|
|
500
|
+
* Select only this substring of the element's text instead of all of it.
|
|
501
|
+
* Located inside the element whitespace-tolerantly (first match); falls back
|
|
502
|
+
* to selecting the whole element when not found.
|
|
475
503
|
*/
|
|
476
|
-
|
|
477
|
-
/** Halo opacity behind the cursor. Defaults to `0.18`. */
|
|
478
|
-
readonly haloOpacity?: number;
|
|
504
|
+
text?: string;
|
|
479
505
|
}
|
|
480
|
-
declare function installMouseHelper(target: BrowserContext | Page, options?: InstallMouseHelperOptions): Promise<void>;
|
|
481
|
-
|
|
482
506
|
/**
|
|
483
507
|
* How fast the humanized session runs.
|
|
484
508
|
* - `'human'` — full humanization (default)
|
|
@@ -496,6 +520,14 @@ interface CreateHumanOptions {
|
|
|
496
520
|
readonly speed?: Speed;
|
|
497
521
|
/** Plugins installed on this session, invoked in registration order. */
|
|
498
522
|
readonly plugins?: readonly HumanPlugin[];
|
|
523
|
+
/**
|
|
524
|
+
* Visual cursor overlay ({@link installMouseHelper}) so humanized motion is
|
|
525
|
+
* visible in headed runs and recordings. **On by default.** Pass `false` to
|
|
526
|
+
* opt out — do this for `speed: 'instant'` / CI, where there's no motion to
|
|
527
|
+
* show and the injected cursor would land in test DOM and screenshots. Pass
|
|
528
|
+
* an options object to style it (color, size, …).
|
|
529
|
+
*/
|
|
530
|
+
readonly cursor?: boolean | InstallMouseHelperOptions;
|
|
499
531
|
/**
|
|
500
532
|
* Starting cursor position used as the origin of the first humanized path.
|
|
501
533
|
* Defaults to `{ x: 0, y: 0 }`. Set this if you've already moved the cursor
|
|
@@ -666,6 +698,23 @@ interface Human {
|
|
|
666
698
|
* In `speed: 'instant'`, sets the value with no cursor motion.
|
|
667
699
|
*/
|
|
668
700
|
selectOption(target: Locator | string, values: SelectOptionValues): Promise<string[]>;
|
|
701
|
+
/**
|
|
702
|
+
* Select text inside `target` (a paragraph, heading, input, …). The cursor
|
|
703
|
+
* moves to the element (humanized), then the text is highlighted — the
|
|
704
|
+
* "select this" gesture before copying, replacing, or triggering a highlight
|
|
705
|
+
* menu.
|
|
706
|
+
*
|
|
707
|
+
* By default the element's whole text is selected. Pass `{ text }` to select
|
|
708
|
+
* just that substring: HumanJS finds it inside the element (whitespace-
|
|
709
|
+
* tolerant, mapped to exact offsets, first match) and selects only that
|
|
710
|
+
* range — so a recorded partial highlight reproduces as itself, not the whole
|
|
711
|
+
* element. If the text can't be located, it falls back to selecting all of
|
|
712
|
+
* the element.
|
|
713
|
+
*
|
|
714
|
+
* `target` is element-bound (selector or `Locator`). In `speed: 'instant'`
|
|
715
|
+
* the cursor motion is skipped; the selection is still applied.
|
|
716
|
+
*/
|
|
717
|
+
selectText(target: Locator | string, options?: SelectTextOptions): Promise<void>;
|
|
669
718
|
/**
|
|
670
719
|
* Attach file(s) to a file-input `target`. The cursor moves to the control
|
|
671
720
|
* (visible in recordings / the overlay), then the files are attached via
|
|
@@ -982,4 +1031,4 @@ interface HumanRecordOptions {
|
|
|
982
1031
|
*/
|
|
983
1032
|
declare function createHuman(page: Page, options?: CreateHumanOptions): Promise<Human>;
|
|
984
1033
|
|
|
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 };
|
|
1034
|
+
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 SelectTextOptions, type Speed, type Timeline, type TimelineEvent, type ToGifOptions, type ToVideoOptions, type UploadFiles, createHuman, generateHumanJS, generatePlaywrightTest, installMouseHelper };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Recording, applyMicroJitter, applyVelocityProfile, bezierPath, blend, careful, chromium, computeReadingDwellMs, countWords, createHuman, createRng, distracted, fast, firefox, humanizePath, installMouseHelper, planScroll, planTypeKeystrokes, precise, resolvePersonality, sleep, webkit } from './chunk-
|
|
1
|
+
export { Recording, applyMicroJitter, applyVelocityProfile, bezierPath, blend, careful, chromium, computeReadingDwellMs, countWords, createHuman, createRng, distracted, fast, firefox, generateHumanJS, generatePlaywrightTest, humanizePath, installMouseHelper, planScroll, planTypeKeystrokes, precise, resolvePersonality, sleep, webkit } from './chunk-3TXDODCO.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
3
3
|
//# sourceMappingURL=index.js.map
|
package/dist/test.cjs
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk3X36PFTS_cjs = require('./chunk-3X36PFTS.cjs');
|
|
4
4
|
var test$1 = require('@playwright/test');
|
|
5
5
|
|
|
6
6
|
var test = test$1.test.extend({
|
|
7
7
|
humanOptions: [{}, { option: true }],
|
|
8
8
|
human: async ({ page, humanOptions }, use, testInfo) => {
|
|
9
|
-
const human = await
|
|
9
|
+
const human = await chunk3X36PFTS_cjs.createHuman(page, {
|
|
10
10
|
// Deterministic per test, CI-fast by default — both overridable since
|
|
11
11
|
// the spread comes last.
|
|
12
12
|
seed: testInfo.title,
|
|
13
13
|
speed: process.env.CI ? "instant" : "human",
|
|
14
|
+
// No cursor overlay in CI (instant) so it never lands in test DOM or
|
|
15
|
+
// screenshots; shown locally where you actually watch the run.
|
|
16
|
+
cursor: !process.env.CI,
|
|
14
17
|
...humanOptions
|
|
15
18
|
});
|
|
16
19
|
await use(human);
|
package/dist/test.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/test/index.ts"],"names":["base","createHuman"],"mappings":";;;;;AAyDO,IAAM,IAAA,GAAOA,YAAK,MAAA,CAAqC;AAAA,EAC5D,cAAc,CAAC,IAAI,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACnC,OAAO,OAAO,EAAE,MAAM,YAAA,EAAa,EAAG,KAAK,QAAA,KAAa;AACtD,IAAA,MAAM,KAAA,GAAQ,MAAMC,6BAAA,CAAY,IAAA,EAAM;AAAA;AAAA;AAAA,MAGpC,MAAM,QAAA,CAAS,KAAA;AAAA,MACf,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,EAAA,GAAK,SAAA,GAAY,OAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/test/index.ts"],"names":["base","createHuman"],"mappings":";;;;;AAyDO,IAAM,IAAA,GAAOA,YAAK,MAAA,CAAqC;AAAA,EAC5D,cAAc,CAAC,IAAI,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACnC,OAAO,OAAO,EAAE,MAAM,YAAA,EAAa,EAAG,KAAK,QAAA,KAAa;AACtD,IAAA,MAAM,KAAA,GAAQ,MAAMC,6BAAA,CAAY,IAAA,EAAM;AAAA;AAAA;AAAA,MAGpC,MAAM,QAAA,CAAS,KAAA;AAAA,MACf,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,EAAA,GAAK,SAAA,GAAY,OAAA;AAAA;AAAA;AAAA,MAGpC,MAAA,EAAQ,CAAC,OAAA,CAAQ,GAAA,CAAI,EAAA;AAAA,MACrB,GAAG;AAAA,KACJ,CAAA;AACD,IAAA,MAAM,IAAI,KAAK,CAAA;AAAA,EACjB;AACF,CAAC","file":"test.cjs","sourcesContent":["/**\n * Playwright Test integration — opt-in via the `@humanjs/playwright/test`\n * subpath. Re-exports `test` / `expect` from `@playwright/test` with a\n * pre-wired `human` fixture, so a spec never hand-rolls `createHuman`.\n *\n * Each test gets a {@link Human} bound to its `page`, **seeded from the test\n * title** (deterministic per test, so snapshots stay stable) and **instant in\n * CI / humanized locally** (fast pipelines, real-pace runs at your desk).\n * Override any of that per-file or per-project with the `humanOptions` option.\n *\n * `@playwright/test` is an optional peer — it's how you run Playwright tests,\n * so the host already provides it. Keeping the fixture on a subpath means the\n * package root never pulls in the test runner.\n *\n * @example\n * ```ts\n * import { test, expect } from '@humanjs/playwright/test';\n *\n * test('checkout', async ({ human, page }) => {\n * await human.goto('/cart');\n * await human.click('Checkout');\n * await expect(page).toHaveURL(/success/);\n * });\n *\n * // Customize for a file (or a whole project via playwright.config.ts):\n * test.use({ humanOptions: { personality: 'distracted', speed: 'human' } });\n * ```\n */\n\nimport { test as base } from '@playwright/test';\nimport { type CreateHumanOptions, createHuman, type Human } from '../index';\n\n/** Test-scoped fixtures added by `@humanjs/playwright/test`. */\nexport interface HumanFixtures {\n /**\n * A {@link Human} bound to the test's `page`. Created fresh per test; by\n * default seeded from the test title and run instant in CI, humanized\n * locally. Tune via the `humanOptions` option.\n */\n human: Human;\n}\n\n/** Option fixture to customize the per-test {@link Human}. */\nexport interface HumanOptions {\n /**\n * Options forwarded to `createHuman` for the `human` fixture. Set with\n * `test.use({ humanOptions: { … } })` (per file) or in `playwright.config.ts`\n * `use` (per project). Defaults: `seed` = the test title, `speed` =\n * `'instant'` in CI else `'human'`. Anything you set here overrides those.\n */\n humanOptions: CreateHumanOptions;\n}\n\n/**\n * Playwright `test` extended with the `human` fixture. Drop-in replacement\n * for `@playwright/test`'s `test`.\n */\nexport const test = base.extend<HumanFixtures & HumanOptions>({\n humanOptions: [{}, { option: true }],\n human: async ({ page, humanOptions }, use, testInfo) => {\n const human = await createHuman(page, {\n // Deterministic per test, CI-fast by default — both overridable since\n // the spread comes last.\n seed: testInfo.title,\n speed: process.env.CI ? 'instant' : 'human',\n // No cursor overlay in CI (instant) so it never lands in test DOM or\n // screenshots; shown locally where you actually watch the run.\n cursor: !process.env.CI,\n ...humanOptions,\n });\n await use(human);\n },\n});\n\nexport { expect } from '@playwright/test';\n"]}
|
package/dist/test.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createHuman } from './chunk-
|
|
1
|
+
import { createHuman } from './chunk-3TXDODCO.js';
|
|
2
2
|
import { test as test$1 } from '@playwright/test';
|
|
3
3
|
export { expect } from '@playwright/test';
|
|
4
4
|
|
|
@@ -10,6 +10,9 @@ var test = test$1.extend({
|
|
|
10
10
|
// the spread comes last.
|
|
11
11
|
seed: testInfo.title,
|
|
12
12
|
speed: process.env.CI ? "instant" : "human",
|
|
13
|
+
// No cursor overlay in CI (instant) so it never lands in test DOM or
|
|
14
|
+
// screenshots; shown locally where you actually watch the run.
|
|
15
|
+
cursor: !process.env.CI,
|
|
13
16
|
...humanOptions
|
|
14
17
|
});
|
|
15
18
|
await use(human);
|
package/dist/test.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/test/index.ts"],"names":["base"],"mappings":";;;;AAyDO,IAAM,IAAA,GAAOA,OAAK,MAAA,CAAqC;AAAA,EAC5D,cAAc,CAAC,IAAI,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACnC,OAAO,OAAO,EAAE,MAAM,YAAA,EAAa,EAAG,KAAK,QAAA,KAAa;AACtD,IAAA,MAAM,KAAA,GAAQ,MAAM,WAAA,CAAY,IAAA,EAAM;AAAA;AAAA;AAAA,MAGpC,MAAM,QAAA,CAAS,KAAA;AAAA,MACf,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,EAAA,GAAK,SAAA,GAAY,OAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../src/test/index.ts"],"names":["base"],"mappings":";;;;AAyDO,IAAM,IAAA,GAAOA,OAAK,MAAA,CAAqC;AAAA,EAC5D,cAAc,CAAC,IAAI,EAAE,MAAA,EAAQ,MAAM,CAAA;AAAA,EACnC,OAAO,OAAO,EAAE,MAAM,YAAA,EAAa,EAAG,KAAK,QAAA,KAAa;AACtD,IAAA,MAAM,KAAA,GAAQ,MAAM,WAAA,CAAY,IAAA,EAAM;AAAA;AAAA;AAAA,MAGpC,MAAM,QAAA,CAAS,KAAA;AAAA,MACf,KAAA,EAAO,OAAA,CAAQ,GAAA,CAAI,EAAA,GAAK,SAAA,GAAY,OAAA;AAAA;AAAA;AAAA,MAGpC,MAAA,EAAQ,CAAC,OAAA,CAAQ,GAAA,CAAI,EAAA;AAAA,MACrB,GAAG;AAAA,KACJ,CAAA;AACD,IAAA,MAAM,IAAI,KAAK,CAAA;AAAA,EACjB;AACF,CAAC","file":"test.js","sourcesContent":["/**\n * Playwright Test integration — opt-in via the `@humanjs/playwright/test`\n * subpath. Re-exports `test` / `expect` from `@playwright/test` with a\n * pre-wired `human` fixture, so a spec never hand-rolls `createHuman`.\n *\n * Each test gets a {@link Human} bound to its `page`, **seeded from the test\n * title** (deterministic per test, so snapshots stay stable) and **instant in\n * CI / humanized locally** (fast pipelines, real-pace runs at your desk).\n * Override any of that per-file or per-project with the `humanOptions` option.\n *\n * `@playwright/test` is an optional peer — it's how you run Playwright tests,\n * so the host already provides it. Keeping the fixture on a subpath means the\n * package root never pulls in the test runner.\n *\n * @example\n * ```ts\n * import { test, expect } from '@humanjs/playwright/test';\n *\n * test('checkout', async ({ human, page }) => {\n * await human.goto('/cart');\n * await human.click('Checkout');\n * await expect(page).toHaveURL(/success/);\n * });\n *\n * // Customize for a file (or a whole project via playwright.config.ts):\n * test.use({ humanOptions: { personality: 'distracted', speed: 'human' } });\n * ```\n */\n\nimport { test as base } from '@playwright/test';\nimport { type CreateHumanOptions, createHuman, type Human } from '../index';\n\n/** Test-scoped fixtures added by `@humanjs/playwright/test`. */\nexport interface HumanFixtures {\n /**\n * A {@link Human} bound to the test's `page`. Created fresh per test; by\n * default seeded from the test title and run instant in CI, humanized\n * locally. Tune via the `humanOptions` option.\n */\n human: Human;\n}\n\n/** Option fixture to customize the per-test {@link Human}. */\nexport interface HumanOptions {\n /**\n * Options forwarded to `createHuman` for the `human` fixture. Set with\n * `test.use({ humanOptions: { … } })` (per file) or in `playwright.config.ts`\n * `use` (per project). Defaults: `seed` = the test title, `speed` =\n * `'instant'` in CI else `'human'`. Anything you set here overrides those.\n */\n humanOptions: CreateHumanOptions;\n}\n\n/**\n * Playwright `test` extended with the `human` fixture. Drop-in replacement\n * for `@playwright/test`'s `test`.\n */\nexport const test = base.extend<HumanFixtures & HumanOptions>({\n humanOptions: [{}, { option: true }],\n human: async ({ page, humanOptions }, use, testInfo) => {\n const human = await createHuman(page, {\n // Deterministic per test, CI-fast by default — both overridable since\n // the spread comes last.\n seed: testInfo.title,\n speed: process.env.CI ? 'instant' : 'human',\n // No cursor overlay in CI (instant) so it never lands in test DOM or\n // screenshots; shown locally where you actually watch the run.\n cursor: !process.env.CI,\n ...humanOptions,\n });\n await use(human);\n },\n});\n\nexport { expect } from '@playwright/test';\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@humanjs/playwright",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Humanize Playwright sessions for AI agents, QA tests, and demos.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"humanjs",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"ffmpeg-static": "^5.2.0",
|
|
66
|
-
"@humanjs/core": "0.
|
|
66
|
+
"@humanjs/core": "0.8.0"
|
|
67
67
|
},
|
|
68
68
|
"peerDependencies": {
|
|
69
69
|
"playwright": ">=1.49.0",
|