ReactiveCircus / android-emulator-runner

A GitHub Action for installing, configuring and running hardware-accelerated Android Emulators on macOS virtual machines.
Apache License 2.0
953 stars 188 forks source link

androidx.test.espresso.PerformException: Error performing 'scroll to' on view 'Animations or transitions are enabled on the target device. #158

Closed sprajagopal closed 1 year ago

sprajagopal commented 3 years ago

I have gone through the docs and other issues to debug this issue. This is my config:

API level: 23
target: default
CPU architecture: x86
Hardware profile: Nexus 6
Cores: 2
SD card path or size: 
AVD name: test
emulator options: -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim
disable animations: true
disable spellchecker: false
disable Linux hardware acceleration: true
Script:
./gradlew connectedCheck --stacktrace

I checked that adb commands are appropriately disabling the animations:

Emulator booted.
/usr/local/lib/android/sdk/platform-tools/adb shell input keyevent 82
Disabling animations.
/usr/local/lib/android/sdk/platform-tools/adb shell settings put global window_animation_scale 0.0
/usr/local/lib/android/sdk/platform-tools/adb shell settings put global transition_animation_scale 0.0
/usr/local/lib/android/sdk/platform-tools/adb shell settings put global animator_duration_scale 0.0
/usr/bin/sh -c ./gradlew connectedCheck --stacktrace

My tests work on a local emulator but with this:

androidx.test.espresso.PerformException: Error performing 'scroll to' on view 'Animations or transitions are enabled on the target device.

The confusing part here is that animations are definitely disabled. This answer in stackoverflow mentions that NPE can cause this error but there is no stacktrace in this case.

I'm kinda lost at this point. I assumed local test cases would translate directly to this emulator but it doesn't seem to be the case. Are there any methods to debug this?

ychescale9 commented 3 years ago

My tests work on a local emulator but with this:

Does your test work locally?

Can you try adding the following before ./gradlew connectedCheck:

adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0
sprajagopal commented 3 years ago

Does your test work locally?

I tried on Pixel and Nexus devices locally (on the Android Studio) and they work fine.

Can you try adding the following before ./gradlew connectedCheck:

adb shell settings put global window_animation_scale 0.0
adb shell settings put global transition_animation_scale 0.0
adb shell settings put global animator_duration_scale 0.0

Tried that.

/usr/local/lib/android/sdk/platform-tools/adb shell getprop sys.boot_completed
1
Emulator booted.
/usr/local/lib/android/sdk/platform-tools/adb shell input keyevent 82
Disabling animations.
/usr/local/lib/android/sdk/platform-tools/adb shell settings put global window_animation_scale 0.0
/usr/local/lib/android/sdk/platform-tools/adb shell settings put global transition_animation_scale 0.0
/usr/local/lib/android/sdk/platform-tools/adb shell settings put global animator_duration_scale 0.0
/usr/bin/sh -c adb shell settings put global window_animation_scale 0.0
/usr/bin/sh -c adb shell settings put global transition_animation_scale 0.0
/usr/bin/sh -c adb shell settings put global animator_duration_scale 0.0
/usr/bin/sh -c ./gradlew connectedCheck --stacktrace

No change in the errors.

    androidx.test.espresso.PerformException: Error performing 'scroll to' on view 'Animations or transitions are enabled on the target device.
sprajagopal commented 3 years ago

Out of the many tests, most of them also fail with:

androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching
ashutoshgngwr commented 3 years ago

@sprajagopal https://github.com/ReactiveCircus/android-emulator-runner/issues/162#issuecomment-883038261 might help.

mrk-han commented 1 year ago

For anyone who sees this in the future, it would help to get a recording of the run. You can run a step that installs ffmpeg then records for a duration to see what is happening on the VM and emulator.

- name: Install and Record FFMPEG
  run: |
    brew install ffmpeg
    ffmpeg -f avfoundation -i 0 -t 240 video-recording.mov &

    ## run tests here

- name: Upload Video Recording
   uses: actions/upload-artifact@v3
    with:
      name: out
      path: out.mov

Closing because stale, and because this would likely happen if emulator was started without using this action command (outside of this action's scope).