| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201 |
- {
- "version": 1,
- "caseName": "conversation-session-browser-use-agent-element-picker",
- "spec": "./test/e2e/conversation-session/browser-use/conversation-session-browser-use-agent-element-picker.test.ts",
- "fixtures": [
- {
- "id": "upstream-agent-element-picker-title",
- "description": "Agent tab 元素选择器用例的异步标题响应。",
- "metadata": {
- "kind": "common",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "标题不属于本用例语义,只需与 Browser tool continuation 隔离。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["Generate a concise title", "E2E_AGENT_ELEMENT_PICKER_TURN"]
- },
- "response": {
- "statusCode": 200,
- "statusMessage": "OK",
- "headers": {
- "content-type": "application/json; charset=utf-8"
- },
- "body": "{\"id\":\"upstream-agent-element-picker-title\",\"type\":\"message\",\"role\":\"assistant\",\"model\":\"deepseek-v4-flash\",\"content\":[{\"type\":\"text\",\"text\":\"{\\\"title\\\":\\\"Agent 浏览器选元素\\\"}\"}],\"stop_reason\":\"end_turn\",\"stop_sequence\":null,\"usage\":{\"input_tokens\":64,\"cache_creation_input_tokens\":0,\"cache_read_input_tokens\":0,\"output_tokens\":8,\"service_tier\":\"standard\"}}"
- }
- },
- {
- "id": "upstream-agent-element-picker-open",
- "description": "Agent 用 Browser Use 打开一个 IAB tab 并标记 handoff,留给用户在 Agent tab 里点选元素。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "稳定打开一个真实的 Agent Browser Use tab,验证 Agent tab 仍走原来的元素 chip 选择器。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_AGENT_ELEMENT_PICKER_TURN",
- "E2E_BROWSER_FIXTURE_URL:",
- "mcp__node_repl__js"
- ],
- "bodyExcludes": [
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_e2e_agent_element_picker_open"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_e2e_agent_element_picker_open",
- "name": "mcp__node_repl__js",
- "input": {
- "title": "打开 Agent 浏览器页面",
- "code": "const browserPluginRoot = process.env.ZCODE_PLUGIN_ROOT ?? process.env.CLAUDE_PLUGIN_ROOT;\nif (!browserPluginRoot) throw new Error('Browser plugin root is unavailable in the node_repl host');\nconst { join } = await import('node:path');\nconst { pathToFileURL } = await import('node:url');\nconst browserClientUrl = pathToFileURL(join(browserPluginRoot, 'scripts', 'browser-client.mjs')).href;\nconst { setupBrowserRuntime } = await import(browserClientUrl);\nawait setupBrowserRuntime({ globals: globalThis });\nconst browser = await agent.browsers.get('iab');\nconst pickerUrl = new URL('/agent', '{{browserFixtureUrl}}').href;\nconst pickerTab = await browser.tabs.new();\nawait pickerTab.goto(pickerUrl);\nawait browser.tabs.finalize({ keep: [{ tab: pickerTab, status: 'handoff' }] });\n({ marker: 'E2E_AGENT_ELEMENT_PICKER_OPEN_OK', id: pickerTab.id });"
- }
- }
- }
- },
- {
- "id": "upstream-agent-element-picker-open-mcp-wait-1",
- "description": "Browser MCP 尚未就绪时执行第 1 次有界等待,工具出现后直接进入原业务动作。",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "首请求不等 MCP;用真实等待工具推进普通 step,保留尚未就绪、就绪后调用两条回放路径。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_AGENT_ELEMENT_PICKER_TURN",
- "E2E_BROWSER_FIXTURE_URL:",
- "WaitForMcpServers"
- ],
- "bodyExcludes": [
- "mcp__node_repl__js",
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_e2e_agent_element_picker_open"
- ]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_upstream_agent_element_picker_open_mcp_wait_1",
- "name": "WaitForMcpServers",
- "input": {
- "servers": ["node_repl"]
- }
- }
- }
- },
- {
- "id": "upstream-agent-element-picker-open-mcp-wait-2",
- "description": "Browser MCP 尚未就绪时执行第 2 次有界等待,工具出现后直接进入原业务动作。",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "首请求不等 MCP;用真实等待工具推进普通 step,保留尚未就绪、就绪后调用两条回放路径。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_AGENT_ELEMENT_PICKER_TURN",
- "E2E_BROWSER_FIXTURE_URL:",
- "WaitForMcpServers",
- "toolu_upstream_agent_element_picker_open_mcp_wait_1"
- ],
- "bodyExcludes": [
- "mcp__node_repl__js",
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_e2e_agent_element_picker_open"
- ],
- "lastUserMessageIncludes": ["Still connecting"]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_upstream_agent_element_picker_open_mcp_wait_2",
- "name": "WaitForMcpServers",
- "input": {
- "servers": ["node_repl"]
- }
- }
- }
- },
- {
- "id": "upstream-agent-element-picker-open-mcp-wait-3",
- "description": "Browser MCP 尚未就绪时执行第 3 次有界等待,工具出现后直接进入原业务动作。",
- "metadata": {
- "kind": "main",
- "source": "synthetic",
- "timingPolicy": "fast-text",
- "syntheticReason": "首请求不等 MCP;用真实等待工具推进普通 step,保留尚未就绪、就绪后调用两条回放路径。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": [
- "E2E_AGENT_ELEMENT_PICKER_TURN",
- "E2E_BROWSER_FIXTURE_URL:",
- "WaitForMcpServers",
- "toolu_upstream_agent_element_picker_open_mcp_wait_2"
- ],
- "bodyExcludes": [
- "mcp__node_repl__js",
- "Generate a concise title",
- "CRITICAL: Respond with TEXT ONLY",
- "toolu_e2e_agent_element_picker_open"
- ],
- "lastUserMessageIncludes": ["Still connecting"]
- },
- "response": {
- "statusCode": 200,
- "toolUse": {
- "id": "toolu_upstream_agent_element_picker_open_mcp_wait_3",
- "name": "WaitForMcpServers",
- "input": {
- "servers": ["node_repl"]
- }
- }
- }
- },
- {
- "id": "upstream-agent-element-picker-final",
- "description": "打开页面后正常结束本轮,tab 留给用户。",
- "metadata": {
- "kind": "main",
- "timingPolicy": "fast-text",
- "source": "synthetic",
- "syntheticReason": "让 turn 回到 idle,再由用户操作 Agent tab。"
- },
- "maxMatches": 1,
- "match": {
- "method": "POST",
- "pathIncludes": "/messages",
- "bodyIncludes": ["E2E_AGENT_ELEMENT_PICKER_TURN", "toolu_e2e_agent_element_picker_open"],
- "lastUserMessageIncludes": ["E2E_AGENT_ELEMENT_PICKER_OPEN_OK"],
- "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
- },
- "response": {
- "statusCode": 200,
- "text": "E2E_AGENT_ELEMENT_PICKER_DONE"
- }
- }
- ]
- }
|