Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix notebook tests #630

Merged
merged 4 commits into from
Aug 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ dev =
bumpver>=2023.1129
pgtest~=1.3
pre-commit>=3.5
pytest~=8.2.0
pytest~=8.3.0
pytest-cov~=5.0
pytest-docker~=3.0
pytest-selenium~=4.1
pytest-timeout~=2.2
selenium==4.20.0
pytest-docker~=3.1.0
pytest-selenium~=4.1.0
pytest-timeout~=2.3.0
Comment on lines +49 to +51
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be on the safe side and to reduce potential churn, let's pin all test dependencies to minor versions.

selenium~=4.23.0
optimade =
ipyoptimade~=0.1
eln =
Expand Down
8 changes: 6 additions & 2 deletions tests_notebooks/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,20 @@ def _selenium_driver(nb_path):
url, f"apps/apps/aiidalab-widgets-base/{nb_path}?token={token}"
)
selenium.get(f"{url_with_token}")
# By default, let's allow selenium functions to retry for 10s
# By default, let's allow selenium functions to retry for 60s
# till a given element is loaded, see:
# https://selenium-python.readthedocs.io/waits.html#implicit-waits
selenium.implicitly_wait(30)
selenium.implicitly_wait(60)
window_width = 800
window_height = 600
selenium.set_window_size(window_width, window_height)

selenium.find_element(By.ID, "ipython-main-app")
selenium.find_element(By.ID, "notebook-container")
selenium.find_element(By.ID, "appmode-busy")
# We wait until the appmode spinner disappears. However,
# this does not seem to be fully robust, as the spinner might flash
# while the page is still loading. So we add explicit sleep here as well.
WebDriverWait(selenium, 240).until(
ec.invisibility_of_element((By.ID, "appmode-busy"))
)
Expand Down