Fix API test runner to use old headless Chromium mode for WebGL support#472
Fix API test runner to use old headless Chromium mode for WebGL support#472julianharty wants to merge 1 commit intoflipcomputing:mainfrom
Conversation
Playwright 1.44+ switched to a new headless shell binary that drops WebGL support. Tests that use Babylon.js (e.g. babylon, objects, materials) were failing locally on macOS with "WebGL not supported" because flock.scene was never initialised. Switching to headless:false with --headless=old restores the original headless Chromium mode which retains WebGL/WebGL2 support. This is consistent with what CI has been getting implicitly via the older Playwright build (v1193) it uses. Also fix tests/tests.html to load mocha and chai from local node_modules instead of unpkg.com CDN, which was blocked by the Vite dev server's Content-Security-Policy. Mocha is loaded as a classic script (UMD, sets window.mocha) and chai is imported as an ES module and assigned to window.chai. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR updates the test infrastructure by switching the Playwright browser launch configuration to legacy headless mode for WebGL support and migrating test framework dependencies from CDN-hosted to locally-installed packages via node_modules. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tests/tests.html (1)
78-78: Move<link>stylesheet to<head>for HTML validity.The Mocha stylesheet link is placed in the
<body>after the canvas element. While browsers render it, this isn't valid HTML5 and can cause a brief flash of unstyled content (FOUC) when mocha elements first appear.♻️ Suggested fix
Move line 78 into the
<head>section (e.g., after line 11):</style> + <link rel="stylesheet" href="/node_modules/mocha/mocha.css" /> </head> <body>And remove line 78 from its current location in the body.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@tests/tests.html` at line 78, The <link rel="stylesheet" href="/node_modules/mocha/mocha.css" /> tag is currently in the <body> after the canvas and needs to be moved into the <head> for valid HTML and to avoid FOUC; remove the duplicate from the body and insert that exact <link> element into the <head> section (for example, after existing head meta/styles) so the Mocha stylesheet loads before body content renders.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@tests/tests.html`:
- Line 78: The <link rel="stylesheet" href="/node_modules/mocha/mocha.css" />
tag is currently in the <body> after the canvas and needs to be moved into the
<head> for valid HTML and to avoid FOUC; remove the duplicate from the body and
insert that exact <link> element into the <head> section (for example, after
existing head meta/styles) so the Mocha stylesheet loads before body content
renders.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ccbc03bd-3da1-4e86-b69f-23b3f7a216aa
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
scripts/run-api-tests.mjstests/tests.html
Playwright 1.44+ switched to a new headless shell binary that drops WebGL support. Tests that use Babylon.js (e.g. babylon, objects, materials) were failing locally on macOS with "WebGL not supported" because flock.scene was never initialised.
Switching to
headless:falsewith--headless=oldrestores the original headless Chromium mode which retains WebGL/WebGL2 support. This is consistent with what CI has been getting implicitly via the older Playwright build (v1193) it uses.Also fix tests/tests.html to load mocha and chai from local node_modules instead of unpkg.com CDN, which was blocked by the Vite dev server's Content-Security-Policy. Mocha is loaded as a classic script (UMD, sets window.mocha) and chai is imported as an ES module and assigned to window.chai.
Summary by CodeRabbit
Tests
Chores