Skip to content

Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows

fix: require panel border in preview stability check to prevent flaky snapshots (#969)

Maximilian Roos2fe093aa4b60
diff --git a/tests/integration_tests/switch_picker.rs b/tests/integration_tests/switch_picker.rs
index 8790772b1..6126e2bc2 100644
--- a/tests/integration_tests/switch_picker.rs
+++ b/tests/integration_tests/switch_picker.rs
@@ -222,6 +222,9 @@ fn wait_for_stable(
/// If `expected_content` is provided, waits until the screen contains that string
/// AND has stabilized. This is essential for async preview panels where the initial
/// render may show placeholder content before the actual data loads.
+///
+/// Tip: include the panel border character (`│`) in `expected_content` to ensure
+/// the full TUI frame has rendered, not just the preview text content.
fn wait_for_stable_with_content(
rx: &mpsc::Receiver<Vec<u8>>,
parser: &mut vt100::Parser,
@@ -447,7 +450,7 @@ fn test_switch_picker_preview_panel_uncommitted(mut repo: TestRepo) {
&env_vars,
&[
("feature", None),
- ("1", Some("diff --git")), // Wait for diff to load
+ ("1", Some("│diff --git")), // Wait for diff to load (│ = border drawn)
("\x1b", None),
],
);
@@ -504,7 +507,7 @@ fn test_switch_picker_preview_panel_log(mut repo: TestRepo) {
&env_vars,
&[
("feature", None),
- ("2", Some("* ")), // Wait for git log output (starts with "* [hash]")
+ ("2", Some("│* ")), // Wait for git log output (│ = border drawn)
("\x1b", None),
],
);
@@ -594,7 +597,7 @@ fn test_new_feature() {
&env_vars,
&[
("feature", None),
- ("3", Some("diff --git")), // Wait for diff to load
+ ("3", Some("│diff --git")), // Wait for diff to load (│ = border drawn)
("\x1b", None),
],
);