diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 24ebbca1..77d0919a 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -55,3 +55,5 @@ jobs: run: | cd app/ python manage.py check + - name: Set up ChromeDriver + uses: nanasess/setup-chromedriver@v2.2.2 diff --git a/Dockerfile-dev b/Dockerfile-dev index a59cdeba..468ce882 100644 --- a/Dockerfile-dev +++ b/Dockerfile-dev @@ -18,7 +18,7 @@ RUN < - Search' + try: + wait = WebDriverWait(self.driver, timeout=5) + wait.until(lambda d: link_text in self.driver.title) + except TimeoutException: + assert link_text in self.driver.title, ( + f"Expected title for page {link_text} to have {link_text};" + f" was {self.driver.title}" + ) + self.assert_current_page_not_error() + + def assert_current_page_not_error(self): + assert not self.driver.title.startswith("Error"), f"Actual title was {self.driver.title}" + assert not self.driver.title.startswith( + "ProgrammingError" + ), f"Actual title was {self.driver.title}" + assert not self.driver.find_element(By.ID, "error-block").is_displayed() diff --git a/requirements-test.txt b/requirements-test.txt index bfe3dc05..a5743332 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -3,3 +3,4 @@ django-debug-toolbar django-extensions faker ruff +selenium==4.25.0