Skip to content

Commit

Permalink
CI: enable iOS 17 tests (#2829)
Browse files Browse the repository at this point in the history
Filed `FB12653515` because `StoreKitUnitTests` hang when beginning:
> Runner never began executing tests after launching

This at least enables iOS 17 without StoreKit tests.
  • Loading branch information
NachoSoto authored Sep 14, 2023
1 parent 1f5a7f5 commit b55de6a
Show file tree
Hide file tree
Showing 8 changed files with 108 additions and 40 deletions.
19 changes: 10 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
orbs:
macos: circleci/macos@2.0.1
slack: circleci/slack@4.10.1
codecov: codecov/codecov@3.2.4
codecov: codecov/codecov@3.2.5

version: 2.1

Expand Down Expand Up @@ -326,13 +326,16 @@ jobs:

run-test-ios-17:
<<: *base-job
resource_class: macos.m1.medium.gen1
steps:
- checkout
- install-dependencies
- run:
name: Run tests
command: bundle exec fastlane test_ios
no_output_timeout: 5m
# StoreKit tests currently get stuck.
# See https://discuss.circleci.com/t/severe-performance-problems-with-xcode-15/49205/11?u=nachosoto
command: bundle exec fastlane test_ios skip_sk_tests:true
no_output_timeout: 15m
environment:
SCAN_DEVICE: iPhone 14 (17.0)
- compress_result_bundle:
Expand Down Expand Up @@ -864,9 +867,8 @@ workflows:
generate-snapshot:
when: << pipeline.parameters.generate_snapshots >>
jobs:
# Disabled until we drop support for iOS 11
# - run-test-ios-17:
# xcode_version: '15.0.0'
- run-test-ios-17:
xcode_version: '15.0.0'
- run-test-ios-16:
xcode_version: '14.3.0'
- run-test-ios-15:
Expand Down Expand Up @@ -896,9 +898,8 @@ workflows:
xcode_version: '14.3.0'
- spm-receipt-parser:
xcode_version: '14.3.0'
# Disabled until we drop support for iOS 11
# - run-test-ios-17:
# xcode_version: '15.0.0'
- run-test-ios-17:
xcode_version: '15.0.0'
- run-test-ios-16:
xcode_version: '14.3.0'
- run-test-ios-15:
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret",
"X-Nonce" : "MTIzNDU2Nzg5MGFi",
"X-Post-Params-Hash" : "app_user_id,new_app_user_id:sha256:6fa58b9e3bdb1ca187ac082d128c19f04da8711fe6b17873a48bc7ca37bbf95a"
},
"request" : {
"body" : {
"app_user_id" : "$RCAnonymousID:6b2787de2fb848a8b403a45f695ee74f",
"new_app_user_id" : "F72BF276-CD70-4C27-BCD2-FC1EFD988FA3"
},
"method" : "POST",
"url" : "https://api.revenuecat.com/v1/subscribers/identify"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret",
"X-Nonce" : "MTIzNDU2Nzg5MGFi",
"X-Post-Params-Hash" : "app_user_id,new_app_user_id:sha256:ce001f7b6730af645a00622c062081d2105742d40101bb415176b88a18cfee97"
},
"request" : {
"body" : {
"app_user_id" : "old id",
"new_app_user_id" : "new id"
},
"method" : "POST",
"url" : "https://api.revenuecat.com/v1/subscribers/identify"
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
"Authorization" : "Bearer asharedsecret",
"X-Nonce" : "MTIzNDU2Nzg5MGFi",
"X-Post-Params-Hash" : "app_user_id,fetch_token:sha256:be95d3a1d4c00357de2696c1a4546be1d0312dbee67feee8a971f01f8ac4b729"
},
"request" : {
"body" : {
Expand All @@ -11,7 +13,7 @@
"value" : "authorized"
}
},
"fetch_token" : "YW4gYXdlc29tZSByZWNlaXB0",
"fetch_token" : "YW4gYXdlc29tZWVyIHJlY2VpcHQ=",
"initiation_source" : "purchase",
"is_restore" : false,
"observer_mode" : false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
"Authorization" : "Bearer asharedsecret",
"X-Nonce" : "MTIzNDU2Nzg5MGFi",
"X-Post-Params-Hash" : "app_user_id,fetch_token:sha256:2cc3741ddb808ae6fd179f1398d9115b58772590765edf799ec778f929faa46d"
},
"request" : {
"body" : {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"headers" : {
"Authorization" : "Bearer asharedsecret"
},
"request" : {
"body" : {
"app_user_id" : "user",
"attributes" : {
"$attConsentStatus" : {
"updated_at_ms" : 1678307200000,
"value" : "authorized"
}
},
"currency" : "UYU",
"fetch_token" : "YW4gYXdlc29tZSByZWNlaXB0",
"initiation_source" : "purchase",
"is_restore" : false,
"observer_mode" : true,
"price" : "15.99",
"product_id" : "product_id",
"store_country" : "ESP",
"test_receipt_identifier" : "12345678-1234-1234-1234-C2C35AE34D09"
},
"method" : "POST",
"url" : "https://api.revenuecat.com/v1/receipts"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -193,25 +193,28 @@ class BackendSubscriberAttributesTests: TestCase {
subscriberAttribute2.key: subscriberAttribute2
]

let receivedCustomerInfo: Atomic<CustomerInfo?> = nil
backend.post(receiptData: self.receiptData,
productData: nil,
transactionData: .init(
appUserID: self.appUserID,
presentedOfferingID: nil,
unsyncedAttributes: subscriberAttributesByKey,
storefront: nil,
source: .init(isRestore: false, initiationSource: .queue)
),
observerMode: false) { result in
receivedCustomerInfo.value = result.value
let receivedCustomerInfo: CustomerInfo? = waitUntilValue { completion in
self.backend.post(
receiptData: self.receiptData,
productData: nil,
transactionData: .init(
appUserID: self.appUserID,
presentedOfferingID: nil,
unsyncedAttributes: subscriberAttributesByKey,
storefront: nil,
source: .init(isRestore: false, initiationSource: .queue)
),
observerMode: false
) { result in
completion(result.value)
}
}

expect(self.mockHTTPClient.calls).toEventually(haveCount(1))
expect(self.mockHTTPClient.calls).to(haveCount(1))

let loggedMessages = self.logger.messages.map(\.message)

expect(receivedCustomerInfo.value) == CustomerInfo(testData: self.validSubscriberResponse)
expect(receivedCustomerInfo) == CustomerInfo(testData: self.validSubscriberResponse)
expect(loggedMessages).to(
containElementSatisfying {
$0.localizedCaseInsensitiveContains(ErrorCode.invalidSubscriberAttributesError.description)
Expand Down Expand Up @@ -244,23 +247,26 @@ class BackendSubscriberAttributesTests: TestCase {
subscriberAttribute2.key: subscriberAttribute2
]

let receivedError: Atomic<BackendError?> = nil
backend.post(receiptData: self.receiptData,
productData: nil,
transactionData: .init(
appUserID: self.appUserID,
presentedOfferingID: nil,
unsyncedAttributes: subscriberAttributesByKey,
storefront: nil,
source: .init(isRestore: false, initiationSource: .restore)
),
observerMode: false) { result in
receivedError.value = result.error
let receivedError: BackendError? = waitUntilValue { completion in
self.backend.post(
receiptData: self.receiptData,
productData: nil,
transactionData: .init(
appUserID: self.appUserID,
presentedOfferingID: nil,
unsyncedAttributes: subscriberAttributesByKey,
storefront: nil,
source: .init(isRestore: false, initiationSource: .restore)
),
observerMode: false
) { result in
completion(result.error)
}
}

expect(self.mockHTTPClient.calls).toEventually(haveCount(1))
expect(self.mockHTTPClient.calls).to(haveCount(1))

expect(receivedError.value) == .networkError(networkError)
expect(receivedError) == .networkError(networkError)
}

// MARK: PostSubscriberAttributes
Expand Down

0 comments on commit b55de6a

Please sign in to comment.