mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
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:
@@ -56,19 +56,21 @@ final class MediaUploadPreviewScreenViewModelTests {
|
||||
try await send()
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(.timeLimit(.minutes(2))) // Transcoding videos can be slow on a busy CI runner.
|
||||
func videoUploadWithoutCaption() async throws {
|
||||
setUpViewModel(urls: [videoURL], expectedCaption: nil)
|
||||
context.caption = .init("")
|
||||
try await send()
|
||||
// The preprocessor transcodes the video for real which can take a while on a busy CI runner.
|
||||
try await send(timeout: .seconds(60))
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test(.timeLimit(.minutes(2))) // Transcoding videos can be slow on a busy CI runner.
|
||||
func videoUploadWithCaption() async throws {
|
||||
let caption = "Check out this video!"
|
||||
setUpViewModel(urls: [videoURL], expectedCaption: caption)
|
||||
context.caption = .init(string: caption)
|
||||
try await send()
|
||||
// The preprocessor transcodes the video for real which can take a while on a busy CI runner.
|
||||
try await send(timeout: .seconds(60))
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -306,10 +308,10 @@ final class MediaUploadPreviewScreenViewModelTests {
|
||||
return .success(())
|
||||
}
|
||||
|
||||
private func send() async throws {
|
||||
private func send(timeout: Duration = .seconds(10)) async throws {
|
||||
#expect(!context.viewState.shouldDisableInteraction, "Attempting to send when interaction is disabled.")
|
||||
|
||||
let deferred = deferFulfillment(viewModel.actions) { $0 == .dismiss }
|
||||
let deferred = deferFulfillment(viewModel.actions, timeout: timeout) { $0 == .dismiss }
|
||||
context.send(viewAction: .send)
|
||||
|
||||
#expect(context.viewState.shouldDisableInteraction, "The interaction should be disabled while sending.")
|
||||
|
||||
Reference in New Issue
Block a user