From 54135907abb6431c26bd0ac015620bc46e7ff18c Mon Sep 17 00:00:00 2001 From: tiagocandido Date: Thu, 25 Jun 2026 10:11:17 +0200 Subject: [PATCH] Fix flaky Swift preload expiry test --- .../ShopifyCheckoutKitTests/CheckoutWebViewTests.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift index ad49ba11..00e222ab 100644 --- a/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift +++ b/platforms/swift/Tests/ShopifyCheckoutKitTests/CheckoutWebViewTests.swift @@ -360,13 +360,13 @@ class CheckoutWebViewTests: XCTestCase { } func testPreloadCacheExpiresAndStopsKeepAlive() { - let nearlyStaleCreatedAt = Date(timeIntervalSinceNow: -(5 * 60 - 0.1)) + let nearlyStaleCreatedAt = Date(timeIntervalSinceNow: -(5 * 60 - 1)) CheckoutWebView.preload(checkout: EmbeddedCheckoutProtocol.url(for: url), createdAt: nearlyStaleCreatedAt) XCTAssertTrue(CheckoutWebView.preloadCache.hasEntry()) XCTAssertTrue(CheckoutWebView.preloadCache.hasActiveKeepAlive()) let expired = expectation(description: "preload cache expired") - let deadline = Date(timeIntervalSinceNow: 2) + let deadline = Date(timeIntervalSinceNow: 3) func pollForExpiry() { if !CheckoutWebView.preloadCache.hasEntry(), !CheckoutWebView.preloadCache.hasActiveKeepAlive() { expired.fulfill() @@ -381,7 +381,7 @@ class CheckoutWebViewTests: XCTestCase { pollForExpiry() - wait(for: [expired], timeout: 2) + wait(for: [expired], timeout: 3) } func testPreloadKeepAliveFailureInvalidatesCache() {