From 81547af5c63227d1d3bc401252f4cfd257cd6e13 Mon Sep 17 00:00:00 2001 From: Bryan Helmkamp Date: Sun, 12 Apr 2026 14:54:28 -0400 Subject: [PATCH] Fix headless Chrome debug UI CI test --- .github/workflows/rust.yml | 4 ++++ test/twin/openai/tests/debug_ui.rs | 22 ++++++++++++++-------- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 20c210cf8..14a738134 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -5,18 +5,22 @@ on: branches: [main] paths: - "lib/crates/**" + - "test/**" - "Cargo.toml" - "Cargo.lock" - ".cargo/**" + - ".config/**" - "openapi/**" - ".github/workflows/rust.yml" pull_request: branches: [main] paths: - "lib/crates/**" + - "test/**" - "Cargo.toml" - "Cargo.lock" - ".cargo/**" + - ".config/**" - "openapi/**" - ".github/workflows/rust.yml" workflow_dispatch: diff --git a/test/twin/openai/tests/debug_ui.rs b/test/twin/openai/tests/debug_ui.rs index c2cf0006c..bae437792 100644 --- a/test/twin/openai/tests/debug_ui.rs +++ b/test/twin/openai/tests/debug_ui.rs @@ -300,14 +300,20 @@ async fn debug_page_renders_in_headless_chrome() { "/tmp/twin-openai-debug-screenshot-{}.png", std::process::id() ); - let output = std::process::Command::new(chrome_binary) - .args([ - "--headless", - "--disable-gpu", - &format!("--screenshot={screenshot_path}"), - "--window-size=1280,900", - &format!("{}/__debug", server.base_url), - ]) + let mut command = std::process::Command::new(chrome_binary); + command.args([ + "--headless", + "--disable-gpu", + &format!("--screenshot={screenshot_path}"), + "--window-size=1280,900", + ]); + if cfg!(target_os = "linux") { + // Ubuntu 24.04 GitHub runners block Chrome's default sandbox unless it + // is launched with a compatible user namespace or disabled explicitly. + command.arg("--no-sandbox"); + } + let output = command + .arg(format!("{}/__debug", server.base_url)) .output() .expect("Chrome should run");