Skip to content

Commit

Permalink
fixup! test(frontend): add basic Selenium testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Restioson committed Oct 18, 2024
1 parent b0bc70f commit 9832300
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions app/general/tests/test_frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@
from selenium.webdriver.support.wait import WebDriverWait


# Wait timeout in seconds
WAIT_TIMEOUT = 5


class TestFrontend(StaticLiveServerTestCase):
@classmethod
def setUpClass(cls):
Expand All @@ -14,7 +18,7 @@ def setUpClass(cls):
opts.add_argument("--disable-dev-shm-usage")
opts.add_argument("--window-size=1920,1080")
cls.driver = WebDriver(opts)
cls.driver.implicitly_wait(5)
cls.driver.implicitly_wait(WAIT_TIMEOUT)
super().setUpClass()

@classmethod
Expand Down Expand Up @@ -43,7 +47,7 @@ def check_nav_item(self, link_text):

# We use 'in' to do a more permissive match (for instance 'Search' is usually '<search query> - Search'
try:
wait = WebDriverWait(self.driver, timeout=5)
wait = WebDriverWait(self.driver, timeout=WAIT_TIMEOUT)
wait.until(lambda d: link_text in self.driver.title)
except TimeoutException:
assert link_text in self.driver.title, (
Expand Down

0 comments on commit 9832300

Please sign in to comment.