Fix for flaky tests (#5869)

* possible logging tests fix

* fix for flaky tests

* use timelimit for max test time

* pr suggestions

* remove comment
This commit is contained in:
Mauro
2026-07-14 18:01:36 +02:00
committed by GitHub
parent 85f28d017d
commit 39bd882a27
14 changed files with 231 additions and 132 deletions
@@ -741,11 +741,7 @@ final class ComposerToolbarViewModelTests {
}
}
// There are 2 violations, ensure that resolving the first one is not enough
let mockSubject = CurrentValueSubject<[IdentityStatusChange], Never>([
IdentityStatusChange(userId: "@alice:localhost", changedTo: .verificationViolation),
IdentityStatusChange(userId: "@bob:localhost", changedTo: .verificationViolation)
])
let mockSubject = CurrentValueSubject<[IdentityStatusChange], Never>([])
roomProxyMock.identityStatusChangesPublisher = mockSubject.asCurrentValuePublisher()
@@ -761,12 +757,16 @@ final class ComposerToolbarViewModelTests {
composerDraftService: draftServiceMock)
var fulfillment = deferFulfillment(viewModel.context.$viewState, message: "Composer is disabled") { $0.canSend == false }
mockSubject.send([IdentityStatusChange(userId: "@alice:localhost", changedTo: .verificationViolation)])
mockSubject.send([
IdentityStatusChange(userId: "@alice:localhost", changedTo: .verificationViolation),
IdentityStatusChange(userId: "@bob:localhost", changedTo: .verificationViolation)
])
try await fulfillment.fulfill()
fulfillment = deferFulfillment(viewModel.context.$viewState, message: "Composer is still disabled") { $0.canSend == false }
// There are 2 violations, ensure that resolving the first one is not enough.
let failure = deferFailure(viewModel.context.$viewState, timeout: .seconds(1), message: "Composer should still be disabled") { $0.canSend == true }
mockSubject.send([IdentityStatusChange(userId: "@alice:localhost", changedTo: .pinned)])
try await fulfillment.fulfill()
try await failure.fulfill()
fulfillment = deferFulfillment(viewModel.context.$viewState, message: "Composer is now enabled") { $0.canSend == true }
mockSubject.send([IdentityStatusChange(userId: "@bob:localhost", changedTo: .pinned)])