conversation-session-browser-use-agent-element-picker.json 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. {
  2. "version": 1,
  3. "caseName": "conversation-session-browser-use-agent-element-picker",
  4. "spec": "./test/e2e/conversation-session/browser-use/conversation-session-browser-use-agent-element-picker.test.ts",
  5. "fixtures": [
  6. {
  7. "id": "upstream-agent-element-picker-title",
  8. "description": "Agent tab 元素选择器用例的异步标题响应。",
  9. "metadata": {
  10. "kind": "common",
  11. "timingPolicy": "fast-text",
  12. "source": "synthetic",
  13. "syntheticReason": "标题不属于本用例语义,只需与 Browser tool continuation 隔离。"
  14. },
  15. "maxMatches": 1,
  16. "match": {
  17. "method": "POST",
  18. "pathIncludes": "/messages",
  19. "bodyIncludes": ["Generate a concise title", "E2E_AGENT_ELEMENT_PICKER_TURN"]
  20. },
  21. "response": {
  22. "statusCode": 200,
  23. "statusMessage": "OK",
  24. "headers": {
  25. "content-type": "application/json; charset=utf-8"
  26. },
  27. "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\"}}"
  28. }
  29. },
  30. {
  31. "id": "upstream-agent-element-picker-open",
  32. "description": "Agent 用 Browser Use 打开一个 IAB tab 并标记 handoff,留给用户在 Agent tab 里点选元素。",
  33. "metadata": {
  34. "kind": "main",
  35. "timingPolicy": "fast-text",
  36. "source": "synthetic",
  37. "syntheticReason": "稳定打开一个真实的 Agent Browser Use tab,验证 Agent tab 仍走原来的元素 chip 选择器。"
  38. },
  39. "maxMatches": 1,
  40. "match": {
  41. "method": "POST",
  42. "pathIncludes": "/messages",
  43. "lastUserMessageIncludes": ["E2E_AGENT_ELEMENT_PICKER_TURN", "E2E_BROWSER_FIXTURE_URL:"],
  44. "bodyIncludes": ["mcp__node_repl__js"],
  45. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  46. },
  47. "response": {
  48. "statusCode": 200,
  49. "toolUse": {
  50. "id": "toolu_e2e_agent_element_picker_open",
  51. "name": "mcp__node_repl__js",
  52. "input": {
  53. "title": "打开 Agent 浏览器页面",
  54. "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 });"
  55. }
  56. }
  57. }
  58. },
  59. {
  60. "id": "upstream-agent-element-picker-final",
  61. "description": "打开页面后正常结束本轮,tab 留给用户。",
  62. "metadata": {
  63. "kind": "main",
  64. "timingPolicy": "fast-text",
  65. "source": "synthetic",
  66. "syntheticReason": "让 turn 回到 idle,再由用户操作 Agent tab。"
  67. },
  68. "maxMatches": 1,
  69. "match": {
  70. "method": "POST",
  71. "pathIncludes": "/messages",
  72. "bodyIncludes": ["E2E_AGENT_ELEMENT_PICKER_TURN", "toolu_e2e_agent_element_picker_open"],
  73. "lastUserMessageIncludes": ["E2E_AGENT_ELEMENT_PICKER_OPEN_OK"],
  74. "bodyExcludes": ["Generate a concise title", "CRITICAL: Respond with TEXT ONLY"]
  75. },
  76. "response": {
  77. "statusCode": 200,
  78. "text": "E2E_AGENT_ELEMENT_PICKER_DONE"
  79. }
  80. }
  81. ]
  82. }