Skip to content

Commit

Permalink
Fix/proxy capabilities (Blazemeter#1396)
Browse files Browse the repository at this point in the history
don't serialize capabilities for remote webdriver
  • Loading branch information
greyfenrir authored Sep 30, 2020
1 parent a89c240 commit 01fb4d5
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion bzt/modules/apiritif/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ def _get_chrome_webdriver(self):

def _get_remote_webdriver(self):
keys = sorted(self.capabilities.keys())
values = [str(self.capabilities[key]) for key in keys]
values = [self.capabilities[key] for key in keys]

return ast.Assign(
targets=[ast_attr("self.driver")],
Expand Down
1 change: 1 addition & 0 deletions site/dat/docs/changes/fix-proxy-capabilities.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix proxy (webdriver capabilities) type to dict
29 changes: 29 additions & 0 deletions tests/modules/selenium/test_selenium_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,35 @@ def test_headless_safari(self):

self.assertNotIn("options.set_headless()", gen_contents)

def test_capabilities_type(self):
self.configure({
"execution": [{
"executor": "selenium",
"scenario": "loc_sc_remote"}],
"scenarios": {
"loc_sc_remote": {
"remote": "http://user:key@remote_web_driver_host:port/wd/hub",
"capabilities": {
"proxy": {"key": "val"},
"string_cap": "string_val"},
"requests": [{
"url": "https://blazedemo.com"}]}}})

self.obj.prepare()
with open(self.obj.script) as fds:
content = fds.read()

target_lines = [
"'proxy': {'key': 'val'}",
"'string_cap': 'string_val'"
]
wrong_line = "'proxy': \"{'key': 'val'}\""

for line in target_lines:
self.assertIn(line, content)

self.assertNotIn(wrong_line, content)

def test_capabilities_order(self):
self.configure({
"execution": [{
Expand Down

0 comments on commit 01fb4d5

Please sign in to comment.