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

All Flutter Driver commands result in NULL #152

Open just255 opened 3 years ago

just255 commented 3 years ago

After taking forever to get this setup, I finally have a working instance of a Flutter Driver. My issue is that every command I run results in Responding to client with driver.execute() result: null. Here are my caps: capabilities.setCapability("automationName", "Flutter"); capabilities.setCapability("noReset", "true"); capabilities.setCapability("deviceName", "SM_G781U1"); capabilities.setCapability("platformVersion", "11"); capabilities.setCapability("platformName", "android"); capabilities.setCapability("appPackage", "com.tozelabs.tvshowtime"); Environment: appium. 1.20.2 appium-flutter-driver 0.0.28 Java TestNG Android SDK to build apks Xcode for ipas IntelliJ for running tests

Appium Log: https://gist.github.com/just255/72cacb0e2548797af73d491b8f393f26

I wrote a debug output line to see if the find.byKeyValue was returning anything and got this [pro.truongsinh.appium_flutter.finder.FlutterElement@dcbd883f -> unknown locator] I've triple-checked the key on the button and it is correct and is the only element with a key

So, I tried to add driver.executeScript("flutter:waitForFirstFrame"); to give it time to render, but that just hangs and never connects to the Dart Observatory as it tries to connect 3 times and then fails with [HTTP] Could not cache the response identified by '3733d19a-74e7-4e8d-ae82-e360d64324c5', because it has not been completed [HTTP] Does the client terminate connections too early? uncaughtException: Could not cache the response identified by '3733d19a-74e7-4e8d-ae82-e360d64324c5', because it has not been completed Error: Could not cache the response identified by '3733d19a-74e7-4e8d-ae82-e360d64324c5', because it has not been completed at WriteStream.<anonymous> (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/express/idempotency.js:91:50) at Object.onceWrapper (node:events:484:28) at WriteStream.emit (node:events:378:20) at emitCloseNT (node:internal/streams/destroy:169:10) at processTicksAndRejections (node:internal/process/task_queues:80:21) or when it does connect, I get Encountered internal error running command: Error: Command not support: "flutter:waitForFirstFrame" which was answered in another issue, but still didn't work for me after changing to appium-flutter-driver 0.0.28

Then, I disabled the background animations (I beleive) and added a 15 second wait, but that resulted in the same issue.

I'm at my wits end with this. Please someone help.

Side note, I also get this error randomly, when kicking off my test, which I've assumed is a timing issue between the driver and Observatory VM connecting Encountered internal error running command: TypeError: Cannot read property 'match' of undefined [debug] [W3C] at Object.exports.processLogToGetobservatory (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/build/driver/lib/sessions/observatory.js:118:9) [debug] [W3C] at Object.exports.getObservatoryWsUri (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/android.ts:34:21) [debug] [W3C] at Object.exports.startAndroidSession (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/android.ts:25:28) [debug] [W3C] at runMicrotasks (<anonymous>) [debug] [W3C] at processTicksAndRejections (node:internal/process/task_queues:94:5) [debug] [W3C] at FlutterDriver.exports.createSession (/usr/local/lib/node_modules/appium/node_modules/appium-flutter-driver/lib/sessions/session.ts:18:47) [debug] [W3C] at AppiumDriver.createSession (/usr/local/lib/node_modules/appium/lib/appium.js:371:35)

KazuCocoa commented 3 years ago

Cannot read property 'match' of undefined was probably flutter driver did not find the line well sometimes. I've added a few improvements recently.


The below error part came from Flutter/Dart VM. So this flutter driver can help nothing, unfortunately.

[debug] [FlutterDriver] Executing Flutter driver command 'execute'
[debug] [FlutterDriver] >>> {"command":"waitFor","finderType":"ByValueKey","keyValueType":"String","keyValueString":"qa-get_started","timeout":30000}
[debug] [FlutterDriver] <<< {"isError":false,"response":{},"type":"_extensionType","method":"ext.flutter.driver"} | previous command waitFor
[debug] [MJSONWP (df92f6de)] Responding to client with driver.execute() result: null

Probably only flutter team can take a look at.

KazuCocoa commented 3 years ago

ah, I had misreading. Hm... but i don't have good insight.