feat: target the currentDisplayId display with W3C actions - #1269
Open
jsteinberg7 wants to merge 3 commits into
Open
jsteinberg7 wants to merge 3 commits into
jsteinberg7 wants to merge 3 commits into
Conversation
This was referenced Sep 25, 2026
jsteinberg7
force-pushed
the
feat/current-display-id-actions
branch
from
September 25, 2026 22:52
92ebf7f to
35d9e85
Compare
| return screen; | ||
| } | ||
| } | ||
| [[FBErrorBuilder.builder withDescriptionFormat:@"No display with id %lld is available. Call /wda/screens to list the available displays", displayID] |
There was a problem hiding this comment.
I think such error message would be useless for external clients since they cannot call API endpoints directly anyway. List available ids instead
| displayID:(unsigned long long)screen.displayID | ||
| interfaceOrientation:self.application.interfaceOrientation]; | ||
| XCUIScreen *mainScreen = XCUIScreen.mainScreen; | ||
| displayCorrection = FBDisplayCoordinateOffset( |
There was a problem hiding this comment.
why this correction is needed? shouldn't xctest automatically adjust coordinates?
| return nil; | ||
| } | ||
| XCSynthesizedEventRecord *eventRecord; | ||
| CGPoint displayCorrection = CGPointZero; |
| if (!CGPointEqualToPoint(displayCorrection, CGPointZero)) { | ||
| for (XCPointerEvent *pointerEvent in eventPath.pointerEvents) { | ||
| CGPoint point = pointerEvent.coordinate; | ||
| pointerEvent.coordinate = CGPointMake(point.x + displayCorrection.x, point.y + displayCorrection.y); |
There was a problem hiding this comment.
this is something that needs to be tested carefully for different screen orientations and differeent device types
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.
Builds on #1267, so the first commit here is that PR.
W3C actions now go to the display selected by the
currentDisplayIdsetting. When a non-main display is selected, WDA builds the event record with XCTest's display-aware initializer.XCTest rotates
screenPointcoordinates using the main display's size even when the event targets another display, so taps land in the wrong place in rotated orientations. WDA now corrects for that offset (FBDisplayCoordinateOffset, with unit tests for all four orientations).If the setting is unset or points at the main display, actions use exactly the same path as before. If the selected display is no longer available, the action fails with an error.
Tested with Xcode 27.1 beta:
FBW3CTouchActionsIntegrationTestsPart1on iPhone Duo / iOS 27.1 and iPhone 16 Pro / iOS 18.2. The new secondary display test runs against the Duo's inner display and is skipped on single-display devices.