pedrovgs / Shot

Screenshot testing library for Android
Apache License 2.0
1.18k stars 115 forks source link

Shot not recording snapshot images on Android R #262

Closed raafaelima closed 2 years ago

raafaelima commented 2 years ago

Hey Folks,

Since I update my project to use the API 31 (Android R), I'm having kinda the same issues. The test runs Ok, however, the snapshot folder can be found or created. I can't figure out what is wrong, to be honest. Could you guys help me to understand?

I'm using an AndroidAuto emulator to develop, however, the behavior is reproducible on my Pixel Emulator too.

I created a sample app with the same configuration that I have on my real project, you can find it here: https://github.com/raafaelima/ShotSnapshotSample

Screenshot 2021-10-22 at 12 58 26

RaggedyCoder commented 2 years ago

Well, I am having the same issue even with API 27 on my project.

Alton09 commented 2 years ago

I've seen this issue when running on an emulator and on a SM-G975U running Android 10. I got the tests to work though on a Pixel 3 running Android 12. Seems to be an issue for specific devices/OS versions. I ran the tests from this sample project.

pedrovgs commented 2 years ago

Guys, could you please test the new release 5.12.2?

kmikeevfelyx commented 2 years ago

I have it on 5.12.2, M1 Macbook, Emulator API 32, targetSdk 32. It just does not record and there are no clues in the log.

kmikeevfelyx commented 2 years ago

Oh. my problem was that I didn't use com.karumi.shot.ShotTestRunner, solved!

raafaelima commented 2 years ago

Oh Hi, even with the update to version 5.12.2, I'm having the same results here. I'm using this project ShotSnapshotSample to test it, if you wanna see anything.

image

mariuszmarzec commented 2 years ago

@raafaelima In my newest PR introducting support for orchestrator i bumped version of facebook screenshot library used under the hood: #273
I made a test in my project and looks like it work on mentioned emulator. Below i copied best configuration for espresso to made shot working:

 val runner_version = "1.3.0"
    val orchestrator_version = "1.4.1"
    val android_test_services_version = "1.4.1"
    val espresso_core = "3.3.0"

    androidTestImplementation("androidx.test:core:${Dependency.runner_version}")
    androidTestImplementation("androidx.test:runner:${Dependency.runner_version}")
    androidTestImplementation("androidx.test:rules:${Dependency.runner_version}")
    androidTestUtil("androidx.test:orchestrator:${Dependency.orchestrator_version}")
    androidTestUtil("androidx.test.services:test-services:${Dependency.android_test_services_version}")
    androidTestImplementation("androidx.test.espresso:espresso-core:${Dependency.espresso_core}")
    androidTestImplementation("androidx.test.espresso:espresso-contrib:${Dependency.espresso_core}")

You can push version of shot library to local maven repository and used it till PR will be merged.

pedrovgs commented 2 years ago

Releasing a new version today. Feel free to reopen this issue if the new version doesn't fix this issue.