Skip to content

Conversation

noahsmartin
Copy link
Contributor

@noahsmartin noahsmartin commented Sep 24, 2025

Add a test to capture error in SwiftUI test app, reproduces the error fixed by #6264

#skip-changelog

Closes #6269


Note

Adds a UITest to assert capture(error:) returns a non-empty Sentry ID and updates the SwiftUI sample to surface that ID for testing.

  • UITests (Samples/iOS-SwiftUI/iOS-SwiftUI-UITests/LaunchUITests.swift):
    • Import Sentry.
    • Add testCaptureErrorReturnsValidId that taps "Capture Error", reads errorId, builds SentryId, and asserts it’s not empty.
  • SwiftUI app (Samples/iOS-SwiftUI/iOS-SwiftUI/ContentView.swift):
    • Add @State var errorId: SentryId? and display it with accessibilityIdentifier errorId.
    • Change captureErrorAction to a function that captures the error and stores the returned SentryId in state.

Written by Cursor Bugbot for commit be6cc0e. This will update automatically on new commits. Configure here.

Copy link

codecov bot commented Sep 24, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
55 1 54 1
View the top 3 failed test(s) by shortest run time
iOS_SwiftUI_UITests.LaunchUITests::testNoNewTransactionForSecondCallToBody
Stack Traces | 0s run time
.../iOS-SwiftUI/iOS-SwiftUI-UITests/LaunchUITests.swift:37 - Failed to tap "Form Screen" Button: Timed out while evaluating UI query.
iOS_Swift_UITests.LaunchUITests::testBreadcrumbData
Stack Traces | 0s run time
.../iOS-Swift/iOS-Swift-UITests/BaseUITest.swift:57 - Failed to get background assertion for target app with pid 8956: Timed out while acquiring background assertion.
iOS_Swift_UITests.LaunchUITests::testCaptureError
Stack Traces | 0s run time
.../iOS-Swift/iOS-Swift-UITests/BaseUITest.swift:57 - Failed to get background assertion for target app with pid 9395: Timed out while acquiring background assertion.
iOS_Swift_UITests.LaunchUITests::testCaptureException
Stack Traces | 0s run time
.../iOS-Swift/iOS-Swift-UITests/BaseUITest.swift:57 - Failed to get background assertion for target app with pid 9479: Timed out while acquiring background assertion.
iOS_Swift_UITests.LaunchUITests::testCheckSlowAndFrozenFrames
Stack Traces | 0s run time
.../iOS-Swift/iOS-Swift-UITests/BaseUITest.swift:57 - Failed to get background assertion for target app with pid 9574: Timed out while acquiring background assertion.

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

Thanks. It would be great to make the PR title a bit more specific and mention the related issues in the PR description please.

cursor[bot]

This comment was marked as outdated.

Copy link
Member

@philipphofmann philipphofmann left a comment

Choose a reason for hiding this comment

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

It would be great to make the PR title a bit more specific and mention the related issues in the PR description please.

Again LGTM with a nitpick

@noahsmartin noahsmartin changed the title test: Add SwiftUI test test: Add SwiftUI test to reproduce SwiftUI lifecycle only bugs Sep 29, 2025
@noahsmartin noahsmartin merged commit d48a247 into main Sep 29, 2025
137 of 143 checks passed
@noahsmartin noahsmartin deleted the addSwiftUITest branch September 29, 2025 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

test: Add SwiftUI test
2 participants