Skip to content

StoreKitConfigTestCase/BaseStoreKitIntegrationTests: also clear transactions after every test#2616

Merged
NachoSoto merged 1 commit into
mainfrom
remove-all-transactions-tear-down
Jun 12, 2023
Merged

StoreKitConfigTestCase/BaseStoreKitIntegrationTests: also clear transactions after every test#2616
NachoSoto merged 1 commit into
mainfrom
remove-all-transactions-tear-down

Conversation

@NachoSoto

Copy link
Copy Markdown
Contributor

Trying to work around FB11799675, this was suggested by @joshdholtz and it seems to be working really well. This now calls deleteAllTransactions and SKTestSession.clearTransactions after every test, not only before.

The problem is that clearTransactions only seems to delete stuff from SKTestSession.allTransactions, but not from StoreKit.Transaction.unfinished. Doing this at the end of every test seems to do a much better job at ensuring that each test invocation has no leftover transaction, hopefully leading to fewer flaky failures.

@NachoSoto NachoSoto added the test label Jun 9, 2023
@NachoSoto NachoSoto requested a review from a team June 9, 2023 20:50

@joshdholtz joshdholtz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 💪

@codecov

codecov Bot commented Jun 9, 2023

Copy link
Copy Markdown

Codecov Report

Merging #2616 (76d8c1a) into main (a566b29) will decrease coverage by 0.04%.
The diff coverage is n/a.

❗ Current head 76d8c1a differs from pull request most recent head 980abbc. Consider uploading reports for the commit 980abbc to get more accurate results

@@            Coverage Diff             @@
##             main    #2616      +/-   ##
==========================================
- Coverage   85.96%   85.93%   -0.04%     
==========================================
  Files         205      205              
  Lines       14422    14416       -6     
==========================================
- Hits        12398    12388      -10     
- Misses       2024     2028       +4     

see 3 files with indirect coverage changes

Base automatically changed from remove-all-transactions to main June 12, 2023 14:07
…ransactions after every test

Trying to work around `FB11799675`, this was suggested by @joshdholtz and it seems to be working really well.
This now calls `deleteAllTransactions` and `SKTestSession.clearTransactions` _after_ every test, not only before.

The problem is that `clearTransactions` only seems to delete stuff from `SKTestSession.allTransactions`, but not from `StoreKit.Transaction.unfinished`.
Doing this at the end of every test seems to do a much better job at ensuring that each test invocation has no leftover transaction, hopefully leading to fewer flaky failures.
@NachoSoto NachoSoto force-pushed the remove-all-transactions-tear-down branch from 76d8c1a to 980abbc Compare June 12, 2023 15:08
@NachoSoto NachoSoto merged commit 2a95520 into main Jun 12, 2023
@NachoSoto NachoSoto deleted the remove-all-transactions-tear-down branch June 12, 2023 15:52
NachoSoto added a commit that referenced this pull request Jun 12, 2023
This broke in #2616 because `SKTestSession` is `nil` when the tests are skipped.
NachoSoto added a commit that referenced this pull request Jun 13, 2023
This was referenced Jun 13, 2023
NachoSoto pushed a commit that referenced this pull request Jun 13, 2023
**This is an automatic release.**

### New Features
* New `DebugViewController`: UIKit counterpart for SwiftUI's
`debugRevenueCatOverlay` (#2631) via NachoSoto (@NachoSoto)
* Created `PaywallExtensions`: `StoreView` and `SubscriptionStoreView`
overloads for `Offering` (#2593) via NachoSoto (@NachoSoto)
* Introduced `debugRevenueCatOverlay()`: new SwiftUI debug overlay
(#2567) via NachoSoto (@NachoSoto)
### Bugfixes
* Removed `preventPurchasePopupCallFromTriggeringCacheRefresh`, update
caches on `willEnterForeground` (#2623) via NachoSoto (@NachoSoto)
* Fixed `Catalyst` build with `Xcode 15 beta 1` (#2586) via NachoSoto
(@NachoSoto)
### Dependency Updates
* Bump danger from 9.3.0 to 9.3.1 (#2592) via dependabot[bot]
(@dependabot[bot])
### Other Changes
* `StoreTransaction`: added new `Storefront` to API testers (#2634) via
NachoSoto (@NachoSoto)
* `DebugView`: added snapshot tests (#2630) via NachoSoto (@NachoSoto)
* `verifyNoUnfinishedTransactions`/`verifyUnfinishedTransaction`: added
missing `#file` parameter (#2625) via NachoSoto (@NachoSoto)
* `PostReceiptDataOperation`: clean up cache key (#2628) via NachoSoto
(@NachoSoto)
* `PurchasesOrchestrator`: also get `Storefront` from SK1 (#2629) via
NachoSoto (@NachoSoto)
* `CI`: disable iOS 17 for now (#2627) via NachoSoto (@NachoSoto)
* `Tests`: fixed crash on iOS 13 (#2624) via NachoSoto (@NachoSoto)
* `StoreTransaction`: read `Storefront` from `StoreKit.Transaction`
(#2611) via NachoSoto (@NachoSoto)
* `StoreKitConfigTestCase`/`BaseStoreKitIntegrationTests`: also clear
transactions after every test (#2616) via NachoSoto (@NachoSoto)
* `ErrorCode.networkError`: improved description (#2610) via NachoSoto
(@NachoSoto)
* `PurchaseTester`: make CI job always point to current version (#2622)
via NachoSoto (@NachoSoto)
* Improved `finishAllUnfinishedTransactions` (#2615) via NachoSoto
(@NachoSoto)
* `StoreKitConfigTestCase`: improved `waitForStoreKitTestIfNeeded`
(#2614) via NachoSoto (@NachoSoto)
* `StoreKitConfigTestCase`: set `continueAfterFailure` to `false`
(#2617) via NachoSoto (@NachoSoto)
* `PaywallExtensions`: fixed compilation (#2613) via NachoSoto
(@NachoSoto)
* `CI`: added `iOS 17` job (#2591) via NachoSoto (@NachoSoto)
* `Encodable.jsonEncodedData`: fixed tests on iOS 17 due to inconsistent
key ordering (#2607) via NachoSoto (@NachoSoto)
* `debugRevenueCatOverlay`: added ability to display new
`SubscriptionStoreView` (#2595) via NachoSoto (@NachoSoto)
* Refactor: extracted all log strings (#2600) via NachoSoto (@NachoSoto)
* Changed tests to work around `URL` decoding differences in `iOS 17`
(#2605) via NachoSoto (@NachoSoto)
* Removed unnecessary `Strings.trimmedOrError` (#2601) via NachoSoto
(@NachoSoto)
* Fixed test compilation with `Xcode 15` (#2602) via NachoSoto
(@NachoSoto)
* Tests: added `iOS 17` snapshots (#2603) via NachoSoto (@NachoSoto)
* `StoreProductDiscount`: added `description` (#2604) via NachoSoto
(@NachoSoto)
* `debugRevenueCatOverlay` improvements (#2594) via NachoSoto
(@NachoSoto)
* `Xcode 15`: fixed all documentation warnings (#2596) via NachoSoto
(@NachoSoto)
* `StoreKitObserverModeIntegrationTests`: fixed and disabled SK2
`testPurchaseInDevicePostsReceipt` (#2589) via NachoSoto (@NachoSoto)
* `StoreKit2TransactionListener`: added log when receiving
`Transactions.Updates` (#2588) via NachoSoto (@NachoSoto)
* `Dictionary.MergeStrategy`: simplify implementation (#2587) via
NachoSoto (@NachoSoto)
* `Configuration.Builder`: fixed doc reference (#2583) via NachoSoto
(@NachoSoto)
* `APITesters`: available since iOS 11 (#2581) via NachoSoto
(@NachoSoto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants