android-emulator-runner icon indicating copy to clipboard operation
android-emulator-runner copied to clipboard

No activities in stage RESUMED. Did you forget to launch the activity. (test.getActivity() or similar)?

Open Bhuvanaarkala07 opened this issue 2 years ago • 2 comments

I created ui tests newly and started running them in CI, but they aref ailing, where as the same tests working locally. Failed test logs are,

Task :app:connectedDevDebugAndroidTest Starting 3 tests on test(AVD) - 10

ui.login.LoginFragmentTest > verifyLoginTransaction[test(AVD) - 10] FAILED androidx.test.espresso.NoActivityResumedException: No activities in stage RESUMED. Did you forget to launch the activity. (test.getActivity() or similar)? at dalvik.system.VMStack.getThreadStackTrace(Native Method)

ui.register.RegisterFragmentTest > verifyRegisterTest[test(AVD) - 10] FAILED androidx.test.espresso.NoActivityResumedException: No activities in stage RESUMED. Did you forget to launch the activity. (test.getActivity() or similar)? at dalvik.system.VMStack.getThreadStackTrace(Native Method) Tests on test(AVD) - 10 failed: There was 2 failure(s).

This is my script: instrumentation-test: runs-on: macos-latest timeout-minutes: 15

steps: - name: Checkout the code uses: actions/checkout@v2

 - name: access github
   run: touch github.properties  #Required so that build.gradle works properly

 - name: set up JDK 11
   uses: actions/setup-java@v2
   with:
     distribution: 'zulu'
     java-version: 11
     
 - name: Gradle cache
   uses: gradle/gradle-build-action@v2
   
 - name: AVD cache
   uses: actions/cache@v3
   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
      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 espresso tests
   env:
     KEYSTORE_PASSWORD: "fsandroiddev"
     FW_KEYSTORE_PASSWORD: "fsandroiddev"
     GITHUB_ACTOR: ${{ secrets.MOBILE_CI_USERNAME }}
     GITHUB_TOKEN: ${{ secrets.MOBILE_CI_USER_PAT }}
   uses: reactivecircus/android-emulator-runner@v2
   with:
     api-level: 29
     avd-name: test
     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: ./gradlew connectedDevDebugAndroidTest

Can any one help me regarding this?

Bhuvanaarkala07 avatar Jul 30 '22 11:07 Bhuvanaarkala07

I am also experiencing this recently out of nowhere

al1baba avatar Aug 05 '22 19:08 al1baba

Any solutions/fixes?

jakwer avatar Oct 16 '22 16:10 jakwer

@jakwer This is related to your app internals and not this action.

If you are using ActivityTestRule documentation and make sure you are passing in the correct activity with the relevant follow-up parameters.

mrk-han avatar Oct 19 '22 20:10 mrk-han