test: check what a real terminal renders for multi, zellij, and the TUI
tests/16-render.sh runs tmux, zellij, and the TUI in xterm on Xvfb, takes screenshots, and reads them back with tesseract: remote prompts in all panes, borders and titles with the hosts, [SYNC] appearing and disappearing, panes side by side, broadcast output in every pane and input in one pane only without it, windows split by panes_per_window, the status bar, and TUI marks. Screenshots stay in testenv/.artifacts. OCR reads three preprocessing variants (plain, stretched for dim gray, brightest channel for colored text) and normalizes characters that DejaVu Sans Mono makes ambiguous (1/l, C/(). The screenshots showed tmux cutting the session name in the status bar to "[netssh-pv"; netssh multi now widens status-left-length for its own session. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a31aab4110
commit
699b9469b6
12 files changed
+194
-5
No files matched your search
@@ -0,0 +1,75 @@
|
||||
# What a user sees: tmux, zellij, and the TUI rendered by a real terminal
|
||||
# emulator (xterm on Xvfb), checked by OCR of screenshots. The screenshots stay
|
||||
# in testenv/.artifacts/ for a look by eye.
|
||||
config <<'EOF'
|
||||
resolver:
|
||||
strategies: [management_subnet, primary_ip]
|
||||
management_subnets: [10.231.1.0/24]
|
||||
ssh: {default_user: ops}
|
||||
groups:
|
||||
pve: ["cluster:pve-fsn1"]
|
||||
EOF
|
||||
check "refresh" netssh cache refresh
|
||||
export TMUX_TMPDIR="$HOME/tmux"
|
||||
mkdir -p "$TMUX_TMPDIR" "$HOME/.config/zellij"
|
||||
printf 'show_startup_tips false\nshow_release_notes false\n' >"$HOME/.config/zellij/config.kdl"
|
||||
start_screen && ok "X server and xterm" || bad "X server and xterm" "Xvfb did not start"
|
||||
|
||||
p1=fsn/fsn1-pve1.hoster.test p2=fsn/fsn1-pve2.hoster.test p3=fsn/fsn1-pve3.hoster.test
|
||||
prompts() { screen_shows "$1" "fsn1-pve1:~\$" "fsn1-pve2:~\$" "fsn1-pve3:~\$"; }
|
||||
# Two hosts on one OCR line means their panes sit side by side (tiled grid).
|
||||
side_by_side() { screen_text "$1" | ocr_norm | grep -F "$(printf %s "$2" | ocr_norm)" | grep -qF "$(printf %s "$3" | ocr_norm)"; }
|
||||
visible() { # NAME SHOT TEXT... — wait until the screen shows every TEXT
|
||||
local name=$1 shot=$2
|
||||
shift 2
|
||||
if wait_for 30 screen_shows "$shot" "$@"; then ok "$name"; else bad "$name" "$(screen_text "$shot")"; fi
|
||||
}
|
||||
|
||||
# --- tmux, started from a plain terminal: new session, attached in xterm ---
|
||||
term netssh multi --sync @pve
|
||||
visible "tmux: three remote shells on screen" tmux-1 "fsn1-pve1:~\$" "fsn1-pve2:~\$" "fsn1-pve3:~\$"
|
||||
visible "tmux: borders show host and [SYNC]" tmux-1 "$p1 [SYNC]" "$p2 [SYNC]" "$p3 [SYNC]"
|
||||
side_by_side tmux-1 "$p1" "$p2" && ok "tmux: tiled, first two panes side by side" || bad "tmux: tiled, first two panes side by side" "$(screen_text tmux-1)"
|
||||
tmux send-keys -t netssh-pve "echo typed-once-\$(hostname)" Enter
|
||||
visible "tmux: broadcast output in every pane" tmux-2 "typed-once-fsn1-pve1" "typed-once-fsn1-pve2" "typed-once-fsn1-pve3"
|
||||
tmux set-window-option -t netssh-pve synchronize-panes off
|
||||
tmux send-keys -t netssh-pve "echo just-this-pane" Enter
|
||||
sleep 1
|
||||
shot tmux-3
|
||||
[ "$(screen_count tmux-3 "just-this-pane")" = 2 ] && ok "tmux: without broadcast only one pane gets input" || bad "tmux: without broadcast only one pane gets input" "$(screen_text tmux-3)"
|
||||
shows_sync() { screen_shows tmux-3 "[SYNC]"; }
|
||||
shows_sync && bad "tmux: [SYNC] disappears when broadcast is off" "$(screen_text tmux-3)" || ok "tmux: [SYNC] disappears when broadcast is off"
|
||||
tmux kill-server
|
||||
|
||||
# --- more hosts than panes_per_window: further windows ---
|
||||
sed -i 's/^groups:/multi: {panes_per_window: 2}\ngroups:/' "$XDG_CONFIG_HOME/netssh.yaml"
|
||||
term netssh multi @pve
|
||||
visible "tmux: hosts split over windows pve-1 and pve-2" tmux-windows "pve-1" "pve-2"
|
||||
visible "tmux: status bar shows the whole session name" tmux-windows "[netssh-pve]"
|
||||
tmux kill-server
|
||||
sed -i '/^multi: {panes_per_window: 2}$/d' "$XDG_CONFIG_HOME/netssh.yaml"
|
||||
|
||||
# --- zellij: generated grid layout, broadcast through the sync tab ---
|
||||
term netssh multi --zellij @pve
|
||||
visible "zellij: three remote shells on screen" zellij-1 "fsn1-pve1:~\$" "fsn1-pve2:~\$" "fsn1-pve3:~\$"
|
||||
visible "zellij: pane titles show the hosts" zellij-1 "$p1" "$p2" "$p3"
|
||||
side_by_side zellij-1 "$p1" "$p2" && ok "zellij: grid, first two panes side by side" || bad "zellij: grid, first two panes side by side" "$(screen_text zellij-1)"
|
||||
session=$(zellij list-sessions --short --no-formatting 2>/dev/null | head -1)
|
||||
zellij --session "$session" action toggle-active-sync-tab
|
||||
zellij --session "$session" action write-chars 'echo zellij-$(hostname)'
|
||||
zellij --session "$session" action write 13
|
||||
visible "zellij: broadcast output in every pane" zellij-2 "zellij-fsn1-pve1" "zellij-fsn1-pve2" "zellij-fsn1-pve3"
|
||||
zellij kill-all-sessions --yes >/dev/null 2>&1
|
||||
|
||||
# --- TUI: mark hosts, open them together ---
|
||||
term tmux new-session -s tui netssh
|
||||
visible "TUI: search screen" tui-1 "Search hostname"
|
||||
tmux send-keys -t tui "pve"
|
||||
visible "TUI: results listed" tui-2 "$p1" "$p2" "$p3"
|
||||
tmux send-keys -t tui C-a
|
||||
visible "TUI: all marked" tui-3 "3 marked"
|
||||
tmux send-keys -t tui Enter
|
||||
visible "TUI: marked hosts open side by side" tui-4 "fsn1-pve1:~\$" "fsn1-pve2:~\$" "fsn1-pve3:~\$"
|
||||
tmux kill-server
|
||||
|
||||
stop_screen
|
||||
Reference in new issue
Block a user