Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

test(cua-driver): retry transient harness CDP target reads; report invalid E2E evidence without a panic (#5164)

Francesco Bonacci5e607bc5d7bc
diff --git a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rs b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rs
index 04ae655746..f8b1e240f0 100644
--- a/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-e2e/tests/standalone_browser_behavior_test.rs
@@ -626,8 +626,21 @@ fn navigate_initial_page(port: u16, server: &BrowserFixtureServer) {
let mut last_error = None;
let mut last_navigate = None;
loop {
- let targets = browser_http_json(port, "/json/list")
- .unwrap_or_else(|error| panic!("read harness CDP targets: {error}"));
+ // A freshly launched browser's DevTools HTTP server can stall or
+ // drop one request while it finishes first-run setup (seen on Windows
+ // Edge). Retry inside the same bounded deadline instead of failing the
+ // case on a single transient read.
+ let targets = match browser_http_json(port, "/json/list") {
+ Ok(targets) => targets,
+ Err(error) => {
+ assert!(
+ Instant::now() < deadline,
+ "read harness CDP targets: {error}"
+ );
+ thread::sleep(Duration::from_millis(250));
+ continue;
+ }
+ };
let pages = targets
.as_array()
.into_iter()
diff --git a/libs/cua-driver/rust/crates/cua-driver-testkit/src/bin/cua-e2e-report.rs b/libs/cua-driver/rust/crates/cua-driver-testkit/src/bin/cua-e2e-report.rs
index 84a2ff411d..a4e57ec53a 100644
--- a/libs/cua-driver/rust/crates/cua-driver-testkit/src/bin/cua-e2e-report.rs
+++ b/libs/cua-driver/rust/crates/cua-driver-testkit/src/bin/cua-e2e-report.rs
@@ -98,13 +98,18 @@ fn main() {
}
environment_record = Some(record);
}
- let summary = validate_catalog(
+ let summary = match validate_catalog(
&declarations,
&results,
artifact_root.as_deref(),
require_video,
- )
- .unwrap_or_else(|errors| panic!("invalid E2E report:\n{}", errors.join("\n")));
+ ) {
+ Ok(summary) => summary,
+ Err(errors) => {
+ eprintln!("invalid E2E report:\n{}", errors.join("\n"));
+ std::process::exit(1);
+ }
+ };
let markdown = summary.markdown_with_declarations_source_and_environment(
&declarations,
&results,