AppiumTestDistribution / appium-device-farm

This is an Appium 2.0 plugin designed to manage and create driver sessions on available devices.
https://devicefarm.org
Other
335 stars 102 forks source link

Device shown as busy after failed test #177

Closed 3ielevin closed 3 years ago

3ielevin commented 3 years ago

Im running a UI test on android devices. When the scripts fails because no element found, the script end and the device status stays busy.

[HTTP] --> DELETE /session/4f41f275-1165-4b15-88c7-c83a6b14c3ec [HTTP] {} [debug] [W3C (4f41f275)] Calling AppiumDriver.deleteSession() with args: ["4f41f275-1165-4b15-88c7-c83a6b14c3ec"] [Appium] Plugins which can handle cmd 'deleteSession': device-farm (sessionless) [Appium] Plugin device-farm (sessionless) is now handling cmd 'deleteSession' [device-manager] Unblocking device UDID: be1f2f9a0820 from session 4f41f275-1165-4b15-88c7-c83a6b14c3ec [device-manager] Deleting Session and device UDID be1f2f9a0820 is unblocked [Appium] Executing default handling behavior for command 'deleteSession' [debug] [BaseDriver] Event 'quitSessionRequested' logged at 1634737996088 (06:53:16 GMT-0700 (Pacific Daylight Time)) [Appium] Removing session 4f41f275-1165-4b15-88c7-c83a6b14c3ec from our master session list [debug] [UiAutomator2] Deleting UiAutomator2 session [debug] [UiAutomator2] Deleting UiAutomator2 server session [debug] [WD Proxy] Matched '/' to command name 'deleteSession' [debug] [WD Proxy] Proxying [DELETE /] to [DELETE http://127.0.0.1:45309/wd/hub/session/7d0589a2-b5a0-43ea-bfc5-add5bd3e54a2] with no body [debug] [WD Proxy] Got response with status 200: {"sessionId":"7d0589a2-b5a0-43ea-bfc5-add5bd3e54a2","value":null} [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell am force-stop com.dc-monitor.com' [debug] [Logcat] Stopping logcat capture [debug] [ADB] Removing forwarded port socket connection: 45309 [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 forward --remove tcp:45309' [UiAutomator2] Restoring hidden api policy to the device default configuration [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell 'settings delete global hidden_api_policy_pre_p_apps;settings delete global hidden_api_policy_p_apps;settings delete global hidden_api_policy'' [debug] [BaseDriver] Event 'quitSessionFinished' logged at 1634737996294 (06:53:16 GMT-0700 (Pacific Daylight Time)) [debug] [W3C (4f41f275)] Received response: null [debug] [W3C (4f41f275)] But deleting session, so not returning [debug] [W3C (4f41f275)] Responding to client with driver.deleteSession() result: null [HTTP] <-- DELETE /session/4f41f275-1165-4b15-88c7-c83a6b14c3ec 200 213 ms - 14 [HTTP] [debug] [Instrumentation] . [debug] [Instrumentation] Time: 9.068 [debug] [Instrumentation] [debug] [Instrumentation] OK (1 test) [debug] [Instrumentation] The process has exited with code 0 [device-manager] Fetching Android Devices [debug] [ADB] Getting connected devices [debug] [ADB] Connected devices: [{"udid":"be1f2f9a0820","state":"device"}] [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell getprop ro.build.version.release' [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell getprop ro.build.characteristics' [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell getprop ro.product.name' [device-manager] Android Devices found [{"busy":false,"state":"device","udid":"be1f2f9a0820","platform":"android","sdk":"10","realDevice":true,"name":"citrus_global"}] [device-manager] Fetching iOS Devices [debug] [ios-device] Error: The usbmuxd socket at '/var/run/usbmuxd' does not exist or is not accessible [debug] [ios-device] at getDefaultSocket (/root/.appium/appium-device-farm/node_modules/appium-ios-device/lib/usbmux/index.js:80:11) [debug] [ios-device] at Object.getConnectedDevices (/root/.appium/appium-device-farm/node_modules/appium-ios-device/lib/utilities.js:26:35) [device-manager] Fetching Android Devices [debug] [ADB] Getting connected devices [debug] [ADB] Connected devices: [{"udid":"be1f2f9a0820","state":"device"}] [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell getprop ro.build.version.release' [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell getprop ro.build.characteristics' [debug] [ADB] Running '/root/platform-tools/adb -P 5037 -s be1f2f9a0820 shell getprop ro.product.name' [device-manager] Android Devices found [{"busy":false,"state":"device","udid":"be1f2f9a0820","platform":"android","sdk":"10","realDevice":true,"name":"citrus_global"}]

saikrishna321 commented 3 years ago

Thanks for reporting. I’m unable to see the device state as busy. Can you please point me the to the line in logs

3ielevin commented 3 years ago

The attached log is after the script failed. I see that : Android Devices found [{"busy":false,"state":"device","udid":"be1f2f9a0820","platform":"android","sdk":"10","realDevice":true,"name":"citrus_global"}]

saikrishna321 commented 3 years ago

Busy attribute has false value. Which means the device is not busy. Sorry am I missing something

3ielevin commented 3 years ago

my bad... So after failing it won't start any test till I restart the Appium server. If I run the script without appium-device-farm plugin the problem won't happen.

saikrishna321 commented 3 years ago

Lets say you have 2 Test Case and fails with some exception and the next TC is not picked for execution ?

3ielevin commented 3 years ago

Yes, It doesn't contiunue

saikrishna321 commented 3 years ago

@3ielevin will look into this

saikrishna321 commented 3 years ago

@3ielevin This issue is fixed in v1.0.0-beta.8