Revision 830d22d8
Added by koszko over 1 year ago
test/conftest.py | ||
---|---|---|
59 | 59 |
@pytest.fixture() |
60 | 60 |
def driver(_driver, request): |
61 | 61 |
nav_target = request.node.get_closest_marker('get_page') |
62 |
close_all_but_one_window(_driver) |
|
63 |
_driver.get(nav_target.args[0] if nav_target else 'about:blank') |
|
64 |
_driver.implicitly_wait(0) |
|
65 |
yield _driver |
|
62 |
nav_target = nav_target.args[0] if nav_target else 'about:blank' |
|
63 |
|
|
64 |
second_driver = request.node.get_closest_marker('second_driver') |
|
65 |
|
|
66 |
if second_driver: |
|
67 |
with firefox_safe_mode() as _driver: |
|
68 |
_driver.get(nav_target) |
|
69 |
yield _driver |
|
70 |
_driver.quit() |
|
71 |
else: |
|
72 |
close_all_but_one_window(_driver) |
|
73 |
_driver.get(nav_target) |
|
74 |
_driver.implicitly_wait(0) |
|
75 |
yield _driver |
|
66 | 76 |
|
67 | 77 |
@pytest.fixture() |
68 | 78 |
def webextension(driver, request): |
... | ... | |
87 | 97 |
|
88 | 98 |
yield |
89 | 99 |
|
90 |
close_all_but_one_window(driver) |
|
91 |
driver.get('https://gotmyowndoma.in/') |
|
100 |
# Unloading an extension might cause its windows to vanish. Make sure |
|
101 |
# there's at least one window navigated to some other page before |
|
102 |
# uninstalling the addon. Otherwise, we could be left with a windowless |
|
103 |
# browser :c |
|
104 |
driver.switch_to.window(driver.window_handles[-1]) |
|
105 |
driver.get('about:blank') |
|
92 | 106 |
driver.uninstall_addon(addon_id) |
93 | 107 |
ext_path.unlink() |
94 | 108 |
|
Also available in: Unified diff
support Parabola's Iceweasel in tests