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
454 stars 183 forks source link

Observatory URL Issue #619

Open AnasAR004 opened 11 months ago

AnasAR004 commented 11 months ago

Flutter App in Profile mode Error - No observatory URL matching to '/(Observatory listening on |An Observatory debugger and profiler on\s.+\sis available at: |The Dart VM service is listening on )((http|\/\/)[a-zA-Z0-9:/=_-.[]]+)/' was found in the device log. Please make sure the application under test is configured properly according to https://github.com/appium-userland/appium-flutter-driver#usage and that it does not crash on startup. Appium Server Log.txt

KazuCocoa commented 10 months ago

Did the observatory url present on the system log/adb log?

AnasAR004 commented 10 months ago

I am getting below error log in the appium server. [FlutterDriver@6b59 (6c09ecef)] Deleting Flutter Driver session [AppiumDriver@29c0] Event 'newSessionStarted' logged at 1700029668367 (11:57:48 GMT+0530 (India Standard Time)) [AppiumDriver@29c0] Encountered internal error running command: Error: Cannot connect to the Dart Observatory URL ws://127.0.0.1:37623/bYaW_PnSDv0=/ws after 10 retries. Check the server log for more details [AppiumDriver@29c0] at connectSocket (C:\Users\Mozanta.appium\node_modules\appium-flutter-driver\lib\sessions\observatory.ts:155:9) [AppiumDriver@29c0] at processTicksAndRejections (node:internal/process/task_queues:95:5) [AppiumDriver@29c0] at startAndroidSession (C:\Users\Mozanta.appium\node_modules\appium-flutter-driver\lib\sessions\android.ts:31:5) [AppiumDriver@29c0] at FlutterDriver.createSession (C:\Users\Mozanta.appium\node_modules\appium-flutter-driver\lib\sessions\session.ts:40:45) [AppiumDriver@29c0] at AppiumDriver.createSession (C:\Users\Mozanta\AppData\Roaming\npm\node_modules\appium\lib\appium.js:374:35) [HTTP] <-- POST /session 500 38189 ms - 840

KazuCocoa commented 10 months ago

Was the url actually the app was listening? Could you share the full log as GIST?

AnasAR004 commented 10 months ago

https://gist.github.com/AnasAR004/f3f72435a803b22faf724eb4efc83cdc

AnasAR004 commented 10 months ago

Full log shared in the above GIST

KazuCocoa commented 10 months ago
[FlutterDriver] Attempt #1 of 10
[ADB] Forwarding system: 45215 to device: 45215
[ADB] Running 'C:\Users\Mozanta\AppData\Local\Android\Sdk\platform-tools\adb.exe -P 5037 -s emulator-5554 forward tcp:45215 tcp:45215'
[FlutterDriver] Connecting to Dart Observatory: ws://127.0.0.1:45215/3G_iPlgCAzs=/ws
[FlutterDriver] Listing all isolates: [{"type":"@Isolate","id":"isolates/8737269449733095","name":"main","number":"8737269449733095","isSystemIsolate":false,"isolateGroupId":"isolateGroups/3847973082439928"}]
[FlutterDriver] "ext.flutter.driver" is not found in "extensionRPCs" ["ext.ui.window.scheduleFrame","ext.ui.window.reinitializeShader","ext.ui.window.impellerEnabled","ext.dart.io.getHttpEnableTimelineLogging","ext.dart.io.setHttpEnableTimelineLogging","ext.dart.io.httpEnableTimelineLogging","ext.dart.io.getSocketProfile","ext.dart.io.startSocketProfiling","ext.dart.io.pauseSocketProfiling","ext.dart.io.socketProfilingEnabled","ext.dart.io.clearSocketProfile","ext.dart.io.getVersion","ext.dart.io.getHttpProfile","ext.dart.io.getHttpProfileRequest","ext.dart.io.clearHttpProfile"]
[FlutterDriver] Waiting 3000ms before retrying

Probably you haven't done https://github.com/appium/appium-flutter-driver?tab=readme-ov-file#usage-and-requirement especially adding flutter_driver dependency

AnasAR004 commented 10 months ago
yaml
AnasAR004 commented 10 months ago

we have added the same but still the same issue is shown

KazuCocoa commented 10 months ago

Hm, then I have no idea.

Usually, an error below indicates the flutter_driver dependencies are not in the app package. Then, adding the flutter_driver deps and enableFlutterDriverExtension usually can resolve that. The integration test dependency only could cause the error afaik.

"ext.flutter.driver" is not found in "extensionRPCs" ["ext.ui.window.scheduleFrame","ext.ui.window.reinitializeShader","ext.ui.window.impellerEnabled","ext.dart.io.getHttpEnableTimelineLogging","ext.dart.io.setHttpEnableTimelineLogging","ext.dart.io.httpEnableTimelineLogging","ext.dart.io.getSocketProfile","ext.dart.io.startSocketProfiling","ext.dart.io.pauseSocketProfiling","ext.dart.io.socketProfilingEnabled","ext.dart.io.clearSocketProfile","ext.dart.io.getVersion","ext.dart.io.getHttpProfile","ext.dart.io.getHttpProfileRequest","ext.dart.io.clearHttpProfile"]

I heard that if multiple views were managed by different package, one package could include ext.flutter.driver with the flutter_driver dependency, but another one was not. Such complicated situation could happen as another possible case.