Skip to content

feat: Expose device orientation via /wda/deviceOrientation#1162

Merged
mykola-mokhnach merged 4 commits into
appium:masterfrom
anton-yereshchenko:features/add_deviceOrientation_endpoint
Jun 26, 2026
Merged

feat: Expose device orientation via /wda/deviceOrientation#1162
mykola-mokhnach merged 4 commits into
appium:masterfrom
anton-yereshchenko:features/add_deviceOrientation_endpoint

Conversation

@anton-yereshchenko

@anton-yereshchenko anton-yereshchenko commented Jun 25, 2026

Copy link
Copy Markdown

Summary

Adds a new GET /wda/deviceOrientation endpoint that returns the current physical device orientation.

Motivation

The existing GET /orientation reports the app's interface orientation (application.interfaceOrientation) and collapses everything to PORTRAIT/LANDSCAPE. This new endpoint exposes the raw physical UIDeviceOrientation (XCUIDevice.orientation), which is useful when an app locks its UI but the device is physically rotated. It also covers orientations that have no interface equivalent: FaceUp, FaceDown, and Unknown.

Changes

  • Add GET /wda/deviceOrientation route (with and without session) in FBOrientationCommands
  • Add fb_deviceOrientation property to the XCUIDevice (FBRotation) category, returning the raw UIDeviceOrientation name string (same switch style as the existing FBInterfaceOrientationFromDeviceOrientation)
  • handleGetDeviceOrientation: delegates to XCUIDevice.sharedDevice.fb_deviceOrientation
  • Add integration tests for portrait / landscape-left / landscape-right in XCUIDeviceRotationTests

Possible return values

UIDeviceOrientationPortrait, UIDeviceOrientationPortraitUpsideDown, UIDeviceOrientationLandscapeLeft, UIDeviceOrientationLandscapeRight, UIDeviceOrientationFaceUp, UIDeviceOrientationFaceDown, UIDeviceOrientationUnknown

How to test

GET /wda/deviceOrientation → returns the current physical device orientation as a raw UIDeviceOrientation name string.

Comment thread WebDriverAgentLib/Commands/FBOrientationCommands.m Outdated
Comment thread WebDriverAgentLib/Categories/XCUIDevice+FBRotation.h Outdated
Comment thread WebDriverAgentLib/Categories/XCUIDevice+FBRotation.m Outdated
@anton-yereshchenko

Copy link
Copy Markdown
Author

Hi @KazuCocoa @mykola-mokhnach - could you please re-run the failed iPhone Unit Test (Max Xcode) job? It failed with xcodebuild error 70.

@mykola-mokhnach mykola-mokhnach merged commit deb623c into appium:master Jun 26, 2026
75 of 77 checks passed
github-actions Bot pushed a commit that referenced this pull request Jun 26, 2026
## [15.1.0](v15.0.0...v15.1.0) (2026-06-26)

### Features

* Expose device orientation via /wda/deviceOrientation ([#1162](#1162)) ([deb623c](deb623c))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 15.1.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants