@@ -113,6 +113,23 @@ jobs:
113113 e2e-tests :
114114 needs : [prepare, build-validation]
115115 runs-on : ubuntu-latest
116+ # Use Cypress's official browsers image: ships Node + Chrome + Firefox + Edge + Xvfb
117+ # + all GTK/NSS/font system libs preinstalled, removing the need for a custom
118+ # apt-get + Google Chrome bootstrap step. Node is then normalised to the version
119+ # in .nvmrc via actions/setup-node below.
120+ container :
121+ # Use cypress/browsers:latest โ this keeps Chrome/Firefox/Edge/Xvfb on a
122+ # rolling release, and `actions/setup-node` below normalises Node to the
123+ # major pinned in .nvmrc (currently 26). We deliberately accept the
124+ # rolling browser version over digest-pinning because .nvmrc is a Node
125+ # major (26), not a patch, so attempting to also pin the container's Node
126+ # patch would just be silently overridden by setup-node and create a
127+ # misleading impression of full reproducibility.
128+ image : cypress/browsers:latest
129+ # Run as root so actions/setup-node cache writes and Cypress binary cache
130+ # writes work without permission issues. The cypress/browsers image's
131+ # default USER is non-root.
132+ options : --user root
116133 # Needs write permissions to upload artifacts
117134 permissions :
118135 contents : write # Required to check out code
@@ -126,60 +143,22 @@ jobs:
126143 XKB_DEFAULT_MODEL : pc105
127144 XKB_DEFAULT_LAYOUT : us
128145 steps :
129- - name : Harden the runner (Audit all outbound calls)
130- uses : step-security/harden-runner@a5ad31d6a139d249332a2605b85202e8c0b78450 # v2.19.1
131- with :
132- egress-policy : audit
146+ # NOTE: step-security/harden-runner does not support container jobs, so it
147+ # is intentionally omitted here. Egress hardening for E2E browser traffic
148+ # would block legitimate test traffic anyway.
133149
134150 - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
135151 - uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
136152 with :
137153 node-version-file : ' .nvmrc'
138154 cache : " npm"
139155
140- - name : Cache APT packages
141- uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
142- with :
143- path : /var/cache/apt/archives
144- key : v2-${{ runner.os }}-apt-chrome-${{ hashFiles('.github/workflows/test-and-report.yml') }}
145- restore-keys : |
146- v2-${{ runner.os }}-apt-chrome-
147-
148- - name : Setup Three.js Test Environment
149- timeout-minutes : 10
156+ - name : Print browser versions
150157 run : |
151- echo "๐ง Setting up Three.js test environment with optimized Chrome flags..."
152-
153- # Install all required dependencies for E2E testing
154- sudo DEBIAN_FRONTEND=noninteractive apt-get update -qq
155- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
156- xvfb dbus-x11 graphviz \
157- libgtk2.0-0 libgtk-3-0 libgbm-dev libgbm1 \
158- libnotify-dev libnss3 libxss1 \
159- libxtst6 xauth \
160- fonts-noto fonts-noto-cjk fonts-noto-cjk-extra \
161- ca-certificates fonts-liberation curl gnupg \
162- libatk-bridge2.0-0 libatk1.0-0 \
163- libcups2 libdbus-1-3 libdrm2 \
164- libnspr4 libx11-xcb1 libxcomposite1 \
165- libxdamage1 libxfixes3 libxrandr2 \
166- libxrender1 libxshmfence1 xdg-utils libxkbcommon0 xkb-data
167-
168- # Install Chrome for Three.js WebGL support using signed keyring (modern method)
169- curl -fsSL --retry 3 --retry-delay 5 --connect-timeout 30 \
170- https://dl.google.com/linux/linux_signing_key.pub \
171- | sudo gpg --dearmor -o /usr/share/keyrings/google-chrome-keyring.gpg
172- echo "deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome-keyring.gpg] https://dl.google.com/linux/chrome/deb/ stable main" \
173- | sudo tee /etc/apt/sources.list.d/google-chrome.list > /dev/null
174- sudo DEBIAN_FRONTEND=noninteractive apt-get update -qq
175- sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends google-chrome-stable
176-
177- # Setup D-Bus
178- sudo mkdir -p /var/run/dbus
179- sudo dbus-daemon --system --fork
180-
181- echo "โ
Three.js test environment ready"
182- google-chrome --version
158+ echo "Node: $(node --version)"
159+ google-chrome --version || true
160+ # cypress/browsers ships Xvfb (used by Cypress's bundled @cypress/xvfb).
161+ command -v Xvfb >/dev/null 2>&1 && echo "Xvfb available" || echo "Xvfb missing"
183162
184163 - name : Cache Cypress binary
185164 uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
@@ -200,13 +179,16 @@ jobs:
200179 echo "๐ Starting Three.js E2E test execution at $(date +%T)"
201180 echo "๐ Configuration:"
202181 echo " - Chrome: $(google-chrome --version)"
203- echo " - Node memory: 4GB heap"
182+ echo " - Node: $(node --version) ( memory: 4GB heap) "
204183 echo " - Display: $DISPLAY"
205184 echo " - Target: 10-12 minute execution"
206185 echo ""
207186 START_TIME=$(date +%s) || START_TIME=0
208- # Run tests - xvfb-run handles display setup
209- NODE_OPTIONS="--max-old-space-size=4096" xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24 -ac +extension GLX +extension RANDR +render -nolisten tcp" npm run test:e2e || TEST_EXIT_CODE=$?
187+ # cypress/browsers image ships Xvfb but NOT xauth, so the xvfb-run
188+ # wrapper fails with "xauth command not found". Cypress's bundled
189+ # @cypress/xvfb spawns Xvfb directly (no xauth needed) when DISPLAY
190+ # is unset, so we just call npm run test:e2e and let Cypress manage it.
191+ NODE_OPTIONS="--max-old-space-size=4096" npm run test:e2e || TEST_EXIT_CODE=$?
210192 END_TIME=$(date +%s) || END_TIME=$START_TIME
211193 if [ "$START_TIME" -ne 0 ]; then
212194 DURATION=$((END_TIME - START_TIME))
0 commit comments