diff --git a/.github/workflows/functional-test.yml b/.github/workflows/functional-test.yml index fecd4b1b..c4d81cd1 100644 --- a/.github/workflows/functional-test.yml +++ b/.github/workflows/functional-test.yml @@ -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: diff --git a/appium/webdriver/webdriver.py b/appium/webdriver/webdriver.py index 5ae6b9ab..1bd54988 100644 --- a/appium/webdriver/webdriver.py +++ b/appium/webdriver/webdriver.py @@ -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'") diff --git a/test/unit/webdriver/webdriver_test.py b/test/unit/webdriver/webdriver_test.py index 17db27af..84851b2c 100644 --- a/test/unit/webdriver/webdriver_test.py +++ b/test/unit/webdriver/webdriver_test.py @@ -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 @@ -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()