Skip to content

Commit 04c946c

Browse files
authored
[in_app_purchase_storekit] Disable flaky tests blocking latest flutter -> packages roll (#13048)
Work towards flutter/flutter#193451 Disables the `in_app_purchase_storekit` flakes that manifested on the most recent flutter -> packages autoroll (see details at flutter/flutter#193451) ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 8afa65e commit 04c946c

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

‎packages/in_app_purchase/in_app_purchase_storekit/example/shared/RunnerTests/InAppPurchaseStoreKit2PluginTests.swift‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,15 @@ final class InAppPurchase2PluginTests: XCTestCase {
4747
session.disableDialogs = false
4848
}
4949

50+
/// Skips tests that make purchases through `SKTestSession`, because these
51+
/// purchases sometimes never complete on CI.
52+
///
53+
/// These should be re-enabled once https://github.com/flutter/flutter/issues/193451
54+
/// is fixed.
55+
private func skipFlakyPurchaseTest() throws {
56+
throw XCTSkip("Test is flaky. See https://github.com/flutter/flutter/issues/193451")
57+
}
58+
5059
func testCanMakePayments() throws {
5160
let result = try plugin.canMakePayments()
5261
XCTAssertTrue(result)
@@ -76,6 +85,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
7685
}
7786

7887
func testGetTransactions() async throws {
88+
try skipFlakyPurchaseTest()
7989
let purchaseExpectation = self.expectation(description: "Purchase should succeed")
8090
let transactionExpectation = self.expectation(
8191
description: "Getting transactions should succeed")
@@ -151,6 +161,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
151161
}
152162

153163
func testGetTransactionJsonRepresentation() async throws {
164+
try skipFlakyPurchaseTest()
154165
let expectation = self.expectation(description: "Purchase request should succeed")
155166

156167
plugin.purchase(id: "consumable", options: nil) { result in
@@ -209,6 +220,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
209220
}
210221

211222
func testSuccessfulPurchase() async throws {
223+
try skipFlakyPurchaseTest()
212224
let expectation = self.expectation(description: "Purchase request should succeed")
213225
plugin.purchase(id: "consumable", options: nil) { result in
214226
switch result {
@@ -252,6 +264,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
252264

253265
@available(iOS 17.0, macOS 14.0, *)
254266
func testFailedProductUnavilablePurchase() async throws {
267+
try skipFlakyPurchaseTest()
255268
try await session.setSimulatedError(
256269
.purchase(.productUnavailable), forAPI: .purchase)
257270
let expectation = self.expectation(description: "Purchase request should succeed")
@@ -284,6 +297,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
284297
}
285298

286299
func testPurchaseUpgradeConsumableSuccess() async throws {
300+
try skipFlakyPurchaseTest()
287301
let expectation = self.expectation(description: "Purchase request should succeed")
288302
plugin.purchase(id: "subscription_discounted", options: nil) { result in
289303
switch result {
@@ -297,6 +311,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
297311
}
298312

299313
func testDiscountedSubscriptionSuccess() async throws {
314+
try skipFlakyPurchaseTest()
300315
let expectation = self.expectation(description: "Purchase request should succeed")
301316
plugin.purchase(id: "subscription_discounted", options: nil) { result in
302317
switch result {
@@ -310,6 +325,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
310325
}
311326

312327
func testDiscountedProductSuccess() async throws {
328+
try skipFlakyPurchaseTest()
313329
let expectation = self.expectation(description: "Purchase request should succeed")
314330
plugin.purchase(id: "consumable_discounted", options: nil) { result in
315331
switch result {
@@ -323,6 +339,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
323339
}
324340

325341
func testPurchaseWithAppAccountToken() async throws {
342+
try skipFlakyPurchaseTest()
326343
let expectation = self.expectation(description: "Purchase with appAccountToken should succeed")
327344

328345
let appAccountToken = UUID().uuidString
@@ -343,6 +360,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
343360

344361
@available(iOS 17.4, macOS 14.4, *)
345362
func testPurchaseWithPromotionalOffer() async throws {
363+
try skipFlakyPurchaseTest()
346364
let expectation = self.expectation(description: "Purchase with promotionalOffer should succeed")
347365

348366
let promotionalOffer = SK2SubscriptionOfferPurchaseMessage(
@@ -371,6 +389,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
371389

372390
@available(iOS 18.0, macOS 15.0, *)
373391
func testPurchaseWithWinBackOffer() async throws {
392+
try skipFlakyPurchaseTest()
374393
let expectation = self.expectation(description: "Purchase with winBackOffer should succeed")
375394

376395
let options = SK2ProductPurchaseOptionsMessage(
@@ -390,6 +409,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
390409
}
391410

392411
func testPurchaseWithIntroductoryOfferEligibilityJWS() async throws {
412+
try skipFlakyPurchaseTest()
393413
let expectation = self.expectation(
394414
description: "Purchase with an introductory offer eligibility JWS should complete")
395415

@@ -410,6 +430,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
410430
}
411431

412432
func testRestoreProductSuccess() async throws {
433+
try skipFlakyPurchaseTest()
413434
let purchaseExpectation = self.expectation(description: "Purchase request should succeed")
414435
let restoreExpectation = self.expectation(description: "Restore request should succeed")
415436

@@ -441,6 +462,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
441462
}
442463

443464
func testRestoreMultipleProductsEmitsSingleBatchedUpdate() async throws {
465+
try skipFlakyPurchaseTest()
444466
// Purchase two subscriptions from different subscription groups so that
445467
// both persist in `currentEntitlements` and restoring returns two
446468
// transactions.
@@ -487,6 +509,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
487509
}
488510

489511
func testFinishTransaction() async throws {
512+
try skipFlakyPurchaseTest()
490513
let purchaseExpectation = self.expectation(description: "Purchase should succeed")
491514
let finishExpectation = self.expectation(description: "Finishing purchase should succeed")
492515

@@ -516,6 +539,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
516539

517540
@available(iOS 18.0, macOS 15.0, *)
518541
func testIsWinBackOfferEligibleEligible() async throws {
542+
try skipFlakyPurchaseTest()
519543
let purchaseExpectation = self.expectation(description: "Purchase should succeed")
520544

521545
plugin.purchase(id: "subscription_silver", options: nil) { result in
@@ -614,6 +638,7 @@ final class InAppPurchase2PluginTests: XCTestCase {
614638
}
615639

616640
func testDuplicatePurchaseFails() async throws {
641+
try skipFlakyPurchaseTest()
617642
let firstPurchaseExpectation = self.expectation(description: "First purchase should succeed")
618643
let secondPurchaseExpectation = self.expectation(description: "Second purchase should fail")
619644

0 commit comments

Comments
 (0)