Backend snapshot tests: separate snapshot for each major version#1504
Conversation
There was a problem hiding this comment.
This is the core of this PR. Thanks @taquitos for the idea.
taquitos
left a comment
There was a problem hiding this comment.
Awesome stuff, one possible change I see some files prefixed like iOSiOS15
|
Oops good catch! I forgot we have those separate tests as well. |
|
Combined |
There was a problem hiding this comment.
BackendPostReceiptDataTest -> BackendPostReceiptDataTests
taquitos
left a comment
There was a problem hiding this comment.
The smallest comment update, but then 🚢
|
I'll wait to merge this until somebody can generate the iOS 12 snapshots for me 🙏🏻 |
updating my Intel mac 🙃 |
Fixes [CF-547]. This also removes the duplicate `BackendPostRecepitDataTests` for each version, as only 1 is needed now. `assertSnapshot` encodes the version in the filename.
5fff36d to
8d8cec1
Compare
|
@NachoSoto this is ready when you are 😄 |
|
Awesome thanks! Just pushed the comment fix, I'll merge this and make sure they're passing in |
…utEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ```
…utEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ```
…utEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ```
…utEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ```
…utEscapingSlashes` if available (#1560) This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ```
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6737/workflows/b945f5f6-6f31-4716-b1ac-6e16e3848c7e/jobs/26321 For some reason, on iOS 12.x only, this: ```swift JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: ``` dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) ``` We don't rely on decoding fragments, so I just updated the test to check `.null` within a dictionary instead. `Snapshotting.formattedData`: use `JSONEncoder.OutputFormatting.withoutEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ``` Update CircleCI config to use pipeline parameters to set generate snapshots env Run all in one serially Split OS version into their own jobs Create PR from all os version jobs This is the one Added requestby user in body Fix for pr actually creating Reordered some things Remove tvos from generated jobs Raw output when generating snapshots Don't retry tests when generating snapshots Maybe this will make the PRs Maybe this This is it
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6737/workflows/b945f5f6-6f31-4716-b1ac-6e16e3848c7e/jobs/26321 For some reason, on iOS 12.x only, this: ```swift JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: ``` dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) ``` We don't rely on decoding fragments, so I just updated the test to check `.null` within a dictionary instead. `Snapshotting.formattedData`: use `JSONEncoder.OutputFormatting.withoutEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ``` Update CircleCI config to use pipeline parameters to set generate snapshots env Run all in one serially Split OS version into their own jobs Create PR from all os version jobs This is the one Added requestby user in body Fix for pr actually creating Reordered some things Remove tvos from generated jobs Raw output when generating snapshots Don't retry tests when generating snapshots Maybe this will make the PRs Maybe this This is it
Fixes https://app.circleci.com/pipelines/github/RevenueCat/purchases-ios/6737/workflows/b945f5f6-6f31-4716-b1ac-6e16e3848c7e/jobs/26321 For some reason, on iOS 12.x only, this: ```swift JSONDecoder.default.decode(jsonData: "null".data(using: .utf8)!) ``` Fails: ``` dataCorrupted(Swift.DecodingError.Context(codingPath: [], debugDescription: "The given data was not valid JSON.", underlyingError: Optional(Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option to allow fragments not set." UserInfo={NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}))) ``` We don't rely on decoding fragments, so I just updated the test to check `.null` within a dictionary instead. `Snapshotting.formattedData`: use `JSONEncoder.OutputFormatting.withoutEscapingSlashes` if available This was removed after a [PR review comment](#1366 (comment)) because it would have lead to different snapshots in iOS 12. However, since #1504 we have separate snapshots for each iOS version, so this cleans up the output when possible. ```diff - "url" : "https:\/\/api.revenuecat.com\/v1\/subscribers\/user\/alias" + "url" : "https://api.revenuecat.com/v1/subscribers/user/alias" ``` Update CircleCI config to use pipeline parameters to set generate snapshots env Run all in one serially Split OS version into their own jobs Create PR from all os version jobs This is the one Added requestby user in body Fix for pr actually creating Reordered some things Remove tvos from generated jobs Raw output when generating snapshots Don't retry tests when generating snapshots Maybe this will make the PRs Maybe this This is it
Fixes CF-547.
I recommend reviewing this ignoring JSON files:https://github.com/RevenueCat/purchases-ios/pull/1504/files?file-filters%5B%5D=.pbxproj&file-filters%5B%5D=.swift&show-deleted-files=true&show-viewed-files=true
This also combines the duplicate copies of some tests for each version, as only 1 is needed now.
assertSnapshotencodes the version in the filename.Combined:
BackendPostRecepitDataTestsBackendSubscriberAttributesTestsNo more unnecessary skipped tests.
Number of tests skipped | 112Number of tests skipped | 58Example:
Because iOS 12.x simulators currently crash on M1 Macs, I haven't generated those snapshots yet.