cocos_run_preview_sequence
Execute automated browser test sequences in a single session to maintain game state across multiple actions like clicks, typing, and screenshots for Cocos Creator previews.
Instructions
Run a list of actions in a SINGLE browser session.
Essential for play-testing: game state resets on every page reload, so a multi-step test plan (click Start → type name → press Enter → read score) MUST share one session.
Each action is a dict with a kind + kind-specific keys:
{"kind": "click", "x": int, "y": int, "wait_ms"?: int, "button"?: str}
{"kind": "key", "key": str, "wait_ms"?: int}
{"kind": "type", "text": str, "wait_ms"?: int}
{"kind": "drag", "from_x": int, "from_y": int, "to_x": int, "to_y": int, "steps"?: int}
{"kind": "wait", "ms": int}
{"kind": "read_state", "expression": str}
{"kind": "screenshot"}
Returns a list parallel to actions: each entry is
{kind, ok, result, error}. A single failed action does NOT
abort the sequence, so earlier successful reads/screenshots
still come back.
screenshot results return {"png_bytes_hex": "..."} —
decode with bytes.fromhex() to get raw PNG data (MCP JSON
can't carry bytes natively).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ||
| actions | Yes | ||
| viewport_width | No | ||
| viewport_height | No | ||
| timeout_ms | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |