Skip to content

Commit c93f156

Browse files
committed
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
1 parent 020a864 commit c93f156

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

packages/core/src/generator/prompts.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ export function buildScriptGenerationPrompt(options: ScriptPromptOptions): strin
2424
## Rules
2525
- Navigate to the affected pages
2626
- 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
2827
- Use resilient selectors in priority order: text content > ARIA roles > test IDs > CSS classes
2928
- The script must be self-contained and immediately runnable
3029
- Total demo should be under ${options.maxDuration} seconds
@@ -33,6 +32,16 @@ export function buildScriptGenerationPrompt(options: ScriptPromptOptions): strin
3332
- 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.
3433
- Always call \`await page.waitForLoadState('networkidle')\` after navigation
3534
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})
44+
3645
## Context
3746
- Base URL: ${options.baseUrl}
3847
- Viewport: ${options.viewport.width}x${options.viewport.height}

0 commit comments

Comments
 (0)