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

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

Open sprajagopal opened this issue 4 years ago • 4 comments

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?

sprajagopal avatar Jun 15 '21 10:06 sprajagopal

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

ychescale9 avatar Jun 15 '21 10:06 ychescale9

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 avatar Jun 15 '21 18:06 sprajagopal

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

androidx.test.espresso.NoMatchingViewException: No views in hierarchy found matching

sprajagopal avatar Jun 15 '21 18:06 sprajagopal

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

ashutoshgngwr avatar Jul 20 '21 04:07 ashutoshgngwr

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).

mrk-han avatar Nov 02 '22 04:11 mrk-han