zebrunner / mcloud-grid

Customized selenium-hub
6 stars 3 forks source link

unable to occupy device if enableAdb cap is provided #132

Closed vdelendik closed 11 months ago

vdelendik commented 11 months ago
15:19:20.618 INFO [STFClient.reserveSTFDevice] - [STF-f1ff2407-7004-4555-a477-12a5219d2173] Reserve STF Device.
15:19:20.619 INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {appium:adbExecTimeout: 120000, appium:app: https://appcenter-filemanag/..., appium:automationName: UIAutomator2, appium:custom_env: PROD, appium:deviceName: any, appium:deviceType: Phone, appium:enableAdb: true, appium:enableLog: true, appium:enableVideo: true, appium:enableVnc: false, appium:enforceAppInstall: true, appium:fullReset: false, appium:language: en, appium:locale: US, appium:newCommandTimeout: 50000, appium:provider: zebrunner, appium:remoteAppsCacheLimit: 0, platformName: android}
15:19:20.620 INFO [RequestHandler.process] - Got a request to create a new session: Capabilities {appium:adbExecTimeout: 120000, appium:androidInstallTimeout: 180000, appium:app: https://appcenter-filemanag/..., appium:appWaitDuration: 180000, appium:automationName: UIAutomator2, appium:custom_env: Production, appium:deviceName: NVIDIA_SHIELD_TV,NVIDIA_SHI..., appium:deviceType: TV, appium:enableAdb: true, appium:enableLog: true, appium:enableVideo: true, appium:enableVnc: false, appium:enforceAppInstall: true, appium:fullReset: false, appium:language: en, appium:locale: US, appium:newCommandTimeout: 180, appium:provider: zebrunner, appium:remoteAppsCacheLimit: 0, appium:uiautomator2ServerLaunchTimeout: 180000, platformName: android}
15:19:20.648 INFO [STFClient.reserveSTFDevice] - [STF-f1ff2407-7004-4555-a477-12a5219d2173] STF Device info: STFDevice{abi='armeabi-v7a', airplaneMode=false, battery=com.zebrunner.mcloud.grid.models.stf.Battery@290acff9, browser=com.zebrunner.mcloud.grid.models.stf.Browser@2ba69f16, channel='N4cKgyp4TTQUwkRTYvFEuUVNttg=', createdAt='2023-01-18T16:37:33.408Z', display=com.zebrunner.mcloud.grid.models.stf.Display@7c6e87ae, manufacturer='AMAZON', model='Amazon-FireTV_Stick_4K_2', network=com.zebrunner.mcloud.grid.models.stf.Network@30b9610b, operator=null, owner=null, phone=com.zebrunner.mcloud.grid.models.stf.Phone@4f3305e2, platform='Android', presenceChangedAt='2023-12-03T14:04:21.967Z', present=true, product='mantis', provider=com.zebrunner.mcloud.grid.models.stf.Provider@50f27d3d, ready=true, remoteConnectUrl=null, remoteConnect=false, reverseForwards=[], sdk='25', serial='G...K', statusChangedAt='2023-12-03T14:04:21.958Z', status=3.0, using=false, version='7.1.2', deviceType='Phone', additionalProperties={}}
15:19:20.648 WARN [STFClient.reserveSTFDevice] - [STF-f1ff2407-7004-4555-a477-12a5219d2173] Detected 'true' enableAdb capability, but remoteURL is blank or empty.
akamarouski commented 11 months ago

Could be tested with mcloud-grid:2.4.1

dhreben commented 11 months ago

Steps:

  1. nano mcloud/.env/ - > mcloud-grid: 2.4.1
  2. Open Mobile-Android-Demo-Test
  3. Add enableAdb=true capabilities
  4. Run Mobile-Android-Demo-Test

Actual result: Device adb status is invalid: 'unauthorized'

Appium Logs:

2023-12-04 15:37:37:853 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] Server packages are not going to be (re)installed
2023-12-04 15:37:37:959 - [ADB] [ADB] Adding packages ["io.appium.settings","io.appium.uiautomator2.server","io.appium.uiautomator2.server.test"] to Doze whitelist
2023-12-04 15:37:38:270 - [AndroidDriver] [AndroidDriver] Performing fast reset on 'com.solvd.carinademoapplication'
2023-12-04 15:37:38:692 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] Starting UIAutomator2 server 5.12.16
2023-12-04 15:37:38:693 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] Using UIAutomator2 server from '/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-v5.12.16.apk' and test from '/usr/lib/node_modules/appium/node_modules/appium-uiautomator2-driver/node_modules/appium-uiautomator2-server/apks/appium-uiautomator2-server-debug-androidTest.apk'
2023-12-04 15:37:38:693 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] Waiting up to 30000ms for UiAutomator2 to be online...
2023-12-04 15:37:38:720 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] socket hang up
2023-12-04 15:37:39:744 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] socket hang up
2023-12-04 15:37:40:765 - [HTTP] [HTTP] --> GET /wd/hub/status
2023-12-04 15:37:40:766 - [HTTP] [HTTP] {}
2023-12-04 15:37:40:768 - [HTTP] [HTTP] <-- GET /wd/hub/status 200 3 ms - 110
2023-12-04 15:37:40:768 - [HTTP] [HTTP] 
2023-12-04 15:37:40:891 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] Determined the downstream protocol as 'W3C'
2023-12-04 15:37:41:028 - [AndroidDriver] [AndroidDriver] Screen already unlocked, doing nothing
2023-12-04 15:37:41:028 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] Starting 'com.solvd.carinademoapplication/com.solvd.carinademoapplication.ActivitySplash and waiting for 'com.solvd.carinademoapplication/com.solvd.carinademoapplication.ActivitySplash'
2023-12-04 15:37:41:602 - [AppiumDriver@542b] [AppiumDriver@542b] New AndroidUiautomator2Driver session created successfully, session 1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf added to master session list
2023-12-04 15:37:41:604 - [HTTP] [HTTP] <-- POST /wd/hub/session 200 13610 ms - 2149
2023-12-04 15:37:41:604 - [HTTP] [HTTP] 
session started: 1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf
waiting for the session finish...
2023-12-04 15:37:42:786 - [HTTP] [HTTP] --> DELETE /wd/hub/session/1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf
2023-12-04 15:37:42:786 - [HTTP] [HTTP] {}
2023-12-04 15:37:42:787 - [AppiumDriver@542b] [AppiumDriver@542b] Removing session 1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf from our master session list
session finished: 1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf
adb killed (pid 29872)
Terminated
detecting screenrecord process pid...
detecting screenrecord process pid...
# no more screenrecord process on device
sessionId:1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf
2023-12-04 15:37:42:933 - [AndroidUiautomator2Driver@fd3b (1cb97e6a)] [AndroidUiautomator2Driver@fd3b (1cb97e6a)] Restoring hidden api policy to the device default configuration
[info] [ConcatVideo] stop pulling 1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf video artifacts!
[debug] [ConcatVideo] #12: there is no sense to concatenate video as it is single file, just rename...
[info] [ConcatVideo] /tmp/1cb97e6a-f3ea-453b-9d12-6e332cc7e3cf.mp4 generated successfully.
waiting for Appium start...
waiting for the session start...

Grid Logs :


15:43:29.575 INFO [STFClient.reserveSTFDevice] - [STF-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Additionally call 'remoteConnect'.
15:43:29.607 INFO [STFClient.reserveSTFDevice] - [STF-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Detected 'true' enableAdb capability, and remoteURL is present.
15:43:29.608 INFO [STFClient.reserveSTFDevice] - [STF-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Device 'R9TR60GWX2J' successfully reserved.
15:43:29.609 INFO [MobileRemoteProxy.getNewSession] - [NODE-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] slotCapabilities will be added to the session capabilities: {deviceType=Tablet, proxy_port=7533, server:CONFIG_UUID=902dc51e-12d5-4263-bda9-11064bb17103, seleniumProtocol=WebDriver, adb_port=7532, deviceName=Samsung_Tab_A7, platform=ANDROID, platformVersion=12, automationName=uiautomator2, remoteURL=demo.zebrunner.farm:7535, maxInstances=1, platformName=android, udid=R9TR60GWX2J}.
15:43:29.614 INFO [TestSlot.getNewSession] - Trying to create a new session on test slot {deviceType=Tablet, proxy_port=7533, server:CONFIG_UUID=902dc51e-12d5-4263-bda9-11064bb17103, seleniumProtocol=WebDriver, platformVersion=12, automationName=uiautomator2, adb_port=7532, maxInstances=1, platformName=android, udid=R9TR60GWX2J, deviceName=Samsung_Tab_A7, platform=ANDROID}
15:43:50.809 INFO [MobileRemoteProxy.afterSession] - [NODE-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Session [63d2b78d-74a5-4d8a-9142-c7eb28316e30] will be closed.
15:43:50.809 INFO [STFClient.disconnectSTFDevice] - [STF-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Additionally disconnect 'remoteConnect'.
15:43:50.820 INFO [STFClient.disconnectSTFDevice] - [STF-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Return STF Device.
15:43:50.834 WARN [STFClient.disconnectSTFDevice] - [STF-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Device 'R9TR60GWX2J' successfully returned to the STF.
15:43:50.834 WARN [MobileRemoteProxy.afterSession] - [NODE-de7b8110-ce6b-46b6-ba8f-7c6f33d6c848] Lock removed.
dhreben commented 11 months ago

Retested

Steps:

  1. open device in stf
  2. docker exec -ti jenkins-slave bash
  3. adb connect host+port on device
  4. accept key in stf
  5. Open Jenkins
  6. Run job with adbEnabled=true
dhreben commented 11 months ago

Verified