Skip to content

Commit 77e6062

Browse files
authored
Fix double init UI test (#4723)
* removed checking envelope sent while SDK restart from ui test, as it was flaky
1 parent 1c69dc8 commit 77e6062

File tree

1 file changed

+3
-20
lines changed
  • sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android

1 file changed

+3
-20
lines changed

sentry-android-integration-tests/sentry-uitest-android/src/androidTest/java/io/sentry/uitest/android/SdkInitTests.kt

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,20 +112,7 @@ class SdkInitTests : BaseUiTest() {
112112

113113
@Test
114114
fun doubleInitDoesNotWait() {
115-
relayIdlingResource.increment()
116-
// Let's make the first request timeout
117-
relay.addTimeoutResponse()
118-
119-
initSentry(true) { options: SentryAndroidOptions -> options.tracesSampleRate = 1.0 }
120-
121-
Sentry.startTransaction("beforeRestart", "emptyTransaction").finish()
122-
123-
// We want the SDK to start sending the event. If we don't wait, it's possible we don't send
124-
// anything before the SDK is restarted
125-
waitUntilIdle()
126-
127-
relayIdlingResource.increment()
128-
relayIdlingResource.increment()
115+
initSentry(true)
129116

130117
val beforeRestart = System.currentTimeMillis()
131118
// We restart the SDK. This shouldn't block the main thread, but new options (e.g. profiling)
@@ -137,18 +124,14 @@ class SdkInitTests : BaseUiTest() {
137124
val afterRestart = System.currentTimeMillis()
138125
val restartMs = afterRestart - beforeRestart
139126

127+
relayIdlingResource.increment()
140128
Sentry.startTransaction("afterRestart", "emptyTransaction").finish()
129+
141130
// We assert for less than 1 second just to account for slow devices in saucelabs or headless
142131
// emulator
143132
assertTrue(restartMs < 1000, "Expected less than 1000 ms for SDK restart. Got $restartMs ms")
144133

145134
relay.assert {
146-
findEnvelope { assertEnvelopeTransaction(it.items.toList()).transaction == "beforeRestart" }
147-
.assert {
148-
it.assertTransaction()
149-
// No profiling item, as in the first init it was not enabled
150-
it.assertNoOtherItems()
151-
}
152135
findEnvelope { assertEnvelopeTransaction(it.items.toList()).transaction == "afterRestart" }
153136
.assert {
154137
it.assertTransaction()

0 commit comments

Comments
 (0)