Skip to content

Commit cf07279

Browse files
authored
Merge pull request #129 from manics/netcat-openbsd
Install netcat-openbsd in tests and update screenshots for ubuntu 24.04
2 parents 30e67eb + 646cedf commit cf07279

File tree

5 files changed

+12
-3
lines changed

5 files changed

+12
-3
lines changed

.github/workflows/test.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
echo "::group::Install netcat, a test dependency"
6767
docker exec --user root $container_id bash -c '
6868
apt update
69-
apt install -y netcat
69+
apt install -y netcat-openbsd
7070
'
7171
echo "::endgroup::"
7272
@@ -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

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ This is based on https://github.com/ryanlovett/nbnovnc.
1212

1313
When this extension is launched it will run a Linux desktop on the Jupyter single-user server, and proxy it to your browser using VNC via Jupyter.
1414

15+
![Screenshot of jupyter-remote-desktop-proxy XFCE desktop](https://raw.githubusercontent.com/jupyterhub/jupyter-remote-desktop-proxy/main/tests/reference/desktop.png)
16+
1517
## VNC Server
1618

1719
This extension requires a [VNC Server](https://en.wikipedia.org/wiki/Virtual_Network_Computing)

tests/reference/desktop-turbovnc.png

1.62 MB
Loading

tests/reference/desktop.png

583 KB
Loading

tests/test_browser.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,21 @@
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

17-
def compare_screenshot(test_image, threshold=2):
18+
def compare_screenshot(test_image):
1819
# Compare images by calculating the mean absolute difference
1920
# Images must be the same size
2021
# threshold: Average difference per pixel, this depends on the image type
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+
threshold = 2
26+
if VNCSERVER == "turbovnc":
27+
reference = Image.open(HERE / "reference" / "desktop-turbovnc.png")
28+
# The TurboVNC screenshot varies a lot more than TigerVNC
29+
threshold = 6
2430
test = Image.open(test_image)
2531

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

5864
# Open clipboard, enter random text, close clipboard
5965
clipboard_text = str(uuid4())

0 commit comments

Comments
 (0)