Skip to content

Commit

Permalink
update clip settings
Browse files Browse the repository at this point in the history
  • Loading branch information
kcpevey committed Sep 19, 2024
1 parent 4ac13a2 commit b28de47
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions .github/workflows/push_images.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# WARNING - This workflow must be run AFTER the "test" workflow.
# This workflow collects screenshots which have stored as artifacts in test.yml
# and opens a PR on the conda-incubator/conda-store repo to update the docs.
#
Expand Down
15 changes: 11 additions & 4 deletions test/playwright/test_ux.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
"""Test suite for user interactions with the UI. It is designed to run both
inside and outside of pytest to make future development easier.
If screenshots=True, clipped images of the UI are taken and stored in
`test-results`. These images are used in the documentation.
Note: Image clipping syntax includes the x & y coordinate of the upper left
corner of the clip area ((0,0) is at the top left of the page) and the width and height of the clip in pixels.
"""

import requests
Expand Down Expand Up @@ -86,7 +92,7 @@ def _create_new_environment(page, screenshot=False):
# fill in the description
page.get_by_placeholder("Enter here the description of your environment").fill("description")
if screenshot:
page.screenshot(path="test-results/add-package-button.png", clip={'x': 300, 'y': 385, 'width': 425, 'height': 170})
page.screenshot(path="test-results/add-package-button.png", clip={'x': 305, 'y': 375, 'width': 445, 'height': 140})
page.screenshot(path="test-results/name-description.png")

# add `rich` package
Expand All @@ -101,6 +107,7 @@ def _create_new_environment(page, screenshot=False):
# add version spec
page.get_by_role("combobox").first.click()
if screenshot:
time.sleep(0.2) # need time for the fade in to complete in CI
page.screenshot(path="test-results/package-version-constraint.png")
page.get_by_role("option", name=">", exact=True).click()
page.get_by_role("combobox").nth(1).click()
Expand Down Expand Up @@ -128,7 +135,7 @@ def _create_new_environment(page, screenshot=False):
# fill in conda-forge as the new channel name
page.get_by_label("Enter channel").fill("conda-forge")
if screenshot:
page.screenshot(path="test-results/add-channel.png", clip={'x': 300, 'y': 440, 'width': 425, 'height': 202})
page.screenshot(path="test-results/add-channel.png", clip={'x': 310, 'y': 410, 'width': 445, 'height': 220})
# press enter to submit the channel to the list
page.get_by_label("Enter channel").press("Enter")
# switch to yaml editor
Expand Down Expand Up @@ -159,7 +166,7 @@ def _create_new_environment(page, screenshot=False):
expect(page.get_by_text("Building")).to_be_visible()
if screenshot:
page.keyboard.press("PageUp") # ensure we are at the top of the page
page.screenshot(path="test-results/environment-building.png", clip={'x': 300, 'y': 190, 'width': 285, 'height': 100})
page.screenshot(path="test-results/environment-building.png", clip={'x': 300, 'y': 190, 'width': 285, 'height': 85})
# wait until the status is `Completed`
completed = page.get_by_text("Completed", exact=False)
completed.wait_for(state="attached", timeout=time_to_build_env)
Expand Down Expand Up @@ -210,7 +217,7 @@ def _existing_environment_interactions(
page.screenshot(path="test-results/edit-env.png")
edit_button.click()
if screenshot:
page.screenshot(path="test-results/switch-to-yaml.png", clip={'x': 280, 'y': 385, 'width': 985, 'height': 75})
page.screenshot(path="test-results/switch-to-yaml.png", clip={'x': 295, 'y': 340, 'width': 970, 'height': 75})
page.keyboard.press("PageDown") # ensure we are at the bottom of the page
page.keyboard.press("PageDown")
page.screenshot(path="test-results/delete-env.png")
Expand Down

0 comments on commit b28de47

Please sign in to comment.