android-emulator-runner
android-emulator-runner copied to clipboard
Instrumented Tests in Compose failing
Hello, everyone!
I'm facing some issues since I ported my application to Jetpack Compose.
Some of my tests are failing in the GitHub Action but are passing locally.
The error are very simple one, like Reason: Expected exactly '1' node but could not find any node that satisfies
, meaning that the Composable node was not found. However it does not fail on emulator locally (tried on Nexus 5, Pixel 4 XL and Generic).
Currently my script is:
name: instrumented tests
on: [ push ]
jobs:
build:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
- name: Android Emulator Runner
uses: ReactiveCircus/[email protected]
with:
api-level: 29
target: google_apis
script: ./gradlew connectedCheck --stacktrace
Am I missing some configuration to work better with Jetpack Compose?
Thanks a lot for your help!
I haven't had time to try running compose tests with this action yet but I've seen similar issues as you mentioned in some compose-samples android tests which are ignored. However the accompanist library does run instrumentation tests with this action: https://github.com/google/accompanist/blob/main/.github/workflows/build.yml.
I'll look into it when I migrate my sample app to compose. But hopefully someone else can share their experience with running compose tests with this action😀
Thanks for the quick reply!
Feel free to use my open-source project to test, if you want. 😊 https://github.com/igorescodro/alkaa
I'll investigate this repo and try to test it again. I'll let you know if works!
EDIT: didn't work with same configs. ☹️
@igorescodro did you ever figure this out? Having similar issues.. assertIsDisplayed()
fails, but only on the GH Actions emulator. Running a local headless emulator and the tests pass.
I am having the same exact issue. my fix, as dirty as it is, is working. I am adding Thread.sleep(2000) in between steps to give the emulator some room to be slow .. Also I used api 28 , seem to have better results overall on it!
I am back to having failures, it seems waitUntil fails on the CI everytime but never locally. I am not able to get more insights..
can this thread get some love ? thanks :)
@jrdaher Sorry, my theory is this is because the emulators are really slow on CI with the Standard Github Runners. Unfortunately it seems like this issue is more related to the AndroidX.Test team, Google Emulator team, Github Runner team -- and the mix of those, rather than this action itself.
I'm having this same issue, has someone managed to fix it?