Add keyword arg shortcuts for get_new_driver()
This commit is contained in:
parent
19a8e50400
commit
f8f3010541
|
@ -3993,6 +3993,7 @@ class BaseCase(unittest.TestCase):
|
||||||
d_width=None,
|
d_width=None,
|
||||||
d_height=None,
|
d_height=None,
|
||||||
d_p_r=None,
|
d_p_r=None,
|
||||||
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""This method spins up an extra browser for tests that require
|
"""This method spins up an extra browser for tests that require
|
||||||
more than one. The first browser is already provided by tests
|
more than one. The first browser is already provided by tests
|
||||||
|
@ -4081,6 +4082,11 @@ class BaseCase(unittest.TestCase):
|
||||||
" for examples!)"
|
" for examples!)"
|
||||||
% (browserstack_ref, sauce_labs_ref)
|
% (browserstack_ref, sauce_labs_ref)
|
||||||
)
|
)
|
||||||
|
shortcuts = ["dark", "guest", "locale", "mobile", "pls", "uc", "wire"]
|
||||||
|
if kwargs:
|
||||||
|
for key in kwargs.keys():
|
||||||
|
if key not in shortcuts:
|
||||||
|
raise TypeError("Unexpected keyword argument '%s'" % key)
|
||||||
if browser is None:
|
if browser is None:
|
||||||
browser = self.browser
|
browser = self.browser
|
||||||
browser_name = browser
|
browser_name = browser
|
||||||
|
@ -4088,6 +4094,8 @@ class BaseCase(unittest.TestCase):
|
||||||
headless = self.headless
|
headless = self.headless
|
||||||
if locale_code is None:
|
if locale_code is None:
|
||||||
locale_code = self.locale_code
|
locale_code = self.locale_code
|
||||||
|
if "locale" in kwargs and not locale_code:
|
||||||
|
locale_code = kwargs["locale"]
|
||||||
if protocol is None:
|
if protocol is None:
|
||||||
protocol = self.protocol
|
protocol = self.protocol
|
||||||
if servername is None:
|
if servername is None:
|
||||||
|
@ -4130,6 +4138,8 @@ class BaseCase(unittest.TestCase):
|
||||||
uc_cdp_events = self.uc_cdp_events
|
uc_cdp_events = self.uc_cdp_events
|
||||||
if uc_subprocess is None:
|
if uc_subprocess is None:
|
||||||
uc_subprocess = self.uc_subprocess
|
uc_subprocess = self.uc_subprocess
|
||||||
|
if "uc" in kwargs and not undetectable:
|
||||||
|
undetectable = kwargs["uc"]
|
||||||
if log_cdp_events is None:
|
if log_cdp_events is None:
|
||||||
log_cdp_events = self.log_cdp_events
|
log_cdp_events = self.log_cdp_events
|
||||||
if no_sandbox is None:
|
if no_sandbox is None:
|
||||||
|
@ -4144,8 +4154,12 @@ class BaseCase(unittest.TestCase):
|
||||||
incognito = self.incognito
|
incognito = self.incognito
|
||||||
if guest_mode is None:
|
if guest_mode is None:
|
||||||
guest_mode = self.guest_mode
|
guest_mode = self.guest_mode
|
||||||
|
if "guest" in kwargs and not guest_mode:
|
||||||
|
guest_mode = kwargs["guest"]
|
||||||
if dark_mode is None:
|
if dark_mode is None:
|
||||||
dark_mode = self.dark_mode
|
dark_mode = self.dark_mode
|
||||||
|
if "dark" in kwargs and not dark_mode:
|
||||||
|
dark_mode = kwargs["dark"]
|
||||||
if devtools is None:
|
if devtools is None:
|
||||||
devtools = self.devtools
|
devtools = self.devtools
|
||||||
if remote_debug is None:
|
if remote_debug is None:
|
||||||
|
@ -4182,8 +4196,12 @@ class BaseCase(unittest.TestCase):
|
||||||
driver_version = self.driver_version
|
driver_version = self.driver_version
|
||||||
if page_load_strategy is None:
|
if page_load_strategy is None:
|
||||||
page_load_strategy = self.page_load_strategy
|
page_load_strategy = self.page_load_strategy
|
||||||
|
if "pls" in kwargs and not page_load_strategy:
|
||||||
|
page_load_strategy = kwargs["pls"]
|
||||||
if use_wire is None:
|
if use_wire is None:
|
||||||
use_wire = self.use_wire
|
use_wire = self.use_wire
|
||||||
|
if "wire" in kwargs and not use_wire:
|
||||||
|
use_wire = kwargs["wire"]
|
||||||
if external_pdf is None:
|
if external_pdf is None:
|
||||||
external_pdf = self.external_pdf
|
external_pdf = self.external_pdf
|
||||||
test_id = self.__get_test_id()
|
test_id = self.__get_test_id()
|
||||||
|
@ -4193,6 +4211,8 @@ class BaseCase(unittest.TestCase):
|
||||||
cap_string = self.cap_string
|
cap_string = self.cap_string
|
||||||
if is_mobile is None:
|
if is_mobile is None:
|
||||||
is_mobile = self.mobile_emulator
|
is_mobile = self.mobile_emulator
|
||||||
|
if "mobile" in kwargs and not is_mobile:
|
||||||
|
is_mobile = kwargs["mobile"]
|
||||||
if d_width is None:
|
if d_width is None:
|
||||||
d_width = self.__device_width
|
d_width = self.__device_width
|
||||||
if d_height is None:
|
if d_height is None:
|
||||||
|
|
Loading…
Reference in New Issue