我们有Jenkins使用Appium启动UI测试,但结果是错误:
remote stacktrace: UnknownError: An unknown server-side error occurred while processing the command. Original error: Error getting AVD with retry. Original error: Condition unmet after 60063 ms. Timing out.
当Appium的任务正在运行时,没有找到emulator
进程。
Appium的输出也显示:
[debug] [ADB] Emulator Nexus_5X_API_26 not running [debug] [ADB] Trying to find Nexus_5X_API_26 emulator [debug] [ADB] Getting connected emulators [debug] [ADB] Getting connected devices... [debug] [ADB] 0 device(s) connected [debug] [ADB] 0 emulator(s) connected
好的,我看到设备没有启动,这是导致“超时”错误的原因。
但是为什么Appium无法启动?
我能够获得emulator
可执行文件,而正在执行Appium任务的詹金(Jenkin)的工作可以看到该设备:
[Pipeline] sh + avdmanager list avd ... Name: Nexus_5X_API_26 Device: Nexus 5X (Google) Path: /home/user/.android/avd/Nexus_5X_API_26.avd Target: Google Play (Google Inc.) Based on: Android 8.0 (Oreo) Tag/ABI: google_apis_playstore/x86 Skin: 1080x1920 Sdcard: 100 MB --------- Name: test Path: /home/user/.android/avd/test.avd Target: Google APIs (Google Inc.) Based on: Android 7.1.1 (Nougat) Tag/ABI: google_apis/x86 [Pipeline] sh + emulator -list-avds Nexus_5X_API_26 test
如果我仅通过运行来手动启动设备:
/android/Android/sdk/emulator/emulator -avd Nexus_5X_API_26
然后触发詹金的工作-我有另一个错误:
... [ADB] Using adb from /android/Android/sdk/platform-tools/adb [debug] [ADB] Trying to find Nexus_5X_API_26 emulator [debug] [ADB] Getting connected emulators [debug] [ADB] Getting connected devices... [debug] [ADB] 1 device(s) connected [debug] [ADB] 1 emulator(s) connected [debug] [ADB] Sending telnet command to device: avd name [debug] [ADB] Getting running emulator port [debug] [ADB] Socket connection to device created [debug] [UiAutomator2] Deleting UiAutomator2 session [debug] [BaseDriver] Event 'newSessionStarted' logged at 1542807589908 (15:39:49 GMT+0200 (EET)) [debug] [W3C] Encountered internal error running command: Error: Error getting AVD. Original error: Never got a response from command [debug] [W3C] at ADB.callee$0$0$ (/usr/local/lib/node_modules/appium/node_modules/appium-adb/lib/tools/system-calls.js:488:11) ...
有什么想法吗?
甚至无法通过“ appium从来没有收到命令的响应”请求来搜索任何内容...
此外,我无法在工作站的笔记本电脑上重现此问题-一切运行正常。
UPD 属性是:
<profile>
<id>linux-emulator-8.0</id>
<properties>
<hub.url>http://0.0.0.0:4723/wd/hub</hub.url>
<device.name>Android Emulator</device.name>
<avd>Nexus_5X_API_26</avd>
<platform.name>Android</platform.name>
<platform.version>8.0</platform.version>
<auto.grant.permissions>true</auto.grant.permissions>
<full.reset>true</full.reset>
<no.reset>false</no.reset>
<app.path>/home/user/project/project.apk</app.path>
<app.name>com.gen.workoutme</app.name>
<screenshot.path>
${project.basedir}/../screenShots/${platform.name}/${platform.version}/${device.name}/
</screenshot.path>
<automation.name>UiAutomator2</automation.name>
</properties>
</profile>
UPD 2 (不确定如何操作)-但如果手动运行emulator
则无法正常工作。
但是从Appium本身启动emulator
还是有问题。
在其日志中发现了奇怪的错误:
[ADB] [AVD OUTPUT] Fatal: QXcbConnection: Could not connect to display ((null):0, (null)) [ADB] [AVD OUTPUT] INFO: QtLogger.cpp:66: Fatal: QXcbConnection: Could not connect to display ((null):0, (null)) [ADB] Emulator avd Nexus_5X_API_26 exited with code null, signal SIGABRT
目前还不能出于某种原因使用Google进行搜索,但这似乎是主要问题-尽管存在$DISPLAY
的问题。
答案 0 :(得分:1)
我能够在模拟器上启动并运行测试,而没有任何问题。在设置驱动程序时,我会使用以下三个功能以及其他功能。
avd
:AVD的名称avdLaunchTimeout
:等待模拟器启动超时。avdReadyTimeout
:超时,等待仿真器准备就绪。尝试使用这些功能,您应该会很好。
还要检查是否有针对Android SDK和模拟器的任何更新。如果有可用的更新,则最好进行更新。