@@ -36,29 +36,29 @@ jobs:
36
36
steps :
37
37
- uses : actions/checkout@v4
38
38
39
+ - uses : actions/setup-python@v5
40
+ with :
41
+ python-version : " 3.11"
42
+
43
+ - name : Cache playwright binaries
44
+ uses : actions/cache@v4
45
+ with :
46
+ path : |
47
+ ~/.cache/ms-playwright
48
+ key : ${{ runner.os }}-playwright
49
+
39
50
- name : Build image
40
51
run : |
41
52
docker build --progress=plain --build-arg vncserver=${{ matrix.vncserver }} -t test .
42
53
43
- - name : (inside container) websockify --help
44
- run : |
45
- docker run test websockify --help
46
-
47
54
- name : (inside container) vncserver -help
48
55
run : |
49
56
# -help flag is not available for TurboVNC, but it emits the -help
50
57
# equivalent information anyhow if passed -help, but also errors. Due
51
58
# to this, we fallback to use the errorcode of vncsrever -list.
52
59
docker run test bash -c "vncserver -help || vncserver -list > /dev/null"
53
60
54
- - name : Install websocat, a test dependency"
55
- run : |
56
- wget -q https://github.com/vi/websocat/releases/download/v1.12.0/websocat.x86_64-unknown-linux-musl \
57
- -O /usr/local/bin/websocat
58
- chmod +x /usr/local/bin/websocat
59
-
60
61
- name : Test vncserver
61
- if : always()
62
62
run : |
63
63
container_id=$(docker run -d -it -p 5901:5901 test vncserver -xstartup /opt/install/jupyter_remote_desktop_proxy/share/xstartup -verbose -fg -geometry 1680x1050 -SecurityTypes None -rfbport 5901)
64
64
sleep 1
@@ -79,71 +79,24 @@ jobs:
79
79
80
80
docker stop $container_id > /dev/null
81
81
if [ "$TEST_OK" == "false" ]; then
82
- echo "One or more tests failed!"
82
+ echo "Test failed!"
83
83
exit 1
84
84
fi
85
85
86
- - name : Test websockify'ed vncserver
87
- if : always()
86
+ - name : Install playwright
88
87
run : |
89
- container_id=$(docker run -d -it -p 5901:5901 test websockify --verbose --log-file=/tmp/websockify.log --heartbeat=30 5901 -- vncserver -xstartup /opt/install/jupyter_remote_desktop_proxy/share/xstartup -verbose -fg -geometry 1680x1050 -SecurityTypes None -rfbport 5901)
90
- sleep 1
91
-
92
- echo "::group::Install websocat, a test dependency"
93
- docker exec --user root $container_id bash -c '
94
- wget -q https://github.com/vi/websocat/releases/download/v1.12.0/websocat.x86_64-unknown-linux-musl \
95
- -O /usr/local/bin/websocat
96
- chmod +x /usr/local/bin/websocat
97
- '
98
- echo "::endgroup::"
99
-
100
- docker exec -it $container_id websocat --binary --one-message --exit-on-eof "ws://localhost:5901/" 2>&1 | tee -a /dev/stderr | \
101
- grep --quiet RFB && echo "Passed test" || { echo "Failed test" && TEST_OK=false; }
102
-
103
- echo "::group::websockify logs"
104
- docker exec $container_id bash -c "cat /tmp/websockify.log"
105
- echo "::endgroup::"
106
-
107
- echo "::group::vncserver logs"
108
- docker exec $container_id bash -c 'cat ~/.vnc/*.log'
109
- echo "::endgroup::"
88
+ python -mpip install -r dev-requirements.txt
89
+ python -mplaywright install --with-deps
110
90
111
- docker stop $container_id > /dev/null
112
- if [ "$TEST_OK" == "false" ]; then
113
- echo "One or more tests failed!"
114
- exit 1
115
- fi
116
-
117
- - name : Test project's proxy to websockify'ed vncserver
118
- if : always()
91
+ - name : Playwright browser test
119
92
run : |
120
93
container_id=$(docker run -d -it -p 8888:8888 -e JUPYTER_TOKEN=secret test)
121
94
sleep 3
95
+ export CONTAINER_ID=$container_id
96
+ export JUPYTER_HOST=http://localhost:8888
97
+ export JUPYTER_TOKEN=secret
122
98
123
- curl --silent --fail 'http://localhost:8888/desktop/?token=secret' | grep --quiet 'Jupyter Remote Desktop Proxy' && echo "Passed get index.html test" || { echo "Failed get index.html test" && TEST_OK=false; }
124
- curl --silent --fail 'http://localhost:8888/desktop/static/dist/viewer.js?token=secret' > /dev/null && echo "Passed get viewer.js test" || { echo "Failed get viewer.js test" && TEST_OK=false; }
125
-
126
- # The first attempt often fails, but the second always(?) succeeds.
127
- #
128
- # This could be related to jupyter-server-proxy's issue
129
- # https://github.com/jupyterhub/jupyter-server-proxy/issues/459
130
- # because the client/proxy websocket handshake completes before the
131
- # proxy/server handshake. This issue is tracked for this project by
132
- # https://github.com/jupyterhub/jupyter-remote-desktop-proxy/issues/105.
133
- #
134
- websocat --binary --one-message --exit-on-eof 'ws://localhost:8888/desktop-websockify/?token=secret' 2>&1 \
135
- | tee -a /dev/stderr \
136
- | grep --quiet RFB \
137
- && echo "Passed initial websocket test" \
138
- || { \
139
- echo "Failed initial websocket test" \
140
- && sleep 1 \
141
- && websocat --binary --one-message --exit-on-eof 'ws://localhost:8888/desktop-websockify/?token=secret' 2>&1 \
142
- | tee -a /dev/stderr \
143
- | grep --quiet RFB \
144
- && echo "Passed second websocket test" \
145
- || { echo "Failed second websocket test" && TEST_OK=false; } \
146
- }
99
+ python -mpytest -vs
147
100
148
101
echo "::group::jupyter_server logs"
149
102
docker logs $container_id
@@ -160,5 +113,10 @@ jobs:
160
113
exit 1
161
114
fi
162
115
163
- # TODO: Check VNC desktop works, e.g. by comparing Playwright screenshots
164
- # https://playwright.dev/docs/test-snapshots
116
+ - name : Upload screenshot
117
+ uses : actions/upload-artifact@v4
118
+ if : always()
119
+ with :
120
+ name : screenshots-${{ matrix.vncserver }}
121
+ path : screenshots/*
122
+ if-no-files-found : error
0 commit comments