Skip to content
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

Integration Tests: begin tests with UIApplication.willEnterForegroundNotification to simulate a real app #3015

Merged
merged 2 commits into from
Aug 15, 2023

Conversation

NachoSoto
Copy link
Contributor

#2983 was an attempt to work around this. Instead, this PR adds integration tests to cover this behavior and ensure that we don't make duplicate requests.

@NachoSoto NachoSoto added the test Adding missing tests or correcting existing tests label Aug 14, 2023
@NachoSoto NachoSoto requested a review from a team August 14, 2023 20:50
@@ -128,7 +128,7 @@ extension NetworkStrings: LogMessage {
private extension HTTPRequest {

var description: String {
return "\(self.method.httpMethod) \(self.path.relativePath)"
return "\(self.method.httpMethod) '\(self.path.relativePath)'"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was necessary to prevent conflicts when checking customer info and offerings, since they both share the same prefix.

Like @aboedo pointed out in #3013 we should test this using a proper HTTPClient spy, but this is a simple fix for now.

@NachoSoto NachoSoto force-pushed the integration-tests-dedupping-notification branch from 41fc75a to b54ad71 Compare August 14, 2023 22:36
Base automatically changed from integration-tests-dedupping to main August 14, 2023 23:35
…undNotification` to simulate a real app

#2983 was an attempt to work around this. Instead, this PR adds integration tests to cover this behavior and ensure that we don't make duplicate requests.
@NachoSoto NachoSoto force-pushed the integration-tests-dedupping-notification branch from b54ad71 to 0001cfb Compare August 14, 2023 23:49
@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Merging #3015 (0001cfb) into main (8f2c742) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #3015      +/-   ##
==========================================
+ Coverage   86.71%   86.75%   +0.03%     
==========================================
  Files         219      219              
  Lines       15650    15650              
==========================================
+ Hits        13571    13577       +6     
+ Misses       2079     2073       -6     
Files Changed Coverage Δ
Sources/Logging/Strings/NetworkStrings.swift 100.00% <100.00%> (ø)

... and 4 files with indirect coverage changes

@NachoSoto NachoSoto merged commit 8dadd76 into main Aug 15, 2023
16 checks passed
@NachoSoto NachoSoto deleted the integration-tests-dedupping-notification branch August 15, 2023 00:36
This was referenced Aug 16, 2023
NachoSoto pushed a commit that referenced this pull request Aug 17, 2023
**This is an automatic release.**

### Bugfixes
* `PurchasesOrchestrator`: fixed callback not invoked regression during
downgrades (#3028) via NachoSoto (@NachoSoto)
* `TransactionPoster`: don't finish transactions for non-subscriptions
if they're not processed (#2841) via NachoSoto (@NachoSoto)
### Performance Improvements
* `StoreKit 2`: only listen to `StoreKit.Transaction.updates` when SK2
is enabled (#3032) via NachoSoto (@NachoSoto)
* `CustomerInfoManager`: post transactions in parallel to POST receipts
only once (#2954) via NachoSoto (@NachoSoto)
### Other Changes
* `PostedTransactionCache`: remove implementation (#3030) via NachoSoto
(@NachoSoto)
* `Integration Tests`: improved `testCanPurchaseMultipleSubscriptions`
(#3025) via NachoSoto (@NachoSoto)
* `GitHub`: improved `ISSUE_TEMPLATE` (#3022) via NachoSoto (@NachoSoto)
* `TransactionPoster`: added transaction ID and Date to log (#3026) via
NachoSoto (@NachoSoto)
* `TransactionPoster`: fix iOS 12 test (#3018) via NachoSoto
(@NachoSoto)
* `SystemInfo`: added `ClockType` (#3014) via NachoSoto (@NachoSoto)
* `Integration Tests`: begin tests with
`UIApplication.willEnterForegroundNotification` to simulate a real app
(#3015) via NachoSoto (@NachoSoto)
* `Integration Tests`: add tests to verify `CustomerInfo`+`Offerings`
request de-dupping (#3013) via NachoSoto (@NachoSoto)
* `SwiftLint`: disable `unneeded_synthesized_initializer` (#3010) via
NachoSoto (@NachoSoto)
* Added `internal`
`NonSubscriptionTransaction.storeTransactionIdentifier` (#3009) via
NachoSoto (@NachoSoto)
* `Integration Tests`: added tests for non-renewing and non-consumable
packages (#3008) via NachoSoto (@NachoSoto)
* Expanded `EnsureNonEmptyArrayDecodable` to
`EnsureNonEmptyCollectionDecodable` (#3002) via NachoSoto (@NachoSoto)
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
MarkVillacampa pushed a commit that referenced this pull request Sep 6, 2023
**This is an automatic release.**

### Bugfixes
* `PurchasesOrchestrator`: fixed callback not invoked regression during
downgrades (#3028) via NachoSoto (@NachoSoto)
* `TransactionPoster`: don't finish transactions for non-subscriptions
if they're not processed (#2841) via NachoSoto (@NachoSoto)
### Performance Improvements
* `StoreKit 2`: only listen to `StoreKit.Transaction.updates` when SK2
is enabled (#3032) via NachoSoto (@NachoSoto)
* `CustomerInfoManager`: post transactions in parallel to POST receipts
only once (#2954) via NachoSoto (@NachoSoto)
### Other Changes
* `PostedTransactionCache`: remove implementation (#3030) via NachoSoto
(@NachoSoto)
* `Integration Tests`: improved `testCanPurchaseMultipleSubscriptions`
(#3025) via NachoSoto (@NachoSoto)
* `GitHub`: improved `ISSUE_TEMPLATE` (#3022) via NachoSoto (@NachoSoto)
* `TransactionPoster`: added transaction ID and Date to log (#3026) via
NachoSoto (@NachoSoto)
* `TransactionPoster`: fix iOS 12 test (#3018) via NachoSoto
(@NachoSoto)
* `SystemInfo`: added `ClockType` (#3014) via NachoSoto (@NachoSoto)
* `Integration Tests`: begin tests with
`UIApplication.willEnterForegroundNotification` to simulate a real app
(#3015) via NachoSoto (@NachoSoto)
* `Integration Tests`: add tests to verify `CustomerInfo`+`Offerings`
request de-dupping (#3013) via NachoSoto (@NachoSoto)
* `SwiftLint`: disable `unneeded_synthesized_initializer` (#3010) via
NachoSoto (@NachoSoto)
* Added `internal`
`NonSubscriptionTransaction.storeTransactionIdentifier` (#3009) via
NachoSoto (@NachoSoto)
* `Integration Tests`: added tests for non-renewing and non-consumable
packages (#3008) via NachoSoto (@NachoSoto)
* Expanded `EnsureNonEmptyArrayDecodable` to
`EnsureNonEmptyCollectionDecodable` (#3002) via NachoSoto (@NachoSoto)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PostReceipt optimizations test Adding missing tests or correcting existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants