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 6, 2024
1 parent 4e00bf2 commit c73b290
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/general/tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from django.test import tag
from selenium.common import TimeoutException
from selenium.webdriver.chrome.webdriver import Options as ChromeOptions, WebDriver as ChromeWebDriver
from selenium.webdriver.firefox.webdriver import Options as FirefoxOptions, WebDriver as FirefoxWebDriver
from selenium.webdriver.firefox.webdriver import Options as FirefoxOptions, WebDriver as FirefoxWebDriver, \
Service as FirefoxService
from selenium.webdriver.safari.webdriver import Options as SafariOptions, WebDriver as SafariWebDriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
import subprocess

# Wait timeout in seconds
WAIT_TIMEOUT = 5
Expand All @@ -30,7 +32,12 @@ def setUpClass(cls):
opts.add_argument("--window-size=1920,1080")
cls.driver = ChromeWebDriver(opts)
elif browser == "firefox":
cls.driver = FirefoxWebDriver()
# From https://stackoverflow.com/a/74188454
options = FirefoxOptions()
options.binary_location = subprocess.getoutput("find /snap/firefox -name firefox").split("\n")[-1]
geckodriver_loc = subprocess.getoutput("find /snap/firefox -name geckodriver").split("\n")[-1]
service = FirefoxService(executable_path=geckodriver_loc)
cls.driver = FirefoxWebDriver(service=service, options=options)
elif browser == "safari":
cls.driver = SafariWebDriver()

Expand Down

0 comments on commit c73b290

Please sign in to comment.