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
2 changes: 1 addition & 1 deletion appium/webdriver/webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,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
15 changes: 15 additions & 0 deletions test/unit/webdriver/webdriver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,21 @@ def test_orientation_setter(self):
'orientation': 'PORTRAIT',
}

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

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

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

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