diff options
Diffstat (limited to 'tmuxrdr/scripts/test-e2e')
| -rwxr-xr-x | tmuxrdr/scripts/test-e2e | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/tmuxrdr/scripts/test-e2e b/tmuxrdr/scripts/test-e2e index 7c82086e..0adaebc4 100755 --- a/tmuxrdr/scripts/test-e2e +++ b/tmuxrdr/scripts/test-e2e @@ -98,6 +98,8 @@ ws() { "${H[@]}" workspace list | jq -r '.result.workspaces[] | select(.focused) ws_label() { "${H[@]}" workspace list | jq -r '.result.workspaces[] | select(.focused) | .label'; } tab() { "${H[@]}" tab list --workspace "$(ws)" | jq -r '.result.tabs[] | select(.focused) | .tab_id'; } tab_pos() { "${H[@]}" tab list --workspace "$(ws)" | jq -r '[.result.tabs[] | .focused] | index(true) + 1'; } +ws_count() { "${H[@]}" workspace list | jq -r '.result.workspaces | length'; } +prompt() { "${T[@]}" send-keys -t e2e C-b :; sleep "$delay"; type_line "$1"; } tab_count() { "${H[@]}" tab list --workspace "$(ws)" | jq -r '.result.tabs | length'; } tab_panes() { "${H[@]}" pane list --workspace "$(ws)" | jq -r --arg t "${1:-$(tab)}" '[.result.panes[] | select(.tab_id == $t)] | length'; } @@ -113,8 +115,9 @@ done [[ "$(focus 2>/dev/null)" == w1:p1 ]] || die "herdr client did not come up" echo "herdr $("$herdr" --version | awk '{print $2}'), session $session, config copy of tmuxrdr/config/config.toml" -check 'config check: no unknown keys or bad bindings' \ - "$(HERDR_CONFIG_PATH="$cfg" "$herdr" config check 2>&1 | head -n 1)" "config: ok" +diagnostics="$(HERDR_CONFIG_PATH="$cfg" "$herdr" config check 2>&1)" +check 'config check: no unknown keys or bad bindings' "$(head -n 1 <<<"$diagnostics")" "config: ok" +[[ "$diagnostics" == "config: ok" ]] || sed 's/^/ /' <<<"$diagnostics" # --- panes ------------------------------------------------------------------- @@ -172,6 +175,9 @@ k C-b p; check 'prefix+p previous-window' "$(tab_pos)" 2 k C-b n; check 'prefix+n next-window' "$(tab_pos)" 3 k C-b 1; check 'prefix+1 select-window' "$(tab_pos)" 1 k C-b 3; check 'prefix+3 select-window' "$(tab_pos)" 3 +# ui.tab_style = "tmux": tmux's status line, the window before last flagged "-" +# and unnamed tabs called after their directory (/private/tmp). +check_seen 'tab row in tmux format: [session] #I:#W#F' '\[tmp\] 1:tmp- 2:tmp 3:tmp\*' k C-b 1 k C-b '!' check 'prefix+! break-pane' "$(tab_count) $(tab_panes) $(tab_panes w1:t1)" "4 1 3" @@ -195,6 +201,16 @@ k C-b '('; check 'prefix+( previous session' "$(ws_label)" tmp k C-b L; check 'prefix+L last session' "$(ws_label)" other k C-b L; check 'prefix+L toggles back' "$(ws_label)" tmp +# tmux's session commands, on workspaces, from the : prompt. +prompt 'new-session -s e2e-new'; check ':new-session -s creates and switches' "$(ws_label) $(ws_count)" "e2e-new 3" +prompt 'switch-client -t tmp'; check ':switch-client -t' "$(ws_label)" tmp +prompt 'new -A -s e2e-new'; check ':new -A switches to the existing one' "$(ws_label) $(ws_count)" "e2e-new 3" +prompt 'switch-client -p'; check ':switch-client -p' "$(ws_label)" other +prompt 'new-session -s tmp'; check_seen ':new-session on a taken name' 'duplicate session: tmp'; k x +prompt 'ls'; check_seen ':ls lists the sessions' 'e2e-new: [0-9]+ windows'; k x +prompt 'kill-session -t e2e-new'; check ':kill-session -t' "$(ws_count)" 2 +prompt 'switch-client -t tmp'; check ':switch-client -t back' "$(ws_label)" tmp + # --- prompts, choosers, modes ------------------------------------------------ "${T[@]}" send-keys -t e2e C-b :; check_seen 'prefix+: command prompt' '│:' @@ -243,11 +259,11 @@ fi # --- reload, then detach ----------------------------------------------------- k C-b ')' # "other": a workspace with a single tab -check_seen 'tab row before reload' '│ *1 +' +check_seen 'tab row before reload' '\[other\] 1:tmp\*' sed -i.bak 's/^hide_tab_bar_when_single_tab = false/hide_tab_bar_when_single_tab = true/' "$cfg" k C-b r check 'prefix+r reload hides the single tab row' \ - "$("${T[@]}" capture-pane -p -t e2e | sed -n 1p | grep -c -E '│ *1 +' | tr -d ' ')" 0 + "$("${T[@]}" capture-pane -p -t e2e | grep -c -E '\[other\] 1:tmp\*' | tr -d ' ')" 0 k C-b d; sleep 1 check 'prefix+d detach ends the client' "$("${T[@]}" has-session -t e2e 2>/dev/null && echo attached || echo detached)" detached |
