feat: add currentDisplayId setting for screenshots - #1267
jsteinberg7 wants to merge 2 commits into
Conversation
|
|
|
Please split changes into multiple PRs - screenshots and actions |
|
Not sure how feasible this is, but I would instead suggest to follow a similar approach to UiAutomator2 driver - add a setting named Check the UiAutomator2 docs for more details: https://github.com/appium/appium-uiautomator2-driver/blob/master/docs/android-multiwindow.md |
|
|
||
| Have fun! | ||
|
|
||
| ## Selecting a display |
There was a problem hiding this comment.
Considering the README doesn't list implementation details, I would discourage doing so here. Generally, feature documentation goes in the XCUITest driver's docs.
b5a897f to
ce34bf2
Compare
| return nil; | ||
| } | ||
| if (![value isKindOfClass:NSNumber.class] | ||
| || CFGetTypeID((__bridge CFTypeRef)value) == CFBooleanGetTypeID() |
| FBConfiguration.sharedInstance.currentDisplayId = nil; | ||
| return nil; | ||
| } | ||
| if (![value isKindOfClass:NSNumber.class] |
There was a problem hiding this comment.
JSON booleans deserialize as NSNumber, so true and false pass this check as 1 and 0. If that display exists, the request changes the selected display instead of returning invalid argument. Restore the boolean guard removed in the latest commit and retain boolean rejection tests.
On multi-display devices like iPhone Duo, the app can move to a secondary display while
/screenshotkeeps capturing the main one. Following the UiAutomator2 approach, this adds acurrentDisplayIdsetting that selects the display screenshots capture.currentDisplayIdtakes an integerdisplayIdfrom/wda/screens. Unknown IDs and non-integer values returninvalid argument.nullgoes back to the main display. It's also reset for each new session. Reading it returns the display currently in use./screenshotcaptures the selected display and respectsscreenshotQuality. If that display goes away (for example when the device is folded), the request fails instead of quietly capturing the main display.Nothing changes unless the setting is used. The MJPEG stream and screen recording still capture the main display. I can follow up on those separately if that's useful.
W3C actions support is in #1269, which builds on this one. Driver docs and
mobile: getScreensare in appium/appium-xcuitest-driver#2988.Tested with Xcode 27.1 beta:
FBScreenTests(including the new cases) on iPhone Duo / iOS 27.1 and iPhone 16 Pro / iOS 18.2