'Method has not yet been implemented' error from rotateDevice function

Raising this issue as I did not find related to my scenario.
Error message: ERROR webdriver: Request failed due to Error: Method has not yet been implemented
My setup:
webdriverIO 5.18.6
Appium 1.17.0
Real iOS Device - { platformName: 'iOS', device: 'iPad Air 2019', 'os_version': '12', 'app': 'bs://48b8310662fd103eb37edf0596fdd3d086970007', 'maxInstances': 1, 'browserstack.debug': true, 'browserstack.appiumLogs': true, 'automationName': 'XCUITest', 'useNewWDA': true, 'autoAcceptAlerts': true, 'autoGrantPermissions': true, 'browserstack.appium_version': '1.16.0', 'browserstack.appium:newCommandTimeout': 240, 'browserstack.geoLocation': 'AU', 'deviceOrientation': 'portrait', },
Code snippet:
if (driver.getOrientation() == 'LANDSCAPE') { driver.rotateDevice(114, 198, 3, 220, 2, 5); }
Appium error log:
2020-04-20 02:49:38:948 - [HTTP] --> POST /wd/hub/session/b5e2d194-c44c-49e6-865e-3be8ae0cd5c8/appium/device/rotate
2020-04-20 02:49:38:949 - [HTTP] {“x”:114,“y”:198,“radius”:3,“rotation”:220,“touchCount”:2,“duration”:5}
2020-04-20 02:49:38:950 - [debug] [MJSONWP (b5e2d194)] Calling AppiumDriver.mobileRotation() with args: [114,198,3,220,2,5,null,null,null,“b5e2d194-c44c-49e6-865e-3be8ae0cd5c8”]
2020-04-20 02:49:38:951 - [debug] [XCUITest] Executing command ‘mobileRotation’
2020-04-20 02:49:38:969 - [debug] [MJSONWP (b5e2d194)] Encountered internal error running command: NotYetImplementedError: Method has not yet been implemented
2020-04-20 02:49:38:969 - [debug] [MJSONWP (b5e2d194)] at XCUITestDriver.executeCommand (/usr/local/.browserstack/appium_1.16.0_bstack/node_modules/appium-base-driver/lib/basedriver/driver.js:323:13)
2020-04-20 02:49:38:969 - [debug] [MJSONWP (b5e2d194)] at XCUITestDriver.executeCommand (/usr/local/.browserstack/appium_1.16.0_bstack/node_modules/appium-xcuitest-driver/lib/driver.js:710:24)
2020-04-20 02:49:38:969 - [debug] [MJSONWP (b5e2d194)] at AppiumDriver.executeCommand (/usr/local/.browserstack/appium_1.16.0_bstack/lib/appium.js:510:36)
2020-04-20 02:49:38:969 - [debug] [MJSONWP (b5e2d194)] at process._tickCallback (internal/process/next_tick.js:68:7)
2020-04-20 02:49:38:971 - [HTTP] <-- POST /wd/hub/session/b5e2d194-c44c-49e6-865e-3be8ae0cd5c8/appium/device/rotate 501 21 ms - 123

Check https://github.com/appium/java-client/blob/1991a8a0f9e4a3ff467dbb713cb5c51c8edc060f/src/test/java/io/appium/java_client/ios/RotationTest.java for rotation examples

@mykola-mokhnach hardly believe it will for for real @pradeepnyk device :slight_smile:

These rotation methods should work for both real and emulated devices both iOS and Android. If they don’t then consider reporting it as an issue. One important thing to mention: x and y arguments are ignored, only z is supported and only the following values of it : 0, 90, 180, 270

@mykola-mokhnach both ios Simulator and Real device:

2020-04-20 11:43:14:411 - [debug] [WD Proxy] Matched '/wd/hub/session/fffc0971-60cd-4f9f-870b-1351903debed/rotation' to command name 'setRotation'
2020-04-20 11:43:14:412 - [debug] [WD Proxy] Proxying [POST /wd/hub/session/fffc0971-60cd-4f9f-870b-1351903debed/rotation] to [POST http://127.0.0.1:8001/session/1BF87CA3-D9AD-4AA1-B882-81F558DD61C9/rotation] with body: {"x":0,"y":0,"z":90}
2020-04-20 11:43:14:413 - [debug] [W3C (fffc0971)] Responding to client with driver.startRecordingScreen() result: ""
2020-04-20 11:43:14:415 - [HTTP] <-- POST /wd/hub/session/fffc0971-60cd-4f9f-870b-1351903debed/appium/start_recording_screen 200 1248 ms - 12
2020-04-20 11:43:15:963 - [WD Proxy] Got response with status 500: {"value":{"error":"unknown error","message":"Rotation not supported: (null)","traceback":""},"sessionId":"1BF87CA3-D9AD-4AA1-B882-81F558DD61C9"}
2020-04-20 11:43:15:981 - [debug] [W3C (fffc0971)] Encountered internal error running command: ProxyRequestError: Could not proxy command to remote server. Original error: 500 - {"value":{"error":"unknown error","message":"Rotation not supported: (null)","traceback":""},"sessionId":"1BF87CA3-D9AD-4AA1-B882-81F558DD61C9"}
2020-04-20 11:43:15:982 - [debug] [W3C (fffc0971)]     at JWProxy.proxy (/usr/local/lib/node_modules/appium/node_modules/appium-base-driver/lib/jsonwp-proxy/proxy.js:218:13)
2020-04-20 11:43:15:982 - [debug] [W3C] Matched W3C error code 'unknown error' to UnknownError
2020-04-20 11:43:16:006 - [HTTP] <-- POST /wd/hub/session/fffc0971-60cd-4f9f-870b-1351903debed/rotation 500 2033 ms - 696

installed latest Appium server 1.17.0.

Congrats you’ve just found a bug:)

I’ll try to see what can be done on it

I’ve just tried that locally and it looks like the Rotation not supported message is only shown if the active application does not support orientation change (iphone springboard app does not, for example). Although, the message itself could be improved for sure. It is misleading

https://github.com/appium/WebDriverAgent/pull/319 should make it better

Thanks for your response. Can I have the example with Javascript (WebdriverIO) ?