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
464 stars 184 forks source link

Failed to launch Application successfully, Connecting to Dart Observatory: undefined #445

Open megathana opened 1 year ago

megathana commented 1 year ago

Hi, I'm having trouble opening an Application with the Keyword 'Open Application' from the Library AppiumFlutterLibrary. My problem is similar to #376 , #442 and #444

I connected my phone to my macbook and when I run the Test Script, the Application installed via xcode with extension *.ipa can be opened. But it will stay like that when looking at the Log will find that the problem is stuck at [FlutterDriver] Connecting to Dart Observatory: undefined, it tries to retry every 3 seconds for a total of 30 times. When the timer expires, it will fail.

Appium Server Full Log : https://gist.github.com/megathana/8c858634318ea61a10a780b51f405c25

Screen Shot 2566-04-03 at 15 11 43

This is the log from RIDE when Run Fail.

Screen Shot 2566-04-03 at 15 23 12

But if I Install Application via xcode with extension *.app (Runner.app), Keyword 'Open Application' from Library AppiumFlutterLibrary can successfully open Application and run normally.

My Tools RIDE : 1.7.4.2 Python : 3.7.4 MacBook Pro : 12.5.1 iPhone 13 mini : 15.5 Appium Server : 2.0.0-beta.58 Appium Flutter Driver : 1.14.3

I'm not sure what caused it. Can anyone give me some advice?

KazuCocoa commented 1 year ago

Did the observatory url log exist in the system log? https://github.com/appium-userland/appium-flutter-driver/blob/9d7054821b239234467c4b848da5ccd172b56c01/driver/lib/sessions/observatory.ts#L189

If not, this driver cannot to start. It might indicate the Dart VM did not expose the websocket connection this driver needed to attach to.

megathana commented 1 year ago

I tried checking the path of the file that appears in [debug] [FlutterDriver]

Screen Shot 2566-04-04 at 10 37 04

I see that locally on my machine there is no folder named 'lib'

Screen Shot 2566-04-04 at 10 56 05

I'm using only the command listed under Installation "appium driver install --source=npm appium-flutter-driver"

Do I need to do anything else for the 'lib' folder to show up

KazuCocoa commented 1 year ago

lib is not included in the package right now. The build is what the ts file's built ones https://github.com/appium-userland/appium-flutter-driver/blob/main/driver/package.json

megathana commented 1 year ago

I'm sorry, I understand you let me check the file observatory.ts whether it exists or not, without the driver it cannot be started.

Coming back to the question whether the observatory url log exists in the system log. i am a beginner Can I have some advice on how to check the procedure?

and if the observatory url is not sent What additional settings do I need?

I am a tester (not a developer) but if there are any changes needed on application, I can inform the development team.

thank you for the advice.

KazuCocoa commented 1 year ago

The easiest way is https://developer.apple.com/documentation/xcode/acquiring-crash-reports-and-diagnostic-logs#Access-device-console-logs You could see some keywords in https://github.com/appium-userland/appium-flutter-driver/issues/445#issuecomment-1494646943 to find an observatory URL. If your app is configured properly, the observatory URL will be in the log. The app under test should be a profile mode build for ios I guess. About profile mode: https://github.com/appium-userland/appium-flutter-driver/issues/115 https://docs.flutter.dev/testing/build-modes

For a release build, you may need to use UIA2/XCUITest driver generally since the app won't expose Dart VM. https://github.com/appium-userland/appium-flutter-driver#appium-flutter-driver-or-appium-uiautomator2xcuitest-driver

megathana commented 1 year ago

I opened Console app and press Start streaming after that press Start Robot on RIDE to Open Application. After Fail completed, I came back to Console app and put keyword in search box like Observatory, Dart VM. I didn't find Observatory url log appear.

Screen Shot 2566-04-05 at 16 22 02

The application I used to test has the extension *.ipa and is already in Profile mode.

Do I need to set anything further?

KazuCocoa commented 1 year ago

If no observatory URL is shown, this driver won't work. I haven't tried with ipa packaged file in profile mode, so no idea right now. https://github.com/appium-userland/appium-flutter-driver/issues/115 might be related. Potentially ipa package, and launching an app process via XCUITest's launch app endpoint does not start the app in profile mode. (like exact release app)

canibal1 commented 3 months ago

If no observatory URL is shown, this driver won't work. I haven't tried with ipa packaged file in profile mode, so no idea right now. #115 might be related. Potentially ipa package, and launching an app process via XCUITest's launch app endpoint does not start the app in profile mode. (like exact release app)

@KazuCocoa What type of file should we try with and how should we produce it? Can you give an example?

KazuCocoa commented 3 months ago

https://github.com/appium/appium-flutter-driver?tab=readme-ov-file#usage-and-requirement https://github.com/appium/appium-flutter-driver?tab=readme-ov-file#note What I know of is profile or debug mode packages, and launching them as a debug mode process.