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

Update gecko #243

Merged
merged 6 commits into from
Jun 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
22 changes: 6 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
- main
pull_request:

env:
FORCE_COLOR: 1

jobs:

pre-commit:
Expand Down Expand Up @@ -35,12 +38,13 @@ jobs:
strategy:
matrix:
tag: [latest]
image: ["aiidalab/full-stack", "ghcr.io/ispg-group/atmospec"]
image: ["ghcr.io/aiidalab/full-stack", "ghcr.io/ispg-group/atmospec"]
browser: [Firefox, Chrome]
fail-fast: false
env:
IMAGE: ${{ matrix.image }}
TAG: ${{ matrix.tag }}
# Right now due to old AWB version we do not support the latest image with aiida-core=2.5.1
TAG: ${{ matrix.image == 'ghcr.io/aiidalab/full-stack' && 'aiida-2.4.3' || 'latest' }}

steps:

Expand Down Expand Up @@ -70,20 +74,6 @@ jobs:
- name: Set jupyter token env
run: echo "JUPYTER_TOKEN=$(openssl rand -hex 32)" >> $GITHUB_ENV

# The Firefox and its engine geckodrive need do be installed manually to run
# selenium tests.
- name: Install Firefox
if: matrix.browser == 'Firefox'
uses: browser-actions/setup-firefox@latest
with:
firefox-version: "96.0"

- name: Install geckodriver
if: matrix.browser == 'Firefox'
run: |
wget -c https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
tar xf geckodriver-v0.30.0-linux64.tar.gz -C /usr/local/bin

- name: Run pytest
run: pytest -sv --driver ${{ matrix.browser }} -o cache_dir=$PYTEST_CACHE_DIR tests/app/

Expand Down
9 changes: 4 additions & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pytest~=6.2
pytest-docker~=1.0
pytest-selenium~=4.0
webdriver-manager~=3.8
selenium~=4.7.0
pytest~=8.2.0
pytest-docker~=3.0
pytest-selenium~=4.1
selenium==4.20.0
11 changes: 7 additions & 4 deletions tests/app/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ def notebook_service(docker_ip, docker_services, aiidalab_exec, nb_user, appdir)
url = f"http://{docker_ip}:{port}"
token = os.environ["JUPYTER_TOKEN"]
docker_services.wait_until_responsive(
timeout=30.0, pause=0.1, check=lambda: is_responsive(url)
timeout=30.0, pause=0.5, check=lambda: is_responsive(url)
)
return url, token


@pytest.fixture()
def selenium_driver(selenium, notebook_service):
def _selenium_driver(nb_path, wait_time=5.0):
def _selenium_driver(nb_path, wait_time=30.0):
url, token = notebook_service
url_with_token = urljoin(
url, f"apps/apps/aiidalab-ispg/notebooks/{nb_path}?token={token}"
Expand All @@ -90,7 +90,7 @@ def _selenium_driver(nb_path, wait_time=5.0):
selenium.find_element(By.ID, "ipython-main-app")
selenium.find_element(By.ID, "notebook-container")
selenium.find_element(By.CLASS_NAME, "jupyter-widgets-view")
WebDriverWait(selenium, 20).until(
WebDriverWait(selenium, timeout=20, poll_frequency=0.5).until(
EC.invisibility_of_element((By.ID, "appmode-busy"))
)
return selenium
Expand All @@ -109,7 +109,10 @@ def _generate_mol(smiles):
(By.XPATH, "//button[text()='Generate molecule']")
)
).click()
time.sleep(3)
WebDriverWait(selenium, timeout=20, poll_frequency=0.5).until(
EC.invisibility_of_element((By.ID, "appmode-busy"))
)
time.sleep(3.0)

return _generate_mol

Expand Down