facebook / screenshot-tests-for-android

Generate fast deterministic screenshots during Android instrumentation tests
http://facebook.github.io/screenshot-tests-for-android
Apache License 2.0
1.74k stars 229 forks source link

test failure: Is your sdcard directory read-only? #323

Open HussainChachuliya0306 opened 7 months ago

HussainChachuliya0306 commented 7 months ago

Dependencies used:

screenshot : 0.15.0
kotlin: 1.7.10
gradle: 7.5

I'm getting below error while trying to run a test:

java.lang.RuntimeException: Failed to create the directory /sdcard/screenshots/com.slopes.test/screenshots-default for screenshots. Is your sdcard directory read-only?
    at com.facebook.testing.screenshot.internal.ScreenshotDirectories.getSdcardDir(ScreenshotDirectories.java:126)

Here is my failing test:


   @Test
    fun screenshotTest() {
      mockData()

        val scenario = openFragment(r)
        scenario.onFragment {
            Screenshot.snapActivity(it.requireActivity())
                .setName("sampleTest1")
                .record()
        }

        PageObject.on<FragPageObject>()
            .verifyEmptyView()
    }
luowei428 commented 3 months ago

hi @HussainChachuliya0306 , did you figure it out? Same error here