Skip to content

Commit a41aa20

Browse files
committed
Attempt to stabilize Crashlytics tests
1 parent ad0d12b commit a41aa20

File tree

1 file changed

+22
-0
lines changed
  • firebase-crashlytics/src/commonTest/kotlin/dev/gitlive/firebase/crashlytics

1 file changed

+22
-0
lines changed

firebase-crashlytics/src/commonTest/kotlin/dev/gitlive/firebase/crashlytics/crashlytics.kt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ import dev.gitlive.firebase.apps
1010
import dev.gitlive.firebase.initialize
1111
import dev.gitlive.firebase.runBlockingTest
1212
import dev.gitlive.firebase.runTest
13+
import kotlinx.coroutines.delay
1314
import kotlin.test.AfterTest
1415
import kotlin.test.BeforeTest
1516
import kotlin.test.Test
1617
import kotlin.test.assertFalse
18+
import kotlin.time.Duration.Companion.seconds
1719

1820
expect val emulatorHost: String
1921
expect val context: Any
@@ -51,37 +53,57 @@ class FirebaseCrashlyticsTest {
5153
@Test
5254
fun testRecordException() = runTest {
5355
crashlytics.recordException(Exception("Test Exception"))
56+
57+
// Delay to ensure Crashlytics completes
58+
delay(1.seconds)
5459
}
5560

5661
@Test
5762
fun testLog() = runTest {
5863
crashlytics.log("Test Log")
64+
65+
// Delay to ensure Crashlytics completes
66+
delay(1.seconds)
5967
}
6068

6169
@Test
6270
fun testSetUserId() = runTest {
6371
crashlytics.setUserId("Test User Id")
6472

73+
// Delay to ensure Crashlytics completes
74+
delay(1.seconds)
6575
}
6676

6777
@Test
6878
fun testSendUnsentReports() = runTest {
6979
crashlytics.sendUnsentReports()
80+
81+
// Delay to ensure Crashlytics completes
82+
delay(1.seconds)
7083
}
7184

7285
@Test
7386
fun testDeleteUnsentReports() = runTest {
7487
crashlytics.deleteUnsentReports()
88+
89+
// Delay to ensure Crashlytics completes
90+
delay(1.seconds)
7591
}
7692

7793
@Test
7894
fun testDidCrashOnPreviousExecution() = runTest {
7995
val didCrash = crashlytics.didCrashOnPreviousExecution()
8096
assertFalse { didCrash }
97+
98+
// Delay to ensure Crashlytics completes
99+
delay(1.seconds)
81100
}
82101

83102
@Test
84103
fun testSetCrashlyticsCollectionEnabled() = runTest {
85104
crashlytics.setCrashlyticsCollectionEnabled(true)
105+
106+
// Delay to ensure Crashlytics completes
107+
delay(1.seconds)
86108
}
87109
}

0 commit comments

Comments
 (0)