Repository navigation
test(e2e): Fix flaky sample app E2E tests - #7097
Merged
Merged
Conversation
Stop the sample app before each test file starts its mocked Sentry server. The app launched by the previous test file kept running until the next Maestro flow relaunched it, so transactions it finished in the meantime were delivered to the next test's server and mixed into its envelopes. Make device.connection_type optional on the iOS message event. sentry-cocoa only knows it after its reachability monitor reported the first network path, which can be after a message captured right after launch. Assert it on the ErrorsScreen transaction instead, which is sent seconds later. Print the received transactions when the ErrorsScreen app start transaction is missing, to diagnose the remaining Android failure. Refs #7093 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
📲 Install BuildsAndroid
|
3 of 11 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📢 Type of change
📜 Description
Fixes two causes of flaky sample app E2E tests in
sample-application.ymland adds a diagnostic for a third.Leaked envelopes between test files (Android and iOS). Each test file starts its own mocked Sentry server, but the app launched by the previous test file keeps running until the next Maestro flow relaunches it. Maestro's startup takes about 10 s, and transactions the old app finishes in that window (idle navigation spans end 5 s after the last activity) are delivered to the new test's server.
createSentryServer().start()now stops the app first (adb shell am force-stopon Android,xcrun simctl terminate bootedon iOS). The platform comes from a newE2E_PLATFORMJest global in the four platform configs.device.connection_typeon the iOS message event. sentry-cocoa only sets it afterSentryReachabilityreported the first network path, which happens asynchronously after start. The iOS auto flow captures the message right after launch, so it can be sent without the field. The message test now only checks the type when the field is present. A newcontains device connection typetest asserts it on the ErrorsScreen transaction, which is sent about 5 s after launch, on both platforms.Diagnostic for the Android ErrorsScreen app start failure. When no ErrorsScreen transaction with origin
auto.app.startarrived, the test now prints every received transaction (name, op, origin, timestamps, measurement keys, span ops) before failing. The root cause of this failure is not found yet: it did not reproduce locally.💡 Motivation and Context
Refs #7093. 21 of 38
mainruns had a first-attempt failure in the sample E2E jobs.captureMessage"contains device context" failures I checked all lacked onlyconnection_type. The assertion was added in feat(core): Report cellular network technology #6827.Webviewtransaction from the previous test's app reached the Spaceflight test's server about 8 s after it started, and failed "all navigation transaction envelopes have time to display measurements". This matches one iOS CI failure. It is also a candidate for the Android ErrorsScreen failure, which always runs right after the Spaceflight test.Not addressed here:
No visible element found,Load More Articles).TAR_BAD_ARCHIVEdependency install failure.💚 How did you test it?
Locally, with the
sample-rn-new-production-androidAPK from a recentmainrun, on an emulator matching CI (API 30aosp_atd,-gpu swiftshader_indirect, 2 cores, arm64 instead of CI's x86_64):Webviewtransaction above, plus a TurboModule UI timeout).connection_typetest. The logcat shows the force-stop before each test file.The iOS changes were not run locally; CI ran them.
CI on this PR: every completed sample E2E job passed, with no failed tests:
2853575)main)contains device connection typetest on both platforms. Onmain, Android failed on the first attempt in 15 of 38 runs and iOS in 6 of 38.concurrencygroup cancelled each in favour of the other. The reruns above ran one at a time.📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
main.🤖 Generated with Claude Code