From 8ab609cea34df6f2e982c75e4a05e3a8d83bc036 Mon Sep 17 00:00:00 2001 From: Sam Symons Date: Fri, 6 Dec 2024 15:37:40 -0800 Subject: [PATCH] Improve tab lazy loading test reliability (#3645) Task/Issue URL: https://app.asana.com/0/1199230911884351/1208926119997580/f Tech Design URL: CC: Description: This is an experimental change to improve some CI reliability, after successfully reproducing failures locally and then applying this fix to resolve them. So far, I haven't seen another failure locally after a half dozen runs, whereas before I could reproduce this almost every time. --- UnitTests/Sync/SyncPreferencesTests.swift | 3 ++- UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/UnitTests/Sync/SyncPreferencesTests.swift b/UnitTests/Sync/SyncPreferencesTests.swift index ea2de50259..8fd96c76e8 100644 --- a/UnitTests/Sync/SyncPreferencesTests.swift +++ b/UnitTests/Sync/SyncPreferencesTests.swift @@ -144,9 +144,10 @@ final class SyncPreferencesTests: XCTestCase { @MainActor func testOnTurnOffSyncThenSyncServiceIsDisconnected() async { let expectation = XCTestExpectation(description: "Disconnect completed") - Task { + Task { @MainActor in syncPreferences.turnOffSync() XCTAssertNil(managementDialogModel.currentDialog) + await Task.yield() expectation.fulfill() } await fulfillment(of: [expectation], timeout: 5.0) diff --git a/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift b/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift index 75012b3bee..f69f9f5244 100644 --- a/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift +++ b/UnitTests/TabBar/ViewModel/TabLazyLoaderTests.swift @@ -243,7 +243,7 @@ class TabLazyLoaderTests: XCTestCase { lazyLoader?.scheduleLazyLoading() // Then - waitForExpectations(timeout: 0.3) + waitForExpectations(timeout: 3.0) XCTAssertEqual(didFinishEvents.count, 1) XCTAssertEqual(try XCTUnwrap(didFinishEvents.first), true) }