Skip to content

armgit / 67.js

Public Imported from GitHub
0

3D engine that AI agents drive

Fall back to the runner's Chrome in the shared dev-server browser helper (#779)

Nguyen Xuan An0d1a71752474
diff --git a/tests/helpers/dev-server-browser.js b/tests/helpers/dev-server-browser.js
index d4ee0a9f..ecca9f32 100644
--- a/tests/helpers/dev-server-browser.js
+++ b/tests/helpers/dev-server-browser.js
@@ -22,6 +22,15 @@ async function startServer(port) {
return server;
}
+// Playwright's own browser download is not installed on CI, so fall back to the Google Chrome the runner already has.
+async function launchChrome(chromium) {
+ try {
+ return await chromium.launch({ headless: true, args: CHROME_ARGUMENTS });
+ } catch {
+ return chromium.launch({ headless: true, channel: 'chrome', args: CHROME_ARGUMENTS });
+ }
+}
+
/**
* Runs `body(page)` on the dev server's page in headless Chrome and cleans up.
* Where Chrome or playwright is missing the test skips on a developer machine and fails on CI, where Chrome is required.
@@ -43,7 +52,7 @@ export async function withDevServerPage(testContext, body) {
let browser;
try {
try {
- browser = await chromium.launch({ headless: true, args: CHROME_ARGUMENTS });
+ browser = await launchChrome(chromium);
} catch (error) {
skipOrThrow(`Chrome did not start: ${error.message.split('\n')[0]}`);
return;