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

Add default timeout #343

Merged
merged 8 commits into from
Dec 6, 2023
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
3 changes: 3 additions & 0 deletions test/playwright/conftest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pytest

from playwright.sync_api import expect



def pytest_addoption(parser):
parser.addoption("--screenshots", action="store", default="false")
Expand Down
22 changes: 12 additions & 10 deletions test/playwright/test_ux.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
import time

import pytest
from playwright.sync_api import Page
from playwright.sync_api import sync_playwright
from playwright.sync_api import Page, sync_playwright, expect
import random


DEFAULT_TIMEOUT = 30_000 # time in ms

expect.set_options(timeout=DEFAULT_TIMEOUT)

CONDA_STORE_SERVER_PORT = os.environ.get(
"CONDA_STORE_SERVER_PORT", f"8080"
)
Expand Down Expand Up @@ -119,11 +122,11 @@ def _create_new_environment(page, screenshot=False):
# click on the Active environment on the dropdown menu item (which is currently building)
page.get_by_role("option", name=" - Active", exact=False).click()
# ensure that the environment is building
assert page.get_by_text("Building").is_visible()
expect(page.get_by_text("Building")).to_be_visible()
# wait until the status is `Completed`
completed = page.get_by_text("Completed", exact=False)
completed.wait_for(state='attached', timeout=time_to_build_env)
assert completed.is_visible()
expect(completed).to_be_visible()

return new_env_name

Expand Down Expand Up @@ -166,7 +169,7 @@ def _existing_environment_interactions(page, env_name, time_to_build_env=3*60*10
# edit existing environment throught the YAML editor
page.get_by_role("button", name=env_name).click()
page.get_by_role("button", name="Edit").click()
page.get_by_label("Switch to YAML Editor").check()
page.get_by_label("YAML").check()
if screenshot:
page.screenshot(path="test-results/conda-store-yaml-editor.png")
page.get_by_text("- rich").click()
Expand All @@ -177,7 +180,9 @@ def _existing_environment_interactions(page, env_name, time_to_build_env=3*60*10
completed.wait_for(state='attached', timeout=time_to_build_env)

# ensure the namespace is expanded
if not page.get_by_role("button", name=env_name).is_visible():
try:
expect(page.get_by_role("button", name=env_name)).to_be_visible()
except Exception as e:
# click to expand the `username` name space (but not click the +)
page.get_by_role("button", name="username Create a new environment in the username namespace").click()

Expand Down Expand Up @@ -217,7 +222,6 @@ def _existing_environment_interactions(page, env_name, time_to_build_env=3*60*10
completed = page.get_by_text("Completed", exact=False)
completed.wait_for(state='attached', timeout=time_to_build_env)


# Edit -> Cancel editing
page.get_by_role("button", name=env_name).click()
page.get_by_role("button", name="Edit").click()
Expand All @@ -228,9 +232,7 @@ def _existing_environment_interactions(page, env_name, time_to_build_env=3*60*10
page.get_by_text("Delete environment").click()
page.get_by_role("button", name="Delete").click()

time.sleep(5) # wait for it to render, flaky otherwise
assert not page.get_by_role("button", name=env_name).is_visible()

expect(page.get_by_role("button", name=env_name)).not_to_be_visible()


def test_integration(page: Page, test_config, screenshot):
Expand Down