Skip to content

Comments

Disable record on regular snapshot tests to prevent from passing after retry#6303

Open
vegaro wants to merge 4 commits intomainfrom
cesar/remove-rcui-snapshot-retries
Open

Disable record on regular snapshot tests to prevent from passing after retry#6303
vegaro wants to merge 4 commits intomainfrom
cesar/remove-rcui-snapshot-retries

Conversation

@vegaro
Copy link
Member

@vegaro vegaro commented Feb 19, 2026

Summary

Fixes RCUI snapshot recording mode so normal CI runs do not auto-record missing JSON snapshots.

SnapshotTesting README documents automatic recording when reference is missing. See the section that says first run auto-records snapshots and also “More hands-off”.

"More hands-off. New snapshots are recorded whether isRecording mode is true or not."

In the source code https://github.com/pointfreeco/swift-snapshot-testing/blob/main/Sources/SnapshotTesting/AssertSnapshot.swift

  • __record defaults to .missing (unless SNAPSHOT_TESTING_RECORD is set)
  • isRecording is deprecated and maps to .all/.missing. This is what we were doing, so it was always recording
  • record == .never is what we want

Updates

Snapshot mode now uses CIRCLECI_TESTS_GENERATE_REVENUECAT_UI_SNAPSHOTS and CIRCLECI_TESTS_GENERATE_SNAPSHOTS like this:

  • true/1 => record mode all
  • otherwise => record mode never

This keeps retries from masking snapshot failures by writing new baselines during regular test runs. Tests were succeeding even if snapshots didn't match because first run would record, second run would succeed.

I needed to update our snapshot testing to fix this.

@vegaro vegaro requested a review from a team as a code owner February 19, 2026 17:17
@vegaro vegaro marked this pull request as draft February 19, 2026 17:17
@vegaro vegaro changed the title Remove RevenueCatUI test retries in CI test plan [TESTING] Remove RevenueCatUI test retries in CI test plan Feb 19, 2026
@vegaro vegaro changed the title [TESTING] Remove RevenueCatUI test retries in CI test plan Fail snapshot validation tests fast while keeping RevenueCatUI retries Feb 19, 2026
@vegaro
Copy link
Member Author

vegaro commented Feb 19, 2026

@RCGitBot please test

1 similar comment
@vegaro
Copy link
Member Author

vegaro commented Feb 19, 2026

@RCGitBot please test

**xcodebuild_arguments,
result_bundle_path: 'fastlane/test_output/revenuecatui-paywall-validation.xcresult',
report_path: 'fastlane/test_output/revenuecatui/paywall_validation_tests.xml',
xcargs: "-testPlan CI-RevenueCatUI-NoRetries -only-testing:RevenueCatUITests/PaywallDataValidationTests"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need to specify -only-testing:RevenueCatUITests/PaywallDataValidationTests? I mean, couldn't we achieve this by having PaywallDataValidationTests be the only tests in the CI-RevenueCatUI-NoRetries test plan?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, that way we can add more tests there easily

Copy link
Contributor

Choose a reason for hiding this comment

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

Ohh right right. I see what you mean. Makes total sense 👌

@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

@RCGitBot please test

2 similar comments
@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

@RCGitBot please test

@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

@RCGitBot please test

@vegaro vegaro force-pushed the cesar/remove-rcui-snapshot-retries branch from 8588f44 to fd3e371 Compare February 20, 2026 10:00
@vegaro vegaro force-pushed the cesar/remove-rcui-snapshot-retries branch from fd3e371 to b5f06ae Compare February 20, 2026 10:09
@vegaro vegaro changed the title Fail snapshot validation tests fast while keeping RevenueCatUI retries Disable record on regular snapshot tests to prevent from passing after retry Feb 20, 2026
@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

@RCGitBot please test

@vegaro vegaro marked this pull request as ready for review February 20, 2026 11:05
@vegaro vegaro requested a review from a team as a code owner February 20, 2026 11:05
@vegaro vegaro requested a review from ajpallares February 20, 2026 11:54
Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

I believe this makes sense!

if ProcessInfo.processInfo.environment["CIRCLECI_TESTS_GENERATE_REVENUECAT_UI_SNAPSHOTS"] == "1" {
isRecording = true
}
return value == "1" || value == "true"
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need both? Not sure what value it's actually passed I guess 😅

Copy link
Member Author

Choose a reason for hiding this comment

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

we are setting to 1 I believe as seen in the previous code, but let me double check

Copy link
Contributor

@ajpallares ajpallares left a comment

Choose a reason for hiding this comment

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

Great improvement! 🤩

Package.swift Outdated
@@ -50,7 +50,7 @@ var dependencies: [Package.Dependency] = [
// SST requires iOS 13 starting from version 1.13.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we can remove this comment?

.package(
url: "https://github.com/pointfreeco/swift-snapshot-testing",
revision: "26ed3a2b4a2df47917ca9b790a57f91285b923fb"
exact: "1.18.9"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice 🤩

Copy link
Contributor

@ajpallares ajpallares left a comment

Choose a reason for hiding this comment

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

I wonder if it would be possible to use v1.17.7 of the SnapshotTesting package only for Package@swift-5.8.swift, which also supports Swift 5.7 (so it would work with Xcode 15) and also contains the withSnapshotTesting APIs (introduced in v1.17.0)

@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

good catch @ajpallares , will try

@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

@RCGitBot please test

@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

@RCGitBot please test

@emerge-tools
Copy link

emerge-tools bot commented Feb 20, 2026

📸 Snapshot Test

242 unchanged

Name Added Removed Modified Renamed Unchanged Errored Approval
RevenueCat
com.revenuecat.PaywallsTester
0 0 0 0 242 0 N/A

🛸 Powered by Emerge Tools

@vegaro
Copy link
Member Author

vegaro commented Feb 20, 2026

@RCGitBot please test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants