-
-
Notifications
You must be signed in to change notification settings - Fork 227
Closed
Description
I'm trying to run android tests and sometimes the emulator is in some sort of weird state? The tests just fail to start and all I get is:
[EmulatorConsole]: Failed to start Emulator console for 5554
> Task :app:connectedDebugAndroidTest
Starting 2 tests on emulator-5554 - 10
emulator-5554 - 10 Tests 0/2 completed. (0 skipped) (0 failed)
> Task :app:connectedDebugAndroidTest
com.opacitylabs.opacitycoreexample.UITests > testSuccessFlowButton[emulator-5554 - 10] FAILED
java.lang.IllegalStateException: No compose hierarchies found in the app. Possible reasons include: (1) the Activity that calls setContent did not launch; (2) setContent was not called; (3) setContent was called before the ComposeTestRule ran. If setContent is called by the Activity, make sure the Activity is launched after the ComposeTestRule runs
at androidx.compose.ui.test.TestContext.getAllSemanticsNodes$ui_test_release(TestOwner.kt:87)
emulator-5554 - 10 Tests 1/2 completed. (0 skipped) (1 failed)
Finished 2 tests on emulator-5554 - 10
> Task :app:connectedDebugAndroidTest
Tests on emulator-5554 - 10 failed: There was 1 failure(s).
> Task :app:connectedDebugAndroidTest FAILED
gradle/actions: Writing build results to /home/runner/work/_temp/.gradle-actions/build-results/__reactivecircus_android-emulator-runner_2-1756305651126.json
I've tried debugging it in every way possible adding more adb shell commands to make sure the screen is not locked but to no successs, sometimes the tests pass, sometimes they fail. The code I use to run the tests:
- name: AVD cache
uses: actions/cache@v4
id: avd-cache
with:
path: |
~/.android/avd/*
~/.android/adb*
key: avd-29
- name: create AVD and generate snapshot for caching
if: steps.avd-cache.outputs.cache-hit != 'true'
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
force-avd-creation: false
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: false
script: echo "Generated AVD snapshot for caching."
- name: run tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 29
arch: x86_64
force-avd-creation: false
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: |
adb wait-for-device
adb shell wm dismiss-keyguard
adb shell input keyevent 82
cd opacity-android && ./gradlew connectedAndroidTest
Metadata
Metadata
Assignees
Labels
No labels