-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[in_app_purchase_storekit] Address flaky tests #11270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,6 +181,13 @@ final class InAppPurchase2PluginTests: XCTestCase { | |
| //TODO(louisehsu): Add testing for lower versions. | ||
| @available(iOS 17.0, macOS 14.0, *) | ||
| func testGetProductsWithStoreKitError() async throws { | ||
| let osVersion = ProcessInfo.processInfo.operatingSystemVersion | ||
| try XCTSkipIf( | ||
| // https://developer.apple.com/forums/thread/808030 | ||
| osVersion.majorVersion == 26 && osVersion.minorVersion == 2, | ||
| "Known StoreKitTest bug on Xcode 26.2 with setSimulatedError() when used on .loadProducts API" | ||
| ) | ||
|
Comment on lines
+184
to
+189
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://developer.apple.com/forums/thread/808030
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add the URL into a comment somewhere? Definitely also in this PR description. |
||
|
|
||
| try await session.setSimulatedError( | ||
| .generic(.networkError(URLError(.badURL))), forAPI: .loadProducts) | ||
|
|
||
|
|
@@ -217,6 +224,15 @@ final class InAppPurchase2PluginTests: XCTestCase { | |
|
|
||
| @available(iOS 17.0, macOS 14.0, *) | ||
| func testFailedNetworkErrorPurchase() async throws { | ||
| let osVersion = ProcessInfo.processInfo.operatingSystemVersion | ||
| try XCTSkipIf( | ||
| // https://developer.apple.com/forums/thread/808030 | ||
| osVersion.majorVersion == 26 && osVersion.minorVersion == 2, | ||
| "Known StoreKitTest bug on Xcode 26.2 with setSimulatedError() when used on .loadProducts API" | ||
| ) | ||
|
|
||
| // StoreKitTest aggressively caches products and transaction, which means sometimes it bypasses a simulated error. | ||
| session.clearTransactions() | ||
LouiseHsu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| try await session.setSimulatedError( | ||
| .generic(.networkError(URLError(.badURL))), forAPI: .loadProducts) | ||
| let expectation = self.expectation(description: "products request should fail") | ||
|
|
@@ -290,7 +306,7 @@ final class InAppPurchase2PluginTests: XCTestCase { | |
| XCTFail("Purchase should NOT fail. Failed with \(error)") | ||
| } | ||
| } | ||
| await fulfillment(of: [expectation], timeout: 5) | ||
| await fulfillment(of: [expectation], timeout: 10) | ||
LouiseHsu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| func testDiscountedProductSuccess() async throws { | ||
|
|
@@ -303,7 +319,7 @@ final class InAppPurchase2PluginTests: XCTestCase { | |
| XCTFail("Purchase should NOT fail. Failed with \(error)") | ||
| } | ||
| } | ||
| await fulfillment(of: [expectation], timeout: 5) | ||
| await fulfillment(of: [expectation], timeout: 10) | ||
| } | ||
|
|
||
| func testPurchaseWithAppAccountToken() async throws { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.