You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
improve demo pacing and add natural mouse movement to script prompt
- Replace blanket waitForTimeout(1500) rule with tiered timing:
300ms between routine actions, 800ms only after key visual moments
(animations, state changes, panel openings). Eliminates stacked pauses.
- Add mouse movement section: model should add a single intermediate
waypoint before each target so the cursor doesn't teleport between
interactions. Keeps it subtle — one waypoint, plausible coordinates.
https://claude.ai/code/session_01WpqwtdViucvCCdgxj6RCGG
Copy file name to clipboardExpand all lines: packages/core/src/generator/prompts.ts
+10-1Lines changed: 10 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -24,7 +24,6 @@ export function buildScriptGenerationPrompt(options: ScriptPromptOptions): strin
24
24
## Rules
25
25
- Navigate to the affected pages
26
26
- Interact with new/changed UI elements (click buttons, fill forms, hover states)
27
-
- Add \`await page.waitForTimeout(1500)\` pauses on key visual states so the recording captures them clearly
28
27
- Use resilient selectors in priority order: text content > ARIA roles > test IDs > CSS classes
29
28
- The script must be self-contained and immediately runnable
30
29
- Total demo should be under ${options.maxDuration} seconds
@@ -33,6 +32,16 @@ export function buildScriptGenerationPrompt(options: ScriptPromptOptions): strin
33
32
- Do NOT inject code into the page via \`page.evaluate\`, \`page.addInitScript\`, or inline \`<script>\` / \`<style>\` tags. The recording infrastructure handles visual overlays — the script should not.
34
33
- Always call \`await page.waitForLoadState('networkidle')\` after navigation
35
34
35
+
## Timing
36
+
- Keep pauses short: use \`await page.waitForTimeout(300)\` between most actions
37
+
- Only use a longer pause (\`await page.waitForTimeout(800)\`) directly after an interaction whose visual result (animation, state change, panel opening) is the point of the demo
38
+
- Avoid stacking multiple pauses in a row — one pause per meaningful moment is enough
39
+
40
+
## Mouse movement
41
+
- Move the mouse naturally between interactions: before clicking or hovering a target, briefly move to a nearby point first so the cursor doesn't teleport
42
+
- Use \`await page.mouse.move(x, y)\` for a single intermediate waypoint — keep it simple, one waypoint is enough
43
+
- Coordinates should be plausible screen positions relative to the viewport (${options.viewport.width}x${options.viewport.height})
0 commit comments