-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_auto.py
More file actions
54 lines (42 loc) · 1.48 KB
/
test_auto.py
File metadata and controls
54 lines (42 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"""自动测试脚本 - 无需交互"""
import asyncio
import json
import sys
sys.path.insert(0, "d:/Github/MobileAgentLivelink/pc-client")
from websockets import connect, serve
from cursor_controller import CursorController
async def main():
print("=" * 50)
print("MobileAgentLivelink 本地测试")
print("=" * 50)
# 1. 先测试 Cursor 控制器
print("\n[1] 测试 Cursor 控制器...")
ctrl = CursorController()
status = ctrl.get_status()
print(f" Cursor 状态: {status}")
if not status["running"]:
print(" [ERROR] 未检测到 Cursor 窗口,请打开 Cursor")
return
print(" [OK] Cursor 已检测到")
# 2. 测试打开对话面板
print("\n[2] 测试打开 Cursor 对话面板 (Ctrl+L)...")
await asyncio.sleep(1)
success = ctrl.open_chat_panel()
if success:
print(" [OK] 对话面板已打开")
else:
print(" [WARN] 打开对话面板可能失败")
# 3. 测试发送消息
print("\n[3] 测试发送消息...")
await asyncio.sleep(1)
test_message = "hello this is a test from MobileAgentLivelink"
success = ctrl.send_message(test_message)
if success:
print(f" [OK] 消息已发送: {test_message}")
else:
print(" [ERROR] 发送消息失败")
print("\n" + "=" * 50)
print("测试完成!请查看 Cursor 窗口")
print("=" * 50)
if __name__ == "__main__":
asyncio.run(main())