@humanjs/playwright 0.9.0 → 0.10.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.cjs CHANGED
@@ -1,104 +1,108 @@
1
1
  'use strict';
2
2
 
3
- var chunk3X36PFTS_cjs = require('./chunk-3X36PFTS.cjs');
3
+ var chunk665R4N7R_cjs = require('./chunk-665R4N7R.cjs');
4
4
 
5
5
 
6
6
 
7
7
  Object.defineProperty(exports, "Recording", {
8
8
  enumerable: true,
9
- get: function () { return chunk3X36PFTS_cjs.Recording; }
9
+ get: function () { return chunk665R4N7R_cjs.Recording; }
10
10
  });
11
11
  Object.defineProperty(exports, "applyMicroJitter", {
12
12
  enumerable: true,
13
- get: function () { return chunk3X36PFTS_cjs.applyMicroJitter; }
13
+ get: function () { return chunk665R4N7R_cjs.applyMicroJitter; }
14
14
  });
15
15
  Object.defineProperty(exports, "applyVelocityProfile", {
16
16
  enumerable: true,
17
- get: function () { return chunk3X36PFTS_cjs.applyVelocityProfile; }
17
+ get: function () { return chunk665R4N7R_cjs.applyVelocityProfile; }
18
18
  });
19
19
  Object.defineProperty(exports, "bezierPath", {
20
20
  enumerable: true,
21
- get: function () { return chunk3X36PFTS_cjs.bezierPath; }
21
+ get: function () { return chunk665R4N7R_cjs.bezierPath; }
22
22
  });
23
23
  Object.defineProperty(exports, "blend", {
24
24
  enumerable: true,
25
- get: function () { return chunk3X36PFTS_cjs.blend; }
25
+ get: function () { return chunk665R4N7R_cjs.blend; }
26
26
  });
27
27
  Object.defineProperty(exports, "careful", {
28
28
  enumerable: true,
29
- get: function () { return chunk3X36PFTS_cjs.careful; }
29
+ get: function () { return chunk665R4N7R_cjs.careful; }
30
30
  });
31
31
  Object.defineProperty(exports, "chromium", {
32
32
  enumerable: true,
33
- get: function () { return chunk3X36PFTS_cjs.chromium; }
33
+ get: function () { return chunk665R4N7R_cjs.chromium; }
34
34
  });
35
35
  Object.defineProperty(exports, "computeReadingDwellMs", {
36
36
  enumerable: true,
37
- get: function () { return chunk3X36PFTS_cjs.computeReadingDwellMs; }
37
+ get: function () { return chunk665R4N7R_cjs.computeReadingDwellMs; }
38
38
  });
39
39
  Object.defineProperty(exports, "countWords", {
40
40
  enumerable: true,
41
- get: function () { return chunk3X36PFTS_cjs.countWords; }
41
+ get: function () { return chunk665R4N7R_cjs.countWords; }
42
42
  });
43
43
  Object.defineProperty(exports, "createHuman", {
44
44
  enumerable: true,
45
- get: function () { return chunk3X36PFTS_cjs.createHuman; }
45
+ get: function () { return chunk665R4N7R_cjs.createHuman; }
46
46
  });
47
47
  Object.defineProperty(exports, "createRng", {
48
48
  enumerable: true,
49
- get: function () { return chunk3X36PFTS_cjs.createRng; }
49
+ get: function () { return chunk665R4N7R_cjs.createRng; }
50
50
  });
51
51
  Object.defineProperty(exports, "distracted", {
52
52
  enumerable: true,
53
- get: function () { return chunk3X36PFTS_cjs.distracted; }
53
+ get: function () { return chunk665R4N7R_cjs.distracted; }
54
54
  });
55
55
  Object.defineProperty(exports, "fast", {
56
56
  enumerable: true,
57
- get: function () { return chunk3X36PFTS_cjs.fast; }
57
+ get: function () { return chunk665R4N7R_cjs.fast; }
58
58
  });
59
59
  Object.defineProperty(exports, "firefox", {
60
60
  enumerable: true,
61
- get: function () { return chunk3X36PFTS_cjs.firefox; }
61
+ get: function () { return chunk665R4N7R_cjs.firefox; }
62
62
  });
63
63
  Object.defineProperty(exports, "generateHumanJS", {
64
64
  enumerable: true,
65
- get: function () { return chunk3X36PFTS_cjs.generateHumanJS; }
65
+ get: function () { return chunk665R4N7R_cjs.generateHumanJS; }
66
66
  });
67
67
  Object.defineProperty(exports, "generatePlaywrightTest", {
68
68
  enumerable: true,
69
- get: function () { return chunk3X36PFTS_cjs.generatePlaywrightTest; }
69
+ get: function () { return chunk665R4N7R_cjs.generatePlaywrightTest; }
70
70
  });
71
71
  Object.defineProperty(exports, "humanizePath", {
72
72
  enumerable: true,
73
- get: function () { return chunk3X36PFTS_cjs.humanizePath; }
73
+ get: function () { return chunk665R4N7R_cjs.humanizePath; }
74
74
  });
75
75
  Object.defineProperty(exports, "installMouseHelper", {
76
76
  enumerable: true,
77
- get: function () { return chunk3X36PFTS_cjs.installMouseHelper; }
77
+ get: function () { return chunk665R4N7R_cjs.installMouseHelper; }
78
78
  });
79
79
  Object.defineProperty(exports, "planScroll", {
80
80
  enumerable: true,
81
- get: function () { return chunk3X36PFTS_cjs.planScroll; }
81
+ get: function () { return chunk665R4N7R_cjs.planScroll; }
82
82
  });
83
83
  Object.defineProperty(exports, "planTypeKeystrokes", {
84
84
  enumerable: true,
85
- get: function () { return chunk3X36PFTS_cjs.planTypeKeystrokes; }
85
+ get: function () { return chunk665R4N7R_cjs.planTypeKeystrokes; }
86
86
  });
87
87
  Object.defineProperty(exports, "precise", {
88
88
  enumerable: true,
89
- get: function () { return chunk3X36PFTS_cjs.precise; }
89
+ get: function () { return chunk665R4N7R_cjs.precise; }
90
+ });
91
+ Object.defineProperty(exports, "replayTimeline", {
92
+ enumerable: true,
93
+ get: function () { return chunk665R4N7R_cjs.replayTimeline; }
90
94
  });
91
95
  Object.defineProperty(exports, "resolvePersonality", {
92
96
  enumerable: true,
93
- get: function () { return chunk3X36PFTS_cjs.resolvePersonality; }
97
+ get: function () { return chunk665R4N7R_cjs.resolvePersonality; }
94
98
  });
95
99
  Object.defineProperty(exports, "sleep", {
96
100
  enumerable: true,
97
- get: function () { return chunk3X36PFTS_cjs.sleep; }
101
+ get: function () { return chunk665R4N7R_cjs.sleep; }
98
102
  });
99
103
  Object.defineProperty(exports, "webkit", {
100
104
  enumerable: true,
101
- get: function () { return chunk3X36PFTS_cjs.webkit; }
105
+ get: function () { return chunk665R4N7R_cjs.webkit; }
102
106
  });
103
107
  //# sourceMappingURL=index.cjs.map
104
108
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -221,6 +221,57 @@ interface PlaywrightTestOptions {
221
221
  */
222
222
  declare function generatePlaywrightTest(timeline: Timeline, options?: PlaywrightTestOptions): string;
223
223
 
224
+ /** Progress callback payload, fired as each step starts and settles. */
225
+ interface ReplayStepUpdate {
226
+ readonly index: number;
227
+ readonly type: string;
228
+ readonly status: 'running' | 'pass' | 'fail';
229
+ readonly error?: string;
230
+ }
231
+ /** Outcome of a single replayed step. */
232
+ interface ReplayStepResult {
233
+ readonly index: number;
234
+ readonly type: string;
235
+ readonly status: 'pass' | 'fail';
236
+ readonly error?: string;
237
+ }
238
+ /** Outcome of a {@link replayTimeline} run. */
239
+ interface ReplayResult {
240
+ readonly status: 'pass' | 'fail';
241
+ readonly steps: readonly ReplayStepResult[];
242
+ /** Index of the failing step, when `status` is `'fail'`. */
243
+ readonly failedIndex?: number;
244
+ readonly durationMs: number;
245
+ }
246
+ /** Options for {@link replayTimeline}. */
247
+ interface ReplayOptions {
248
+ /** Personality for the replay session. Defaults to `'careful'`. */
249
+ readonly personality?: PersonalityConfig;
250
+ /** Speed mode. Defaults to `'human'` so the replay is watchable. */
251
+ readonly speed?: Speed;
252
+ /** Seed for deterministic motion. */
253
+ readonly seed?: number | string;
254
+ /** Cursor overlay, forwarded to `createHuman` (on by default). */
255
+ readonly cursor?: boolean | InstallMouseHelperOptions;
256
+ /** Called as each step starts (`running`) and settles (`pass` / `fail`). */
257
+ readonly onStep?: (update: ReplayStepUpdate) => void;
258
+ /** Abort an in-flight replay (checked between steps); rejects with an `AbortError`. */
259
+ readonly signal?: AbortSignal;
260
+ }
261
+ /**
262
+ * Replay a recorded {@link Timeline} against a live `page`, driving it through
263
+ * the same humanized primitives the exported test uses. Runs each event in
264
+ * order and reports per-step pass/fail; **stops at the first failure** (like a
265
+ * real test). `assert` events are checked with plain Playwright APIs — there's
266
+ * no `@playwright/test` dependency — so they approximate `expect` without its
267
+ * auto-retry on text/url.
268
+ *
269
+ * Always resolves with a {@link ReplayResult}; a thrown error means the run
270
+ * itself broke (page closed, or the `signal` aborted → `AbortError`), not a
271
+ * step failure. The caller owns `page`'s lifecycle.
272
+ */
273
+ declare function replayTimeline(page: Page, timeline: Timeline | readonly TimelineEvent[], options?: ReplayOptions): Promise<ReplayResult>;
274
+
224
275
  /**
225
276
  * Encoding quality preset. Picks the per-frame capture quality + the
226
277
  * ffmpeg encode settings used to assemble them into a video.
@@ -1031,4 +1082,4 @@ interface HumanRecordOptions {
1031
1082
  */
1032
1083
  declare function createHuman(page: Page, options?: CreateHumanOptions): Promise<Human>;
1033
1084
 
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 };
1085
+ 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 ReplayOptions, type ReplayResult, type ReplayStepResult, type ReplayStepUpdate, 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, replayTimeline };
package/dist/index.d.ts CHANGED
@@ -221,6 +221,57 @@ interface PlaywrightTestOptions {
221
221
  */
222
222
  declare function generatePlaywrightTest(timeline: Timeline, options?: PlaywrightTestOptions): string;
223
223
 
224
+ /** Progress callback payload, fired as each step starts and settles. */
225
+ interface ReplayStepUpdate {
226
+ readonly index: number;
227
+ readonly type: string;
228
+ readonly status: 'running' | 'pass' | 'fail';
229
+ readonly error?: string;
230
+ }
231
+ /** Outcome of a single replayed step. */
232
+ interface ReplayStepResult {
233
+ readonly index: number;
234
+ readonly type: string;
235
+ readonly status: 'pass' | 'fail';
236
+ readonly error?: string;
237
+ }
238
+ /** Outcome of a {@link replayTimeline} run. */
239
+ interface ReplayResult {
240
+ readonly status: 'pass' | 'fail';
241
+ readonly steps: readonly ReplayStepResult[];
242
+ /** Index of the failing step, when `status` is `'fail'`. */
243
+ readonly failedIndex?: number;
244
+ readonly durationMs: number;
245
+ }
246
+ /** Options for {@link replayTimeline}. */
247
+ interface ReplayOptions {
248
+ /** Personality for the replay session. Defaults to `'careful'`. */
249
+ readonly personality?: PersonalityConfig;
250
+ /** Speed mode. Defaults to `'human'` so the replay is watchable. */
251
+ readonly speed?: Speed;
252
+ /** Seed for deterministic motion. */
253
+ readonly seed?: number | string;
254
+ /** Cursor overlay, forwarded to `createHuman` (on by default). */
255
+ readonly cursor?: boolean | InstallMouseHelperOptions;
256
+ /** Called as each step starts (`running`) and settles (`pass` / `fail`). */
257
+ readonly onStep?: (update: ReplayStepUpdate) => void;
258
+ /** Abort an in-flight replay (checked between steps); rejects with an `AbortError`. */
259
+ readonly signal?: AbortSignal;
260
+ }
261
+ /**
262
+ * Replay a recorded {@link Timeline} against a live `page`, driving it through
263
+ * the same humanized primitives the exported test uses. Runs each event in
264
+ * order and reports per-step pass/fail; **stops at the first failure** (like a
265
+ * real test). `assert` events are checked with plain Playwright APIs — there's
266
+ * no `@playwright/test` dependency — so they approximate `expect` without its
267
+ * auto-retry on text/url.
268
+ *
269
+ * Always resolves with a {@link ReplayResult}; a thrown error means the run
270
+ * itself broke (page closed, or the `signal` aborted → `AbortError`), not a
271
+ * step failure. The caller owns `page`'s lifecycle.
272
+ */
273
+ declare function replayTimeline(page: Page, timeline: Timeline | readonly TimelineEvent[], options?: ReplayOptions): Promise<ReplayResult>;
274
+
224
275
  /**
225
276
  * Encoding quality preset. Picks the per-frame capture quality + the
226
277
  * ffmpeg encode settings used to assemble them into a video.
@@ -1031,4 +1082,4 @@ interface HumanRecordOptions {
1031
1082
  */
1032
1083
  declare function createHuman(page: Page, options?: CreateHumanOptions): Promise<Human>;
1033
1084
 
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 };
1085
+ 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 ReplayOptions, type ReplayResult, type ReplayStepResult, type ReplayStepUpdate, 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, replayTimeline };
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, generateHumanJS, generatePlaywrightTest, humanizePath, installMouseHelper, planScroll, planTypeKeystrokes, precise, resolvePersonality, sleep, webkit } from './chunk-3TXDODCO.js';
1
+ export { Recording, applyMicroJitter, applyVelocityProfile, bezierPath, blend, careful, chromium, computeReadingDwellMs, countWords, createHuman, createRng, distracted, fast, firefox, generateHumanJS, generatePlaywrightTest, humanizePath, installMouseHelper, planScroll, planTypeKeystrokes, precise, replayTimeline, resolvePersonality, sleep, webkit } from './chunk-I2PQGZU7.js';
2
2
  //# sourceMappingURL=index.js.map
3
3
  //# sourceMappingURL=index.js.map
package/dist/test.cjs CHANGED
@@ -1,12 +1,12 @@
1
1
  'use strict';
2
2
 
3
- var chunk3X36PFTS_cjs = require('./chunk-3X36PFTS.cjs');
3
+ var chunk665R4N7R_cjs = require('./chunk-665R4N7R.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 chunk3X36PFTS_cjs.createHuman(page, {
9
+ const human = await chunk665R4N7R_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,
package/dist/test.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createHuman } from './chunk-3TXDODCO.js';
1
+ import { createHuman } from './chunk-I2PQGZU7.js';
2
2
  import { test as test$1 } from '@playwright/test';
3
3
  export { expect } from '@playwright/test';
4
4
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@humanjs/playwright",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Humanize Playwright sessions for AI agents, QA tests, and demos.",
5
5
  "keywords": [
6
6
  "humanjs",