Skip to content
Open
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
34 changes: 34 additions & 0 deletions test/unit/webdriver/webdriver_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
from unittest.mock import patch

import httpretty
import pytest
import urllib3
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 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()

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