Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Taking snapshot failing when saving to storage #357

Open
JordanLongstaff opened this issue Oct 18, 2024 · 0 comments
Open

Taking snapshot failing when saving to storage #357

JordanLongstaff opened this issue Oct 18, 2024 · 0 comments

Comments

@JordanLongstaff
Copy link

JordanLongstaff commented Oct 18, 2024

The instructions in the README said to include an AndroidManifest.xml file in my androidTest directory to avoid errors with trying to create the snapshot directory in storage. I did that, but those errors still occur.

Expected behaviour

The snapshot test should not fail.

Actual behaviour

Exception captured while taking screenshot for snapshot with name artemis.agent.MainActivityTest_setupPage
java.lang.RuntimeException: Failed to create the directory /storage/emulated/0/Download/screenshots/artemis.agent.test/screenshots-default for screenshots. Is your sdcard directory read-only?
	at com.facebook.testing.screenshot.internal.ScreenshotDirectories.getSdcardDir(ScreenshotDirectories.java:126)
	at com.facebook.testing.screenshot.internal.ScreenshotDirectories.get(ScreenshotDirectories.java:54)
	at com.facebook.testing.screenshot.internal.AlbumImpl.<init>(AlbumImpl.java:52)
	at com.facebook.testing.screenshot.internal.AlbumImpl.create(AlbumImpl.java:61)
	at com.facebook.testing.screenshot.internal.ScreenshotImpl.create(ScreenshotImpl.java:76)
	at com.facebook.testing.screenshot.internal.ScreenshotImpl.getInstance(ScreenshotImpl.java:94)
	at com.facebook.testing.screenshot.Screenshot.snapActivity(Screenshot.java:49)
	at com.karumi.shot.ScreenshotTest$DefaultImpls.takeActivitySnapshot(ScreenshotTest.kt:217)
	at com.karumi.shot.ScreenshotTest$DefaultImpls.compareScreenshot(ScreenshotTest.kt:61)
	at artemis.agent.MainActivityTest.compareScreenshot(MainActivityTest.kt:17)
	at com.karumi.shot.ScreenshotTest$DefaultImpls.compareScreenshot$default(ScreenshotTest.kt:49)
	at artemis.agent.MainActivityTest.radioButtonsTest(MainActivityTest.kt:36)
	at java.lang.reflect.Method.invoke(Native Method)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.rules.ExternalResource$1.evaluate(ExternalResource.java:54)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at androidx.test.ext.junit.runners.AndroidJUnit4.run(AndroidJUnit4.java:162)
	at org.junit.runners.Suite.runChild(Suite.java:128)
	at org.junit.runners.Suite.runChild(Suite.java:27)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:68)
	at androidx.test.internal.runner.TestExecutor.execute(TestExecutor.java:59)
	at androidx.test.runner.AndroidJUnitRunner.onStart(AndroidJUnitRunner.java:463)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:2251)

Steps to reproduce

Clone this repo and checkout the shot branch, then run ./gradlew executeScreenshotTests -Precord -Pandroid.testInstrumentationRunnerArguments.class=artemis.agent.MainActivityTest.

Version of the library

6.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant