demowright 0.1.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/LICENSE +21 -0
- package/README.md +189 -0
- package/dist/auto-annotate.d.mts +6 -0
- package/dist/auto-annotate.mjs +9 -0
- package/dist/chunk-C0p4GxOx.mjs +29 -0
- package/dist/config.d.mts +7 -0
- package/dist/config.mjs +36 -0
- package/dist/helpers.d.mts +95 -0
- package/dist/helpers.mjs +299 -0
- package/dist/hud-registry-CptkyV32.mjs +90 -0
- package/dist/index.d.mts +54044 -0
- package/dist/index.mjs +29 -0
- package/dist/setup-CfPylVYx.mjs +652 -0
- package/dist/setup-D-Ut4FYK.d.mts +63 -0
- package/dist/setup.d.mts +2 -0
- package/dist/setup.mjs +2 -0
- package/dist/video-script.d.mts +134 -0
- package/dist/video-script.mjs +529 -0
- package/media/01-dashboard.jpg +0 -0
- package/media/02-code-editor.jpg +0 -0
- package/media/03-checkout.jpg +0 -0
- package/package.json +61 -0
- package/register.cjs +145 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sno
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# demowright
|
|
2
|
+
|
|
3
|
+
Playwright HUD plugin — renders a visible **mouse cursor**, **keystroke display**, **auto-slowdown**, **TTS narration**, and **subtitles** into test video recordings, making them readable by humans and AI (e.g. Gemini video analysis).
|
|
4
|
+
|
|
5
|
+
## Demos
|
|
6
|
+
|
|
7
|
+
> 6 runnable examples in `examples/` — see [Examples guide](./docs/examples.md)
|
|
8
|
+
|
|
9
|
+
| # | Demo | What it shows |
|
|
10
|
+
|---|------|---------------|
|
|
11
|
+
| 01 | [Dashboard](examples/01-cursor-demo.spec.ts) | Cursor, clicks, Ctrl+K search, modal form typing |
|
|
12
|
+
| 02 | [Monaco Editor](examples/02-keyboard-demo.spec.ts) | Real VS Code editor — typing, Ctrl+S/Z/A, tab switching |
|
|
13
|
+
| 03 | [E-commerce Checkout](examples/03-form-interaction.spec.ts) | Browse, add to cart, fill payment form with `annotate()` |
|
|
14
|
+
| 04 | [Narrated Tour](examples/04-narrated-tour.spec.ts) | SaaS landing page tour — heavy TTS + subtitles |
|
|
15
|
+
| 05 | [Kanban Board](examples/05-kanban-board.spec.ts) | Move cards between columns, add tasks |
|
|
16
|
+
| 06 | [Native API](examples/06-native-api.spec.ts) | **Zero helpers** — `page.click()`, `page.fill()` only |
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx playwright test --config examples/playwright.config.ts # run all 6
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Problem
|
|
23
|
+
|
|
24
|
+
Playwright's video recording doesn't capture the browser cursor or keyboard input. Tests run too fast for meaningful video review.
|
|
25
|
+
|
|
26
|
+
## Solution
|
|
27
|
+
|
|
28
|
+
`demowright` injects a lightweight overlay into every page during test execution:
|
|
29
|
+
|
|
30
|
+
- 🖱️ **Visible cursor** — SVG pointer follows mouse with click ripple effects
|
|
31
|
+
- ⌨️ **Keystroke display** — keys shown as HUD badges; modifier keys (Shift/Ctrl/Alt) as persistent blue badges
|
|
32
|
+
- 🐢 **Auto-slowdown** — configurable delays after actions for human-readable recordings
|
|
33
|
+
- 🗣️ **TTS narration** — spoken annotations via pluggable providers (OpenAI, ElevenLabs, espeak, URL template)
|
|
34
|
+
- 💬 **Subtitles** — visual text overlays that fade in/out during recordings
|
|
35
|
+
- 🎵 **Audio capture** — record browser audio to WAV via Web Audio API tap
|
|
36
|
+
- 🔌 **Non-invasive** — 4 integration methods, from zero-change config to full programmatic control
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm install demowright
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Zero-change setup (recommended) ⭐
|
|
45
|
+
|
|
46
|
+
Add one line to your `playwright.config.ts` — no test files need to change:
|
|
47
|
+
|
|
48
|
+
```ts
|
|
49
|
+
// playwright.config.ts
|
|
50
|
+
import { defineConfig } from "@playwright/test";
|
|
51
|
+
import { withDemowright } from "demowright/config";
|
|
52
|
+
|
|
53
|
+
export default withDemowright(
|
|
54
|
+
defineConfig({
|
|
55
|
+
use: { video: "on" },
|
|
56
|
+
}),
|
|
57
|
+
);
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Your existing tests keep using `import { test } from '@playwright/test'` — the HUD is injected automatically.
|
|
61
|
+
|
|
62
|
+
### Alternative: CLI flag (zero code changes at all)
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
NODE_OPTIONS="--require demowright/register" npx playwright test
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Alternative: Import replacement
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
// Change this:
|
|
72
|
+
import { test, expect } from "@playwright/test";
|
|
73
|
+
// To this:
|
|
74
|
+
import { test, expect } from "demowright";
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Alternative: Programmatic (full control)
|
|
78
|
+
|
|
79
|
+
```ts
|
|
80
|
+
import { test as base } from "@playwright/test";
|
|
81
|
+
import { applyHud } from "demowright";
|
|
82
|
+
|
|
83
|
+
const test = base.extend({
|
|
84
|
+
context: async ({ context }, use) => {
|
|
85
|
+
await applyHud(context, { cursor: true, keyboard: true, actionDelay: 150 });
|
|
86
|
+
await use(context);
|
|
87
|
+
},
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Configuration
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
// Via withDemowright (recommended)
|
|
95
|
+
export default withDemowright(defineConfig({ ... }), {
|
|
96
|
+
actionDelay: 200,
|
|
97
|
+
cursorStyle: 'dot',
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Via test.use (import replacement approach)
|
|
101
|
+
test.use({
|
|
102
|
+
qaHud: {
|
|
103
|
+
cursor: true, // show cursor overlay (default: true)
|
|
104
|
+
keyboard: true, // show keystroke display (default: true)
|
|
105
|
+
cursorStyle: 'default', // 'default' | 'dot' | 'crosshair'
|
|
106
|
+
keyFadeMs: 1500, // key label fade time in ms
|
|
107
|
+
actionDelay: 120, // delay after each action for readability (ms)
|
|
108
|
+
audio: false, // path to save WAV, or false to disable
|
|
109
|
+
tts: false, // TTS provider: URL template, function, or false
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Via env vars (CLI approach)
|
|
114
|
+
QA_HUD_CURSOR=0 QA_HUD_DELAY=200 NODE_OPTIONS="--require demowright/register" npx playwright test
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
| Env Var | Description | Default |
|
|
118
|
+
| ------------------------- | ------------------------- | --------- |
|
|
119
|
+
| `QA_HUD=0` | Disable HUD entirely | enabled |
|
|
120
|
+
| `QA_HUD_CURSOR=0` | Disable cursor overlay | enabled |
|
|
121
|
+
| `QA_HUD_KEYBOARD=0` | Disable keyboard display | enabled |
|
|
122
|
+
| `QA_HUD_DELAY=200` | Action delay in ms | `120` |
|
|
123
|
+
| `QA_HUD_CURSOR_STYLE=dot` | Cursor style | `default` |
|
|
124
|
+
| `QA_HUD_KEY_FADE=2000` | Key label fade time in ms | `1500` |
|
|
125
|
+
| `QA_HUD_TTS=url` | TTS URL template (`%s`) | disabled |
|
|
126
|
+
|
|
127
|
+
## Helpers — Recording-Only Convenience Functions
|
|
128
|
+
|
|
129
|
+
```ts
|
|
130
|
+
import { clickEl, typeKeys, narrate, annotate, hudWait } from "demowright/helpers";
|
|
131
|
+
|
|
132
|
+
await annotate(page, "Welcome to the product tour"); // subtitle + TTS
|
|
133
|
+
await clickEl(page, "#get-started"); // animated cursor + ripple + click
|
|
134
|
+
await typeKeys(page, "hello@example.com", 60, "#email"); // char-by-char with key badges
|
|
135
|
+
await hudWait(page, 500); // waits only during recording
|
|
136
|
+
await narrate(page, "Now let's submit the form"); // TTS narration
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
All helpers are **no-ops when HUD is inactive** — safe to leave in production tests.
|
|
140
|
+
|
|
141
|
+
## TTS Narration
|
|
142
|
+
|
|
143
|
+
Configure a TTS provider for spoken narration in recordings:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
export default withDemowright(defineConfig({ ... }), {
|
|
147
|
+
tts: "http://localhost:5000/tts?text=%s", // URL template
|
|
148
|
+
audio: "test-audio.wav", // capture audio to WAV
|
|
149
|
+
});
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Or use a function for APIs requiring auth (OpenAI, ElevenLabs, etc.):
|
|
153
|
+
|
|
154
|
+
```ts
|
|
155
|
+
await applyHud(context, {
|
|
156
|
+
tts: async (text) => {
|
|
157
|
+
const res = await fetch("https://api.openai.com/v1/audio/speech", {
|
|
158
|
+
method: "POST",
|
|
159
|
+
headers: { Authorization: `Bearer ${process.env.OPENAI_API_KEY}`, "Content-Type": "application/json" },
|
|
160
|
+
body: JSON.stringify({ model: "tts-1", voice: "alloy", input: text }),
|
|
161
|
+
});
|
|
162
|
+
return Buffer.from(await res.arrayBuffer());
|
|
163
|
+
},
|
|
164
|
+
});
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## How It Works
|
|
168
|
+
|
|
169
|
+
1. **Event listeners** are injected via `context.addInitScript()` — captures mouse/keyboard events before DOM exists, survives navigations
|
|
170
|
+
2. **DOM overlay** is injected via `page.evaluate()` after each navigation (`goto`, `reload`, `setContent`, etc.)
|
|
171
|
+
3. The overlay uses `pointer-events: none` and max z-index — never interferes with test interactions
|
|
172
|
+
4. Page actions (`click`, `fill`, `type`, etc.) are wrapped with configurable delays for video readability
|
|
173
|
+
|
|
174
|
+
## Documentation
|
|
175
|
+
|
|
176
|
+
| Guide | Description |
|
|
177
|
+
|-------|-------------|
|
|
178
|
+
| [Getting Started](./docs/getting-started.md) | Installation, 4 integration methods, configuration |
|
|
179
|
+
| [Helpers API](./docs/helpers.md) | `clickEl`, `typeKeys`, `moveTo`, `hudWait` reference |
|
|
180
|
+
| [Narration & Subtitles](./docs/narration.md) | `narrate()`, `subtitle()`, `annotate()` |
|
|
181
|
+
| [TTS Setup](./docs/tts.md) | Configuring text-to-speech providers |
|
|
182
|
+
| [Cursor & Keyboard](./docs/cursor-keyboard.md) | Cursor styles, key badges, click ripples, auto-slowdown |
|
|
183
|
+
| [Audio Capture](./docs/audio.md) | Recording browser audio to WAV |
|
|
184
|
+
| [Examples](./docs/examples.md) | 6 runnable demo scenarios |
|
|
185
|
+
| [Wrapper Strategies](./docs/wrapper.md) | Making native Playwright calls show the HUD |
|
|
186
|
+
|
|
187
|
+
## License
|
|
188
|
+
|
|
189
|
+
MIT
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/auto-annotate.ts
|
|
2
|
+
function installAutoAnnotate(test) {
|
|
3
|
+
test.beforeEach(async ({ page }, testInfo) => {
|
|
4
|
+
const { annotate } = await import("./helpers.mjs");
|
|
5
|
+
await annotate(page, testInfo.titlePath.length > 1 ? testInfo.titlePath.join(" › ") : testInfo.title);
|
|
6
|
+
});
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { installAutoAnnotate };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import "node:module";
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
8
|
+
var __exportAll = (all, no_symbols) => {
|
|
9
|
+
let target = {};
|
|
10
|
+
for (var name in all) __defProp(target, name, {
|
|
11
|
+
get: all[name],
|
|
12
|
+
enumerable: true
|
|
13
|
+
});
|
|
14
|
+
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
15
|
+
return target;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
19
|
+
key = keys[i];
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
21
|
+
get: ((k) => from[k]).bind(null, key),
|
|
22
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return to;
|
|
26
|
+
};
|
|
27
|
+
var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
//#endregion
|
|
29
|
+
export { __exportAll as n, __toCommonJS as r, __esmMin as t };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { t as QaHudOptions } from "./setup-D-Ut4FYK.mjs";
|
|
2
|
+
import { PlaywrightTestConfig } from "@playwright/test";
|
|
3
|
+
|
|
4
|
+
//#region src/config.d.ts
|
|
5
|
+
declare function withDemowright(config: PlaywrightTestConfig, options?: Partial<QaHudOptions>): PlaywrightTestConfig;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { type QaHudOptions, withDemowright };
|
package/dist/config.mjs
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { n as defaultOptions } from "./setup-CfPylVYx.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
//#region src/config.ts
|
|
4
|
+
/**
|
|
5
|
+
* Approach 3: Config helper (one line in playwright.config.ts).
|
|
6
|
+
*
|
|
7
|
+
* import { defineConfig } from '@playwright/test';
|
|
8
|
+
* import { withDemowright } from 'demowright/config';
|
|
9
|
+
*
|
|
10
|
+
* export default withDemowright(defineConfig({ ... }));
|
|
11
|
+
*
|
|
12
|
+
* Sets NODE_OPTIONS to --require demowright/register so the HUD is injected
|
|
13
|
+
* into every BrowserContext automatically. No test file changes needed.
|
|
14
|
+
*/
|
|
15
|
+
function withDemowright(config, options) {
|
|
16
|
+
const opts = {
|
|
17
|
+
...defaultOptions,
|
|
18
|
+
...options
|
|
19
|
+
};
|
|
20
|
+
const registerPath = createRequire(import.meta.url).resolve("../register.cjs");
|
|
21
|
+
if (!opts.cursor) process.env.QA_HUD_CURSOR = "0";
|
|
22
|
+
if (!opts.keyboard) process.env.QA_HUD_KEYBOARD = "0";
|
|
23
|
+
if (opts.actionDelay !== defaultOptions.actionDelay) process.env.QA_HUD_DELAY = String(opts.actionDelay);
|
|
24
|
+
if (opts.cursorStyle !== defaultOptions.cursorStyle) process.env.QA_HUD_CURSOR_STYLE = opts.cursorStyle;
|
|
25
|
+
if (opts.keyFadeMs !== defaultOptions.keyFadeMs) process.env.QA_HUD_KEY_FADE = String(opts.keyFadeMs);
|
|
26
|
+
if (typeof opts.tts === "string") process.env.QA_HUD_TTS = opts.tts;
|
|
27
|
+
if (opts.audio) process.env.QA_HUD_AUDIO = typeof opts.audio === "string" ? opts.audio : "1";
|
|
28
|
+
if (opts.autoAnnotate) process.env.QA_HUD_AUTO_ANNOTATE = "1";
|
|
29
|
+
if (opts.outputDir !== defaultOptions.outputDir) process.env.QA_HUD_OUTPUT_DIR = opts.outputDir;
|
|
30
|
+
const flag = `--require ${registerPath}`;
|
|
31
|
+
const existing = process.env.NODE_OPTIONS || "";
|
|
32
|
+
if (!existing.includes(flag)) process.env.NODE_OPTIONS = existing ? `${existing} ${flag}` : flag;
|
|
33
|
+
return config;
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { withDemowright };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { Page } from "@playwright/test";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Wait for `ms` milliseconds, but only when demowright is active.
|
|
6
|
+
* Use this instead of `page.waitForTimeout()` for recording-only pauses.
|
|
7
|
+
*/
|
|
8
|
+
declare function hudWait(page: Page, ms: number): Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Smoothly move the HUD cursor to (x, y) over `steps` frames.
|
|
11
|
+
* No-op when HUD is inactive.
|
|
12
|
+
*/
|
|
13
|
+
declare function moveTo(page: Page, x: number, y: number, steps?: number): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Smoothly move the HUD cursor to the center of `selector`.
|
|
16
|
+
* Returns the element center coordinates.
|
|
17
|
+
* When HUD is inactive, resolves coordinates but skips the animation.
|
|
18
|
+
*/
|
|
19
|
+
declare function moveToEl(page: Page, selector: string): Promise<{
|
|
20
|
+
x: number;
|
|
21
|
+
y: number;
|
|
22
|
+
}>;
|
|
23
|
+
/**
|
|
24
|
+
* Animated click on `selector` — moves cursor, fires mousedown/mouseup
|
|
25
|
+
* ripple, then performs the actual DOM click.
|
|
26
|
+
* When HUD is inactive, performs only the DOM click (no animation/delays).
|
|
27
|
+
*/
|
|
28
|
+
declare function clickEl(page: Page, selector: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Type `text` character-by-character with visible key badges.
|
|
31
|
+
* When HUD is inactive, sets the input value directly.
|
|
32
|
+
*
|
|
33
|
+
* @param inputSelector — optional selector for the input element to update.
|
|
34
|
+
* If omitted, uses `document.activeElement`.
|
|
35
|
+
*/
|
|
36
|
+
declare function typeKeys(page: Page, text: string, delay?: number, inputSelector?: string): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Speak `text` via the configured TTS provider, or fall back to
|
|
39
|
+
* the browser's speechSynthesis API.
|
|
40
|
+
*
|
|
41
|
+
* When called with a callback, pre-fetches the TTS audio, then runs
|
|
42
|
+
* the callback actions in parallel with audio playback — waiting for
|
|
43
|
+
* whichever takes longer. This keeps narration and actions in sync.
|
|
44
|
+
*
|
|
45
|
+
* ```ts
|
|
46
|
+
* // TTS only
|
|
47
|
+
* await narrate(page, "Processing complete");
|
|
48
|
+
*
|
|
49
|
+
* // TTS + actions timed together
|
|
50
|
+
* await narrate(page, "Now let's fill the form", async () => {
|
|
51
|
+
* await clickEl(page, "#name");
|
|
52
|
+
* await typeKeys(page, "Alice");
|
|
53
|
+
* });
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* When HUD is inactive, only the callback runs (instantly, no TTS).
|
|
57
|
+
*/
|
|
58
|
+
declare function narrate(page: Page, text: string, callbackOrOptions?: (() => Promise<void>) | {
|
|
59
|
+
rate?: number;
|
|
60
|
+
pitch?: number;
|
|
61
|
+
volume?: number;
|
|
62
|
+
voice?: string;
|
|
63
|
+
}, callback?: () => Promise<void>): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Show a caption text overlay on the page for `durationMs` milliseconds.
|
|
66
|
+
* Useful as a visual annotation in recordings. No-op when HUD is inactive.
|
|
67
|
+
*/
|
|
68
|
+
declare function caption(page: Page, text: string, durationMs?: number): Promise<void>;
|
|
69
|
+
/** @deprecated Use `caption()` instead. */
|
|
70
|
+
declare const subtitle: typeof caption;
|
|
71
|
+
/**
|
|
72
|
+
* Show a caption + speak it via TTS simultaneously.
|
|
73
|
+
* When called with a callback, runs the actions in parallel with
|
|
74
|
+
* the narration — waiting for whichever takes longer.
|
|
75
|
+
*
|
|
76
|
+
* ```ts
|
|
77
|
+
* // Caption + TTS
|
|
78
|
+
* await annotate(page, "Welcome to the tour");
|
|
79
|
+
*
|
|
80
|
+
* // Caption + TTS + actions
|
|
81
|
+
* await annotate(page, "Let's fill the form", async () => {
|
|
82
|
+
* await clickEl(page, "#name");
|
|
83
|
+
* await typeKeys(page, "Alice");
|
|
84
|
+
* });
|
|
85
|
+
* ```
|
|
86
|
+
*
|
|
87
|
+
* No-op when HUD is inactive (callback still runs).
|
|
88
|
+
*/
|
|
89
|
+
declare function annotate(page: Page, text: string, callbackOrOptions?: (() => Promise<void>) | {
|
|
90
|
+
durationMs?: number;
|
|
91
|
+
rate?: number;
|
|
92
|
+
voice?: string;
|
|
93
|
+
}, callback?: () => Promise<void>): Promise<void>;
|
|
94
|
+
//#endregion
|
|
95
|
+
export { annotate, caption, clickEl, hudWait, moveTo, moveToEl, narrate, subtitle, typeKeys };
|