Skip to content

Commit e18d392

Browse files
authored
test: Fix flaky launch UI test (#5515)
1 parent 581ef4b commit e18d392

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Samples/iOS-Swift/iOS-Swift/TransactionsViewController.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ class TransactionsViewController: UIViewController {
2525
}
2626

2727
private func periodicallyDoWork() {
28+
// This creates spans on background queues when doing things like reading files
29+
// The background spans can interfere with UI tests that assert certain active spans
30+
// (using SentryScope.span) because if this span is running the active span does not
31+
// get overwritten (bindToScope = 0)
32+
guard ProcessInfo.processInfo.environment["--io.sentry.ui-test.test-name"] == nil else { return }
2833

2934
self.timer = Timer.scheduledTimer(withTimeInterval: 5.0, repeats: true) { _ in
3035
self.dispatchQueue.async {

0 commit comments

Comments
 (0)