Skip to content

Commit 4beaeed

Browse files
sinelawclaude
andcommitted
Fix file_permissions tests to wait for file content instead of UI message
The tests were timing out on macOS because they waited for "Saved" to appear on screen. Instead, wait for the actual file content to change on disk, which is the real effect we're testing for. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b11dc5d commit 4beaeed

1 file changed

Lines changed: 27 additions & 6 deletions

File tree

tests/e2e/file_permissions.rs

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,15 @@ fn test_save_preserves_file_permissions() {
3737
harness
3838
.send_key(KeyCode::Char('s'), KeyModifiers::CONTROL)
3939
.unwrap();
40-
// Wait for save to complete
41-
harness.wait_for_screen_contains("Saved").unwrap();
40+
// Wait for save to complete by checking file content changed
41+
let file_path_clone = file_path.clone();
42+
harness
43+
.wait_until(move |_| {
44+
std::fs::read_to_string(&file_path_clone)
45+
.map(|s| s.starts_with("modified "))
46+
.unwrap_or(false)
47+
})
48+
.unwrap();
4249

4350
// Verify permissions are preserved
4451
let final_mode = std::fs::metadata(&file_path).unwrap().permissions().mode() & 0o777;
@@ -81,8 +88,15 @@ fn test_save_preserves_executable_permission() {
8188
harness
8289
.send_key(KeyCode::Char('s'), KeyModifiers::CONTROL)
8390
.unwrap();
84-
// Wait for save to complete
85-
harness.wait_for_screen_contains("Saved").unwrap();
91+
// Wait for save to complete by checking file content changed
92+
let file_path_clone = file_path.clone();
93+
harness
94+
.wait_until(move |_| {
95+
std::fs::read_to_string(&file_path_clone)
96+
.map(|s| s.contains("echo world"))
97+
.unwrap_or(false)
98+
})
99+
.unwrap();
86100

87101
// Verify executable permission is preserved
88102
let final_mode = std::fs::metadata(&file_path).unwrap().permissions().mode() & 0o777;
@@ -124,8 +138,15 @@ fn test_save_preserves_restricted_permissions() {
124138
harness
125139
.send_key(KeyCode::Char('s'), KeyModifiers::CONTROL)
126140
.unwrap();
127-
// Wait for save to complete
128-
harness.wait_for_screen_contains("Saved").unwrap();
141+
// Wait for save to complete by checking file content changed
142+
let file_path_clone = file_path.clone();
143+
harness
144+
.wait_until(move |_| {
145+
std::fs::read_to_string(&file_path_clone)
146+
.map(|s| s.starts_with("more "))
147+
.unwrap_or(false)
148+
})
149+
.unwrap();
129150

130151
// Verify restricted permissions are preserved
131152
let final_mode = std::fs::metadata(&file_path).unwrap().permissions().mode() & 0o777;

0 commit comments

Comments
 (0)