kotlin-snapshot-testing icon indicating copy to clipboard operation
kotlin-snapshot-testing copied to clipboard

Crash when using `snapshot` method

Open olegosipenko opened this issue 2 years ago • 0 comments

java.lang.AssertionError: Not able to create snapshot directory: /snapshot/EmailLoginFragmentTest
at org.junit.Assert.fail(Assert.java:89)
at kotlin.test.junit.JUnitAsserter.fail(JUnitSupport.kt:56)
at kotlin.test.Asserter$DefaultImpls.assertTrue(Assertions.kt:652)
at kotlin.test.junit.JUnitAsserter.assertTrue(JUnitSupport.kt:30)
at kotlin.test.Asserter$DefaultImpls.assertTrue(Assertions.kt:662)
at kotlin.test.junit.JUnitAsserter.assertTrue(JUnitSupport.kt:30)
at kotlin.test.AssertionsKt__AssertionsKt.assertTrue(Assertions.kt:44)
at kotlin.test.AssertionsKt.assertTrue(Unknown Source:1)
at com.quickbird.snapshot.FileSnapshotting_snapshotKt.snapshot$file(FileSnapshotting+snapshot.kt:20)
at com.quickbird.snapshot.FileSnapshotting_snapshotKt.snapshot(FileSnapshotting+snapshot.kt:29)
at com.quickbird.snapshot.JUnitFileSnapshotTest.snapshot(JUnitFileSnapshottingTest.kt:18)
at com.quickbird.snapshot.JUnitFileSnapshotTest.snapshot$default(JUnitFileSnapshottingTest.kt:13)
at com.github.olegosipenko.kointestsample.EmailLoginFragmentTest$testBasicInvocation$1$3.invokeSuspend(EmailLoginFragmentTest.kt:56)
at com.github.olegosipenko.kointestsample.EmailLoginFragmentTest$testBasicInvocation$1$3.invoke(Unknown Source:8)
at com.github.olegosipenko.kointestsample.EmailLoginFragmentTest$testBasicInvocation$1$3.invoke(Unknown Source:4)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutine$2.invokeSuspend(TestBuilders.kt:212)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutine$2.invoke(Unknown Source:8)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTestCoroutine$2.invoke(Unknown Source:4)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startCoroutineUndispatched(Undispatched.kt:55)
at kotlinx.coroutines.CoroutineStart.invoke(CoroutineStart.kt:112)
at kotlinx.coroutines.AbstractCoroutine.start(AbstractCoroutine.kt:126)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTestCoroutine(TestBuilders.kt:211)
at kotlinx.coroutines.test.TestBuildersKt.runTestCoroutine(Unknown Source:1)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$1$1.invokeSuspend(TestBuilders.kt:167)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$1$1.invoke(Unknown Source:8)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt$runTest$1$1.invoke(Unknown Source:4)
at kotlinx.coroutines.test.TestBuildersJvmKt$createTestResult$1.invokeSuspend(TestBuildersJvm.kt:13)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
at kotlinx.coroutines.test.TestBuildersJvmKt.createTestResult(TestBuildersJvm.kt:12)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest(TestBuilders.kt:166)
at kotlinx.coroutines.test.TestBuildersKt.runTest(Unknown Source:1)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest(TestBuilders.kt:154)
at kotlinx.coroutines.test.TestBuildersKt.runTest(Unknown Source:1)
at kotlinx.coroutines.test.TestBuildersKt__TestBuildersKt.runTest$default(TestBuilders.kt:147)
at kotlinx.coroutines.test.TestBuildersKt.runTest$default(Unknown Source:1)
at com.github.olegosipenko.kointestsample.EmailLoginFragmentTest$testBasicInvocation$1.invoke(EmailLoginFragmentTest.kt:54)
at com.github.olegosipenko.kointestsample.EmailLoginFragmentTest$testBasicInvocation$1.invoke(EmailLoginFragmentTest.kt:47)
at io.github.kakaocup.compose.node.core.KDSL$DefaultImpls.invoke(KDSL.kt:7)
at io.github.kakaocup.compose.node.core.BaseNode.invoke(BaseNode.kt:15)
at com.github.olegosipenko.kointestsample.EmailLoginFragmentTest.testBasicInvocation(EmailLoginFragmentTest.kt:107)

Example of the test:

 onComposeScreen<EmailLoginForm>(composeTestRule) {
     runTest {
         FileSnapshotting.composeScreenshot
             .snapshot(composeTestRule, record = true)
     }
 }

Device Снимок экрана 2023-07-09 в 17 20 21

olegosipenko avatar Jul 09 '23 12:07 olegosipenko