summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/conftest.py26
-rw-r--r--test/unit/test_popup.py6
2 files changed, 26 insertions, 6 deletions
diff --git a/test/conftest.py b/test/conftest.py
index b9c46b0..dec6d91 100644
--- a/test/conftest.py
+++ b/test/conftest.py
@@ -59,10 +59,20 @@ def close_all_but_one_window(driver):
@pytest.fixture()
def driver(_driver, request):
nav_target = request.node.get_closest_marker('get_page')
- close_all_but_one_window(_driver)
- _driver.get(nav_target.args[0] if nav_target else 'about:blank')
- _driver.implicitly_wait(0)
- yield _driver
+ nav_target = nav_target.args[0] if nav_target else 'about:blank'
+
+ second_driver = request.node.get_closest_marker('second_driver')
+
+ if second_driver:
+ with firefox_safe_mode() as _driver:
+ _driver.get(nav_target)
+ yield _driver
+ _driver.quit()
+ else:
+ close_all_but_one_window(_driver)
+ _driver.get(nav_target)
+ _driver.implicitly_wait(0)
+ yield _driver
@pytest.fixture()
def webextension(driver, request):
@@ -87,8 +97,12 @@ def webextension(driver, request):
yield
- close_all_but_one_window(driver)
- driver.get('https://gotmyowndoma.in/')
+ # Unloading an extension might cause its windows to vanish. Make sure
+ # there's at least one window navigated to some other page before
+ # uninstalling the addon. Otherwise, we could be left with a windowless
+ # browser :c
+ driver.switch_to.window(driver.window_handles[-1])
+ driver.get('about:blank')
driver.uninstall_addon(addon_id)
ext_path.unlink()
diff --git a/test/unit/test_popup.py b/test/unit/test_popup.py
index 3163adb..1fc262c 100644
--- a/test/unit/test_popup.py
+++ b/test/unit/test_popup.py
@@ -235,6 +235,12 @@ def test_popup_repo_query(driver, execute_in_page):
@pytest.mark.ext_data(popup_ext_data)
@pytest.mark.usefixtures('webextension')
+# Under Parabola's Iceweasel 75 the settings page's window opened during this
+# test is impossible to close using driver.close() - it raises an exception with
+# message 'closeTab() not supported in iceweasel'. To avoid such error during
+# test cleanup, we use the mark below to tell our driver fixture to span a
+# separate browser instance for this test.
+@pytest.mark.second_driver()
def test_popup_settings_opening(driver, execute_in_page):
"""
Test opening the settings page from popup through button click.