Skip to content

Commit

Permalink
fixup! test(selenium): run tests across multiple {browser, js} combin…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
Restioson committed Nov 7, 2024
1 parent 7a589a0 commit dcaec1c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions app/general/tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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":
Expand All @@ -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
Expand Down

0 comments on commit dcaec1c

Please sign in to comment.