Improve application help

This commit is contained in:
2026-10-29 00:01:35 +02:00
parent 4960c65f65
commit 23d6180f24
6 changed files with 1126 additions and 48 deletions
+26 -4
View File
@@ -171,7 +171,7 @@ fn terminal_pty_smoke() {
let app = wireguard_admin::app::Application::open(fixture.store, states)
.expect("synthetic application opens");
let resize = thread::spawn(|| {
thread::sleep(Duration::from_millis(40));
thread::sleep(Duration::from_millis(230));
assert!(
Command::new("stty")
.args(["cols", "40", "rows", "8"])
@@ -219,14 +219,28 @@ fn terminal_pty_smoke() {
.expect("start isolated pseudo-terminal");
use std::io::Write as _;
let mut input = child.stdin.take().expect("script stdin");
let exit_key = thread::spawn(move || {
let help_workflow = thread::spawn(move || {
thread::sleep(Duration::from_millis(180));
for key in [
b"?".as_slice(),
b"\x1b[B",
b"\x1b[6~",
b"\x1b[A",
b"\x1b[5~",
b"?",
b"\x1b",
] {
input.write_all(key).expect("send Help navigation key");
input.flush().expect("flush Help navigation key");
thread::sleep(Duration::from_millis(35));
}
thread::sleep(Duration::from_millis(70));
input
.write_all(b"\x03")
.expect("send handled Ctrl-C interruption to synthetic TUI");
.expect("send handled Ctrl-C exit to synthetic TUI");
});
let output = child.wait_with_output().expect("collect PTY result");
exit_key.join().expect("exit input completes");
help_workflow.join().expect("Help input completes");
assert!(
output.status.success(),
"synthetic PTY child exits successfully"
@@ -248,6 +262,14 @@ fn terminal_pty_smoke() {
transcript.contains("\u{1b}[?25h"),
"cursor restored after TUI"
);
assert!(
transcript.contains("Help "),
"synthetic PTY entered the Help panel"
);
assert!(
transcript.contains("PgUp/PgDn"),
"Help footer advertised page navigation"
);
}
fn shell_quote(value: &str) -> String {