Skip to content

Craft Anything: understand how any software works, and craft your own.

Rust

The pictures UI test waits for the worker that checks their sizes (#743)

Tanish Mankubb66fa576a9f
diff --git a/crates/ui-egui/tests/smoke.rs b/crates/ui-egui/tests/smoke.rs
index 1a46e39e..8ce9c97d 100644
--- a/crates/ui-egui/tests/smoke.rs
+++ b/crates/ui-egui/tests/smoke.rs
@@ -505,7 +505,8 @@ fn pictures_of_the_original_go_with_the_draft_then_into_the_project() {
// "Nothing — start fresh" is picked: the request box offers pictures (not for websites).
h.get_by_label("Add pictures of the original (optional: screenshots help it look right)");
h.state_mut().add_pictures(vec![pic.clone(), notes, pic.clone()]);
- h.run_steps(3);
+ // Their sizes are checked on a worker first (#720).
+ assert!(wait(&mut h, |a| !a.state.make.pictures.is_empty()), "checked on a worker, then added");
assert_eq!(h.state().state.make.pictures, vec![pic.clone()], "pictures only, once each");
h.get_by_label("original.webp");
h.get_by_label("Remove original.webp").click();
diff --git a/docs/pitfalls.md b/docs/pitfalls.md
index 7779ad0f..db76ad2e 100644
--- a/docs/pitfalls.md
+++ b/docs/pitfalls.md
@@ -103,6 +103,11 @@ same temp directory, and game detection walked up and found the game. Give each
For a refactor that must keep output identical, dump the outputs for every combination before and
after and compare them byte for byte (done for every brief across 162 combinations in R1.1).
+**A step moved to a worker, its test still counting frames.** #720 moved the picture size check
+off the UI thread; a UI test that added pictures, ran three frames and then looked kept passing on
+fast machines and failed in CI on unrelated PRs. When work moves to a worker, grep the tests that
+call it and make them `wait` for the result, not `run_steps(n)`.
+
## Building and running
**A model catalogue queried in the wrong project.** OpenCode V2's raw `api get /api/model` does