From dcaec1c9462e02a447defedd8a8decf6ae44bf27 Mon Sep 17 00:00:00 2001 From: Restioson Date: Thu, 7 Nov 2024 10:46:48 +0200 Subject: [PATCH] fixup! test(selenium): run tests across multiple {browser, js} combinations --- app/general/tests/test_frontend.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/general/tests/test_frontend.py b/app/general/tests/test_frontend.py index 393a5a1..3b23190 100644 --- a/app/general/tests/test_frontend.py +++ b/app/general/tests/test_frontend.py @@ -4,7 +4,10 @@ from django.test import tag from selenium.common import TimeoutException from selenium.webdriver.chrome.webdriver import ( - Options as ChromeOptions, WebDriver as ChromeWebDriver + Options as ChromeOptions, +) +from selenium.webdriver.chrome.webdriver import ( + WebDriver as ChromeWebDriver, ) from selenium.webdriver.common.by import By from selenium.webdriver.firefox.webdriver import ( @@ -45,7 +48,7 @@ def setUpClass(cls): prefs["profile.default_content_setting_values.javascript"] = 2 prefs["profile.managed_default_content_settings.javascript"] = 2 opts.add_experimental_option("prefs", prefs) - opts.add_argument('--disable-javascript') + opts.add_argument("--disable-javascript") cls.driver = ChromeWebDriver(opts) elif browser == "firefox": @@ -67,7 +70,9 @@ def tearDownClass(cls): def test_js_enabled_or_disabled(self): test_dir = os.getenv("TESTING_DIR", "/app/general/tests/files") self.driver.get(f"file://{test_dir}/test_js.html") - self.assertEqual(len(self.driver.find_elements(By.ID, "js-enabled")), 1 if self.js_enabled else 0) + self.assertEqual( + len(self.driver.find_elements(By.ID, "js-enabled")), 1 if self.js_enabled else 0 + ) def test_no_404s(self): # Sanity check in case we ever change the 404 title