From 41e67e1edd778d70e03353fb34b76350fec0ddb1 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 20:56:35 +0000 Subject: [PATCH] Batch fix: the CLI snapshot test settles before its screenshots Under load (the full workspace suite) the photo grid was captured before its thumbnails rendered, darker than the export dialog dimmed over them, and the dimming comparison failed; it passes alone. Each screenshot now follows ui.settle. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01912WaK6Rmew3wxZuPyX7E8 --- apps/lightcraft-cli/tests/cli.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/lightcraft-cli/tests/cli.rs b/apps/lightcraft-cli/tests/cli.rs index 21fa6310d..d1b178e49 100644 --- a/apps/lightcraft-cli/tests/cli.rs +++ b/apps/lightcraft-cli/tests/cli.rs @@ -167,10 +167,14 @@ fn snapshot_subcommand_renders_the_ui_headlessly() { std::fs::write( &script, format!( - "# comment\n{}\n{}\n{}\n{}\n", + "# comment\n{}\n{}\n{}\n{}\n{}\n{}\n", json!({"method": "ui.set", "params": {"view": "photoGrid"}}), + // (settled: under load a grid shot taken before its thumbnails is darker than the + // dimmed export dialog over them, and the comparison below fails) + json!({"method": "ui.settle", "params": {"timeoutMs": 20000}}), json!({"method": "ui.screenshot"}), json!({"method": "engine.execute", "params": {"command": "dialog.export"}}), + json!({"method": "ui.settle", "params": {"timeoutMs": 20000}}), json!({"method": "ui.screenshot", "params": {"path": b.to_str().unwrap()}}), ), ) @@ -181,7 +185,7 @@ fn snapshot_subcommand_renders_the_ui_headlessly() { .unwrap(); assert!(o.status.success(), "{}", String::from_utf8_lossy(&o.stderr)); let replies: Vec = String::from_utf8_lossy(&o.stdout).lines().map(|l| serde_json::from_str(l).unwrap()).collect(); - assert_eq!(replies.len(), 4); + assert_eq!(replies.len(), 6); assert!(replies.iter().all(|r| r["ok"] == true), "{replies:?}"); for (p, dimmed) in [(&a, false), (&b, true)] { let d = lightcraft_codecs::decode(&std::fs::read(p).unwrap(), Default::default()).unwrap();