描述
排毒测试挂在init
Android 模拟器上。该应用程序已安装在模拟器上,但从未启动。相同的测试在 iOS 模拟器上的相同应用程序上执行。我正在使用测试运行器,并且只是在挂钩中Cucumber
调用该init
函数。BeforeAll
钩子.js
const {Before, BeforeAll, AfterAll} = require('cucumber');
const detox = require('detox');
const detoxConfig = require('../../../package.json').detox;
BeforeAll({timeout: 60 * 1000}, async () => {
await detox.init(detoxConfig);
});
包.json
"detox": {
"configurations": {
"android.emu.debug": {
"binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
"build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd ..",
"type": "android.emulator",
"name": "Pixel_2",
"session": {
"server": "ws://localhost:8099",
"sessionId": "androidDebug"
}
}
}
}
Detox、Node、Device 和 macOS 版本
排毒:7.3.3
节点:8.9.4
模拟器:Android Studio 默认 w/ API 24 (7.0)
macOS:High Sierra 版本 10.13.3
反应原生:0.55.2
反应:16.0.0
排毒服务器日志
MBP-55EE:detox-android$ detox run-server
detox-server info 12:14:32: server listening on localhost:8099...
detox-server wss 12:14:48: role=tester login (sessionId=androidDebug)
detox-server wss 12:14:48: role=tester action=loginSuccess
(sessionId=androidDebug)
detox-server wss 12:14:53: role=tester action=isReady
(sessionId=androidDebug)
detox-server wss 12:14:53: role=testee not connected, cannot fw action
(sessionId=androidDebug)
detox-server wss 12:15:48: role=tester disconnect
(sessionId=androidDebug)
令我印象深刻的是在 iOS 上测试已完成,但我仍然看到关于被测试者未连接的线路,所以我很茫然。
除了在 XCode 9 中的 iOS 模拟器上运行之外,其他一切都是平等的
MBP-55EE:detox-android$ detox run-server
detox-server info 10:53:28: server listening on localhost:8099...
detox-server wss 10:54:27: role=tester login (sessionId=debugSession)
detox-server wss 10:54:27: role=tester action=loginSuccess
(sessionId=debugSession)
detox-server wss 10:54:44: role=tester action=isReady
(sessionId=debugSession)
detox-server wss 10:54:44: role=testee not connected, cannot fw action
(sessionId=debugSession)
detox-server wss 10:54:49: role=testee login (sessionId=debugSession)
detox-server wss 10:54:49: role=testee action=loginSuccess
(sessionId=debugSession)
detox-server wss 10:54:49: role=testee action=ready
(sessionId=debugSession)
detox-server wss 10:54:49: role=tester action=invoke
(sessionId=debugSession)
detox-server wss 10:54:49: role=testee action=invokeResult
(sessionId=debugSession)
detox-server wss 10:54:49: role=tester action=invoke
(sessionId=debugSession)
detox-server wss 10:54:50: role=testee action=invokeResult
(sessionId=debugSession)
detox-server wss 10:54:50: role=tester action=invoke
(sessionId=debugSession)
detox-server wss 10:54:50: role=testee action=invokeResult
(sessionId=debugSession)
...
关于为什么 iOS 按预期工作但 Android 没有的任何想法?