Add real-touch UI tests for the SwiftUI example - #43
Merged
Conversation
Unit tests reproduce taps with sendActions and one-shot hitTest, which can diverge from the real touch pipeline: the launcher toggle teardown and the shield hit-test bugs both shipped past the unit suite and were only caught by hand on device. Add an XCUITest bundle to the SwiftUI example (generated by generate_project.rb like the rest of the project) covering the flows those bugs broke: - toggle ON, tap a UIKit nav label, measurement appears in the InfoView - tap a SwiftUI Text, measurement (class/text) appears - List rows get monitor buttons after navigating and toggling ON - the shield keeps taps from reaching the app: a covered NavigationLink selects for measurement instead of navigating, empty-area taps are absorbed, and the toggle stays ON XCUITest attaches as an accessibility client, so SwiftUI element detection is active during the tests without the debug-only enabler. Reintroducing the old inside-the-target button placement makes the nav label test fail, confirming the harness catches that class of bug on the simulator's real-touch path. ViewMonitor's launcher, monitor buttons, and InfoView now expose accessibility identifiers (ViewMonitor.launcher / .monitorButton / .infoView) so tests can address them; covered by unit tests. CI runs the bundle in the example job via xcodebuild test. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Aug 9, 2026
Merged
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.
Summary
ViewMonitorSwiftUIExampleUITests) to the SwiftUI example, generated bygenerate_project.rblike the rest of the project, and run it on CI in the example jobViewMonitor.launcher/ViewMonitor.monitorButton/ViewMonitor.infoView) so tests can address it; covered by unit testsWhy
Unit tests reproduce taps with
sendActionsand one-shothitTest, which can diverge from the real touch pipeline. The launcher-toggle teardown bug and the shield hit-test bug (2.3.0) both shipped past the unit suite and were only caught manually on device. XCUITest drives the app through the system's real touch delivery and attaches as an accessibility client, so SwiftUI element detection is active during tests without the debug-only enabler.Coverage
Text→class: Textandtext:rows appearNavigationLinkselects it for measurement instead of navigating, empty-area taps are absorbed, and the toggle stays ONVerification
swiftlint --strict0 violations (UI test sources added to lint scope)🤖 Generated with Claude Code