Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/functional-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ jobs:
XCODE_VERSION: 16.4
IOS_VERSION: 18.5
IPHONE_MODEL: iPhone 16
FLUTTER_ANDROID_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/app-debug.apk"
FLUTTER_IOS_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/latest/download/ios.zip"
FLUTTER_ANDROID_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/0.0.33/app-debug.apk"
FLUTTER_IOS_APP: "https://github.com/AppiumTestDistribution/appium-flutter-server/releases/download/0.0.33/ios.zip"
PREBUILT_WDA_PATH: ${{ github.workspace }}/wda/WebDriverAgentRunner-Runner.app

steps:
Expand Down
2 changes: 1 addition & 1 deletion appium/webdriver/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ def orientation(self, value: str) -> None:
"""
allowed_values = ['LANDSCAPE', 'PORTRAIT']
if value.upper() in allowed_values:
self.execute(Command.SET_SCREEN_ORIENTATION, {'orientation': value})
self.execute(Command.SET_SCREEN_ORIENTATION, {'orientation': value.upper()})
else:
raise WebDriverException("You can only set the orientation to 'LANDSCAPE' and 'PORTRAIT'")

Expand Down
34 changes: 34 additions & 0 deletions test/unit/webdriver/webdriver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
import json

import httpretty
import pytest
import urllib3
from mock import patch
from selenium.common.exceptions import WebDriverException

from appium import webdriver
from appium.options.android import UiAutomator2Options
Expand Down Expand Up @@ -404,6 +406,38 @@ class CustomAppiumConnection(AppiumConnection):

assert isinstance(driver.command_executor, CustomAppiumConnection)

@httpretty.activate
def test_orientation_getter(self):
driver = android_w3c_driver()
httpretty.register_uri(httpretty.GET, appium_command('/session/1234567890/orientation'), body='{"value": "LANDSCAPE"}')
assert driver.orientation == 'LANDSCAPE'

@httpretty.activate
def test_orientation_setter(self):
driver = android_w3c_driver()
httpretty.register_uri(httpretty.POST, appium_command('/session/1234567890/orientation'), body='{"value": ""}')

driver.orientation = 'LANDSCAPE'

assert {
'orientation': 'LANDSCAPE',
} == get_httpretty_request_body(httpretty.last_request())

driver.orientation = 'PORTRAIT'

assert {
'orientation': 'PORTRAIT',
} == get_httpretty_request_body(httpretty.last_request())

@httpretty.activate
def test_orientation_setter_invalid(self):
driver = android_w3c_driver()

with pytest.raises(WebDriverException) as excinfo:
driver.orientation = 'INVALID'

assert "You can only set the orientation to 'LANDSCAPE' and 'PORTRAIT'" in str(excinfo.value)

@httpretty.activate
def test_extention_command_check(self):
driver = android_w3c_driver()
Expand Down
Loading