From 5ba3fb2321342164b45693b7cb15444b3af0c7b7 Mon Sep 17 00:00:00 2001 From: NachoSoto Date: Thu, 14 Sep 2023 17:08:21 -0700 Subject: [PATCH] `Integration Tests`: fixed more flaky failures (#3218) Same as #3167. These can fail when verifying that no transactions are finished because there might be leftover transactions before the test even begins. In order to ignore those, we clear `TestLogHandler` at the beginning. We don't do that for every test because in some test we want to look at what was logged during SDK initialization. --- .../OfflineStoreKitIntegrationTests.swift | 6 ++++++ Tests/TestPlans/CI-BackendIntegration.xctestplan | 1 + 2 files changed, 7 insertions(+) diff --git a/Tests/BackendIntegrationTests/OfflineStoreKitIntegrationTests.swift b/Tests/BackendIntegrationTests/OfflineStoreKitIntegrationTests.swift index 34851e0594..aa5c5998e7 100644 --- a/Tests/BackendIntegrationTests/OfflineStoreKitIntegrationTests.swift +++ b/Tests/BackendIntegrationTests/OfflineStoreKitIntegrationTests.swift @@ -105,6 +105,8 @@ class OfflineStoreKit1IntegrationTests: BaseOfflineStoreKitIntegrationTests { @available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) func testPurchaseWhileServerIsDownSucceedsButDoesNotFinishTransaction() async throws { + self.logger.clearMessages() + self.serverDown() try await self.purchaseMonthlyProduct() @@ -114,6 +116,8 @@ class OfflineStoreKit1IntegrationTests: BaseOfflineStoreKitIntegrationTests { @available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) func testPurchaseWhileServerIsDownPostsReceiptAfterServerComesBack() async throws { + self.logger.clearMessages() + // 1. Purchase while server is down self.serverDown() try await self.purchaseMonthlyProduct() @@ -292,6 +296,8 @@ class OfflineStoreKit1IntegrationTests: BaseOfflineStoreKitIntegrationTests { @available(iOS 15.0, tvOS 15.0, watchOS 8.0, macOS 12.0, *) func testPurchaseWhileServerIsDownPostsReceiptWhenForegroundingApp() async throws { + self.logger.clearMessages() + // 1. Purchase while server is down self.serverDown() try await self.purchaseMonthlyProduct() diff --git a/Tests/TestPlans/CI-BackendIntegration.xctestplan b/Tests/TestPlans/CI-BackendIntegration.xctestplan index 652b6e4f75..03f8595089 100644 --- a/Tests/TestPlans/CI-BackendIntegration.xctestplan +++ b/Tests/TestPlans/CI-BackendIntegration.xctestplan @@ -25,6 +25,7 @@ } ], "maximumTestExecutionTimeAllowance" : 180, + "maximumTestRepetitions" : 5, "repeatInNewRunnerProcess" : true, "targetForVariableExpansion" : { "containerPath" : "container:RevenueCat.xcodeproj",