提交 336e5585 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat(uts): android 自动化测试,心跳检测应用崩溃,输出日志

上级 9e36836e
...@@ -76,6 +76,10 @@ export function onMessage(msg: string) { ...@@ -76,6 +76,10 @@ export function onMessage(msg: string) {
// @ts-ignore // @ts-ignore
const json = JSON.parse<Msg>(msg)! const json = JSON.parse<Msg>(msg)!
const method = json.method const method = json.method
if ((method == 'ping')) {
send('pong')
return
}
const params = JSON.stringify(json.params) const params = JSON.stringify(json.params)
const res = new Map<string, any | null>([['id', json.id]]) const res = new Map<string, any | null>([['id', json.id]])
try { try {
...@@ -205,7 +209,9 @@ export function initAutomator() { ...@@ -205,7 +209,9 @@ export function initAutomator() {
socketTask = uni.connectSocket({ socketTask = uni.connectSocket({
url: wsEndpoint url: wsEndpoint
}); });
socketTask!.onMessage((res) => { onMessage(res.data as string) }) socketTask!.onMessage((res) => {
onMessage(res.data as string)
})
socketTask!.onOpen((_) => { socketTask!.onOpen((_) => {
console.warn("automator.onOpen") console.warn("automator.onOpen")
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册