Skip to content

Commit f5a1fb0

Browse files
committed
Screenshot whole body, not just canvas
Separate screenshots for turbovnc and tigervnc
1 parent e82cb60 commit f5a1fb0

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ jobs:
9595
export CONTAINER_ID=$container_id
9696
export JUPYTER_HOST=http://localhost:8888
9797
export JUPYTER_TOKEN=secret
98+
export VNCSERVER=${{ matrix.vncserver }}
9899
99100
python -mpytest -vs
100101

tests/reference/desktop-turbovnc.png

1.62 MB
Loading

tests/reference/desktop.png

583 KB
Loading

tests/test_browser.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
CONTAINER_ID = getenv("CONTAINER_ID", "test")
1313
JUPYTER_HOST = getenv("JUPYTER_HOST", "http://localhost:8888")
1414
JUPYTER_TOKEN = getenv("JUPYTER_TOKEN", "secret")
15+
VNCSERVER = getenv("VNCSERVER")
1516

1617

1718
def compare_screenshot(test_image, threshold=2):
@@ -21,6 +22,8 @@ def compare_screenshot(test_image, threshold=2):
2122
# e.g. for 24 bit images (8 bit RGB pixels) threshold=1 means a maximum
2223
# difference of 1 bit per pixel per channel
2324
reference = Image.open(HERE / "reference" / "desktop.png")
25+
if VNCSERVER == "turbovnc":
26+
reference = Image.open(HERE / "reference" / "desktop-turbovnc.png")
2427
test = Image.open(test_image)
2528

2629
# Absolute difference
@@ -53,7 +56,7 @@ def test_desktop(browser):
5356
page1.wait_for_timeout(5000)
5457
# Use a non temporary folder so we can check it manually if necessary
5558
screenshot = Path("screenshots") / "desktop.png"
56-
page1.locator("canvas").screenshot(path=screenshot)
59+
page1.locator("body").screenshot(path=screenshot)
5760

5861
# Open clipboard, enter random text, close clipboard
5962
clipboard_text = str(uuid4())

0 commit comments

Comments
 (0)