appium / appium-flutter-driver

Appium Flutter Driver is a test automation tool for Flutter apps on multiple platforms/OSes. Appium Flutter Driver is part of the Appium mobile test automation tool maintained by community
MIT License
468 stars 183 forks source link

driver.activeApp(appPackage) has error #726

Closed thuonglai closed 3 months ago

thuonglai commented 3 months ago

Hi @KazuCocoa . Recently, when i call function driver.activeApp it throw a exception:

2024-08-02 08:57:31.888 V [558a398e][FlutterDriver@5b42] Calling AppiumDriver.activateApp() with args: ["com.axlehire.drive.staging",null,null,null,"558a398e-31bb-4f1a-bb66-f3979ed4e882"]
2024-08-02 08:57:31.888 V [558a398e][AppiumDriver@99d3] Clearing new command timeout pre-emptively since plugin(s) will handle this command
2024-08-02 08:57:31.888 V [558a398e][AppiumDriver@99d3] Plugins which can handle cmd 'activateApp': images
2024-08-02 08:57:31.888 V [558a398e][AppiumDriver@99d3] Plugin images is now handling cmd 'activateApp'
2024-08-02 08:57:31.888 V [558a398e][AppiumDriver@99d3] Executing default handling behavior for command 'activateApp'
2024-08-02 08:57:31.888 V [558a398e][FlutterDriver] Executing Flutter driver command 'activateApp'
2024-08-02 08:57:31.889 V [558a398e][AndroidUiautomator2Driver@4535] Activating 'com.axlehire.drive.staging'
2024-08-02 08:57:31.889 V [558a398e][ADB] Forwarding system: 35801 to device: 35801
2024-08-02 08:57:31.889 V [558a398e][ADB] Running '/opt/android-sdk/platform-tools/adb -H 172.20.0.134 -P 17109 -s 23011FDEE002DV forward tcp:35801 tcp:35801'
2024-08-02 08:57:31.898 V [558a398e][ADB] Running '/opt/android-sdk/platform-tools/adb -H 172.20.0.134 -P 17109 -s 23011FDEE002DV shell cmd package resolve-activity --brief com.axlehire.drive.staging'
2024-08-02 08:57:31.906 V [558a398e][FlutterDriver@5b42] Establishing a connection to the Dart Observatory
2024-08-02 08:57:31.922 V [558a398e][FlutterDriver@5b42] Connection to ws://172.20.0.134:35801/89If46XP7LQ=/ws got an error: socket hang up
2024-08-02 08:57:31.928 V [558a398e][FlutterDriver@5b42] Encountered internal error running command: Error: Cannot connect to the Dart Observatory URL ws://172.20.0.134:35801/89If46XP7LQ=/ws. Check the server log for more details
2024-08-02 08:57:31.928 V     at FlutterDriver.connectSocket (/root/appium/appium2-202408010003/node_modules/appium-flutter-driver/lib/sessions/observatory.ts:125:9)
2024-08-02 08:57:31.928 V     at processTicksAndRejections (node:internal/process/task_queues:95:5)
2024-08-02 08:57:31.928 V     at FlutterDriver.connectAndroidSession (/root/appium/appium2-202408010003/node_modules/appium-flutter-driver/lib/sessions/android.ts:48:10)
2024-08-02 08:57:31.928 V     at FlutterDriver.reConnectFlutterDriver (/root/appium/appium2-202408010003/node_modules/appium-flutter-driver/lib/sessions/session.ts:23:21)
2024-08-02 08:57:31.928 V     at FlutterDriver.activateApp (/root/appium/appium2-202408010003/node_modules/appium-flutter-driver/lib/driver.ts:158:5)
2024-08-02 08:57:31.929 V [558a398e][HTTP] <-- POST /wd/hub/session/558a398e-31bb-4f1a-bb66-f3979ed4e882/appium/device/activate_app 500 42 ms - 740 
KazuCocoa commented 3 months ago

Could you attach the full appium server log as GitHub GIST?

thuonglai commented 3 months ago

Hi @KazuCocoa . This is full appium log APPIUM LOG

KazuCocoa commented 3 months ago

Thank you. I guess it could be a regression in https://github.com/appium/appium-flutter-driver/pull/719 I'll take a look.

KazuCocoa commented 3 months ago

just a note: This is a still rough implementation, but like this implementation will fix this. https://github.com/appium/appium-flutter-driver/compare/fix-reconnect?expand=1

thuonglai commented 3 months ago

hi @KazuCocoa . When i try with branch fix-reconnect. When i start app it throw a error as in appium log AppiumLog

KazuCocoa commented 3 months ago

What revision did you try out? My latest one worked with https://github.com/appium/appium-flutter-driver/pull/727/files#diff-7a2bfe96099a9deeb33f0c31a0084632c56c56c7e29a4ae46ca9075f4aca70be

KazuCocoa commented 3 months ago

Please try out appium flutter driver 2.9.2

thuonglai commented 3 months ago

Thanks @KazuCocoa . I tested with 2.9.2. It is ok