Actual Android emulator issues

Not just UI, right @tamaspapik? :stuck_out_tongue:

Itā€™s better to use waitForView in place of onView when you need to wait. This eliminates the need for sleeping a magical amount of time.

https://github.com/instructure/instructure-android/blob/master/espresso/src/main/java/com/instructure/espresso/WaitForViewMatcher.java

1 Like

Sounds awesome - @tamaspapik did you try this?

Not yet. Yep, sounds good. Will try it soon, hope it replaces the sleeps :ok_hand:

1 Like

As far as I could research, waitForView is not available in every test types. So for now thatā€™s not an overall solution as well. Is there anything similar to waitForView in espresso instruments tests?

Normally IdlingResource is used for waiting for some condition.
For example in case of waiting for view to be added to the hierarchy GlobalLayoutListener can be added to the decor view and then view presence checked inside onGlobalLayout callback.

2 Likes

Iā€™m not sure youā€™re understanding the concept behind the code. waitForView is a utility method Iā€™ve defined that implements the concept of a waiting matcher. This is different from a static sleep. Theyā€™re popular in the web testing realm as well. Another term for this is an explicit wait. In EarlGrey for example, theyā€™re called conditions.

http://elementalselenium.com/tips/47-waiting

Ah, got it. :+1:

Another workaround (different than arm emulator inside VM on bitrise.io and FTL) for people who have an access to machine which can be reachable from bitrise.io and capable of running x86 emulator is to use remote ADB server.
-H parameter can be used to specify ADB host. E.g adb -H 1.2.3.4 devices will list devices connected to server with IP 1.2.3.4.
Emulators can also be connected to Open STF (bitrise step is available). This will add some handy features like app uninstallation after testing or connection with local ADB server, so it will be visible just like local device.

1 Like

Great ideas @koral!

Open STF seems like an awesome tool, Iā€™ll have to try that some day :wink: Also, thanks for the Open STF steps! :slight_smile:

We use Create Android Emulator step v1.1.5 and then with avd config: android-25/armeabi-v7a/google_apis and then using Start Android emulator step v1.3.1 still causes steps failing (timeouts). (100% times). We didnā€™t find any solution yet, so currently all of our builds are failing.

We had this problem once with Travis/jenkins android-wait-for-emulator script and it turned out that those system images do not have at least one of the properties used for detecting booting completion, like: init.svc.bootanim. This is why we had to switch to ā€˜defaultā€™ system image. Unfortunately, we canā€™t do the same in our current project, as we need google_apis sysimg.

Is this issue parked for any near future?

This issue is still open for resolution. :slightly_smiling_face:

Just checked, and we use init.svc.bootanim for checking boot status.
And also there are others, here you can check them:

1 Like