Skip to content

Commit de17fcd

Browse files
authored
add a test case using another session id (appium#320)
1 parent 07d2dea commit de17fcd

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

test/unit/webdriver/webdriver_test.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,36 @@ def test_create_session_forceMjsonwp(self):
8181

8282
assert driver.session_id == 'session-id'
8383
assert driver.w3c is False
84+
85+
@httpretty.activate
86+
def test_create_session_change_session_id(self):
87+
httpretty.register_uri(
88+
httpretty.POST,
89+
'http://localhost:4723/wd/hub/session',
90+
body='{ "value": { "sessionId": "session-id", "capabilities": {"deviceName": "Android Emulator"}}}'
91+
)
92+
93+
httpretty.register_uri(
94+
httpretty.GET,
95+
'http://localhost:4723/wd/hub/session/another-session-id/title',
96+
body='{ "value": "title on another session id"}'
97+
)
98+
99+
desired_caps = {
100+
'platformName': 'Android',
101+
'deviceName': 'Android Emulator',
102+
'app': 'path/to/app',
103+
'automationName': 'UIAutomator2'
104+
}
105+
driver = webdriver.Remote(
106+
'http://localhost:4723/wd/hub',
107+
desired_caps
108+
)
109+
110+
# current session
111+
assert driver.session_id == 'session-id'
112+
113+
# call against another session id
114+
driver.session_id = 'another-session-id'
115+
assert driver.title == 'title on another session id'
116+
assert driver.session_id == 'another-session-id'

0 commit comments

Comments
 (0)