Revision ca6da915
Added by koszko over 1 year ago
test/haketilo_test/conftest.py | ||
---|---|---|
74 | 74 |
_driver.implicitly_wait(0) |
75 | 75 |
yield _driver |
76 | 76 |
|
77 |
def safe_uninstall_addon(driver, addon_id): |
|
78 |
""" |
|
79 |
Unloading an extension might cause its windows to vanish. Make sure there's |
|
80 |
at least one window navigated to some other page before uninstalling the |
|
81 |
addon. Otherwise, we could be left with a windowless browser :c |
|
82 |
""" |
|
83 |
driver.switch_to.window(driver.window_handles[-1]) |
|
84 |
driver.get('https://gotmyowndoma.in/') |
|
85 |
driver.uninstall_addon(addon_id) |
|
86 |
|
|
77 | 87 |
@pytest.fixture() |
78 | 88 |
def webextension(driver, request): |
79 | 89 |
ext_data = request.node.get_closest_marker('ext_data') |
... | ... | |
97 | 107 |
|
98 | 108 |
yield |
99 | 109 |
|
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('https://gotmyowndoma.in/') |
|
106 |
driver.uninstall_addon(addon_id) |
|
110 |
safe_uninstall_addon(driver, addon_id) |
|
107 | 111 |
ext_path.unlink() |
108 | 112 |
|
109 | 113 |
@pytest.fixture() |
... | ... | |
113 | 117 |
|
114 | 118 |
yield |
115 | 119 |
|
116 |
driver.uninstall_addon(addon_id)
|
|
120 |
safe_uninstall_addon(driver, addon_id)
|
|
117 | 121 |
|
118 | 122 |
script_injector_script = '''\ |
119 | 123 |
/* |
Also available in: Unified diff
stop
haketilo()
fixture cleanup from closing last browser window