Skip to content

Commit

Permalink
Upload screenshot as artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Jul 5, 2024
1 parent 12eb171 commit ccafba7
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ jobs:
export CONTAINER_ID=$container_id
export JUPYTER_HOST=http://localhost:8888
export JUPYTER_TOKEN=secret
export SCREENSHOT_NAME=${{ matrix.vncserver }}-desktop.png
python -mpytest -vs
Expand All @@ -101,3 +102,10 @@ jobs:
echo "One or more tests failed!"
exit 1
fi
- name: Upload screenshot
uses: actions/upload-artifact@v4
if: always()
with:
path: screenshots/*
if-no-files-found: error
5 changes: 3 additions & 2 deletions tests/test_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
CONTAINER_ID = getenv("CONTAINER_ID", "test")
JUPYTER_HOST = getenv("JUPYTER_HOST", "http://localhost:8888")
JUPYTER_TOKEN = getenv("JUPYTER_TOKEN", "secret")
SCREENSHOT_NAME = getenv("SCREENSHOT_NAME", "desktop.png")


def compare_screenshot(test_image, threshold=1):
Expand Down Expand Up @@ -51,8 +52,8 @@ def test_desktop(browser):
# Screenshot the desktop element only
# May take a few seconds to load
page1.wait_for_timeout(5000)
# Use a nontemp folder so we can check it manually if necessary
screenshot = "screenshots/desktop.png"
# Use a non temporary folder so we can check it manually if necessary
screenshot = Path("screenshots") / SCREENSHOT_NAME
page1.locator("canvas").screenshot(path=screenshot)

# Open clipboard, enter random text, close clipboard
Expand Down

0 comments on commit ccafba7

Please sign in to comment.