diff --git a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerTests.swift b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerTests.swift index f23098b0753..84c02a64e14 100644 --- a/Tests/SentryTests/Integrations/ANR/SentryANRTrackerTests.swift +++ b/Tests/SentryTests/Integrations/ANR/SentryANRTrackerTests.swift @@ -137,7 +137,10 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { anrDetectedExpectation.isInverted = true let mainBlockExpectation = expectation(description: "Main Block") - + + //Having a second Listener may cause the tracker to execute more than once before the end of the test + mainBlockExpectation.assertForOverFulfill = false + fixture.dispatchQueue.blockBeforeMainBlock = { self.sut.clear() mainBlockExpectation.fulfill() @@ -146,8 +149,8 @@ class SentryANRTrackerTests: XCTestCase, SentryANRTrackerDelegate { sut.addListener(secondListener) start() - wait(for: [anrDetectedExpectation, anrStoppedExpectation, mainBlockExpectation, secondListener.anrStoppedExpectation, secondListener.anrDetectedExpectation], timeout: waitTimeout) + } func anrDetected() {