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 playwright tests #372

Merged
merged 4 commits into from
Feb 27, 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
6 changes: 3 additions & 3 deletions test/playwright/test_ux.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def _create_new_environment(page, screenshot=False):
# ensure new filename in case this test is run multiple times
new_env_name = f'test_env_{random.randint(0, 100000)}'
# set timeout for building the environment
time_to_build_env = 2 * 60 * 1000 # 2 minutes in milliseconds
time_to_build_env = 5 * 60 * 1000 # 5 minutes in milliseconds
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The previous timeout value wasn't big enough, so the test was flaky.


# Create the new environment
# click the + to create a new env
Expand Down Expand Up @@ -118,7 +118,7 @@ def _create_new_environment(page, screenshot=False):

# Interact with the environment shortly after creation
# click to open the Active environment dropdown manu
page.get_by_role("button", name=" - Active", exact=False).click()
page.get_by_text(" - Active", exact=False).click()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is necessary because the generated Select component is now a combobox, so the button role doesn't match.

Using get_by_text might look error-prone here, but I think it's okay. The option line below will error out if get_by_text matches something else here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note: I use get_by_text and not get_by_role("combobox", ...) here because playwright fails to find this button with the latter approach.

# 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
Expand Down Expand Up @@ -193,7 +193,7 @@ def _existing_environment_interactions(page, env_name, time_to_build_env=3*60*10
# change the description
page.get_by_placeholder("Enter here the description of your environment").fill("new description")
# change the vesion spec of an existing package
page.get_by_role("row", name="ipykernel", exact=False).get_by_role("button").first.click()
page.get_by_role("row", name="ipykernel", exact=False).get_by_role("combobox").first.click()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

As mentioned in the other comment, the generated code now uses combobox instead of button.

Copy link
Contributor

Choose a reason for hiding this comment

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

When I was reviewing this PR, I noticed that after running yarn start if I loaded the web app from localhost:8000, I got a combobox, whereas if I loaded the web app from localhost:8080 I got a button.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, I think I see why this happens. It looks like the Conda Store server comes bundled with its own version of Conda Store UI. Wild.

So then this change makes sense; however, I'm now concerned about a possible discrepancy between the environment variables in the GitHub runner environment versus local dev, resulting in this test passing on CI but failing locally.

Copy link
Contributor

Choose a reason for hiding this comment

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

We might need to redefine the default value for CONDA_STORE_SERVER_PORT at the top of the file.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Wait, when was this changed to a combobox? - I thought this was during the #310 PR

In that case both 8080 and 8000 should be returning a combobox.

page.get_by_role("option", name=">=").click()
# Note: purposefully not testing version constraint since there is inconsistent behavior here

Expand Down
Loading
Loading