Skip to content

feat: target the currentDisplayId display with W3C actions - #1269

Open
jsteinberg7 wants to merge 3 commits into
appium:masterfrom
jsteinberg7:feat/current-display-id-actions
Open

jsteinberg7 wants to merge 3 commits into
appium:masterfrom
jsteinberg7:feat/current-display-id-actions

Conversation

@jsteinberg7

Copy link
Copy Markdown

Builds on #1267, so the first commit here is that PR.

W3C actions now go to the display selected by the currentDisplayId setting. When a non-main display is selected, WDA builds the event record with XCTest's display-aware initializer.

XCTest rotates screenPoint coordinates 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:

  • FBW3CTouchActionsIntegrationTestsPart1 on 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.
  • 162 native unit tests
  • Live corner taps through the driver on Duo in the closed, open, book and closed poses, all landing on the selected display. The same taps pass on iPhone 16 Pro with the setting unset and set to the main display.

@jsteinberg7
jsteinberg7 force-pushed the feat/current-display-id-actions branch from 92ebf7f to 35d9e85 Compare September 25, 2026 22:52
return screen;
}
}
[[FBErrorBuilder.builder withDescriptionFormat:@"No display with id %lld is available. Call /wda/screens to list the available displays", displayID]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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(

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why this correction is needed? shouldn't xctest automatically adjust coordinates?

return nil;
}
XCSynthesizedEventRecord *eventRecord;
CGPoint displayCorrection = CGPointZero;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

cgpoint or cgsize?

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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this is something that needs to be tested carefully for different screen orientations and differeent device types

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.

2 participants