aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/e2e.sh21
1 files changed, 16 insertions, 5 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh
index b63260c..015d6aa 100755
--- a/tests/e2e.sh
+++ b/tests/e2e.sh
@@ -81,15 +81,20 @@ mkdir -p "$DIR/bin"
printf '#!/bin/sh\nexec sleep 100000\n' >"$DIR/bin/pi"
chmod +x "$DIR/bin/pi"
-t -f /dev/null new-session -d -s a -n wa1 -x 120 -y 40 "$DIR/bin/pi"
-t new-window -d -t a: -n wa2 "$DIR/bin/pi"
-t new-session -d -s b -n wb1 -x 120 -y 40 "$DIR/bin/pi"
-t new-session -d -s c -n wc1 -x 120 -y 40 "$DIR/bin/pi"
+t -f /dev/null new-session -d -s a -n wa1 -c "$DIR" -x 120 -y 40 "$DIR/bin/pi"
+t new-window -d -t a: -n wa2 -c "$DIR" "$DIR/bin/pi"
+t new-session -d -s b -n wb1 -c "$DIR" -x 120 -y 40 "$DIR/bin/pi"
+t new-session -d -s c -n wc1 -c "$DIR" -x 120 -y 40 "$DIR/bin/pi"
t set -g mouse on
A1=$(t display -p -t a:wa1 '#{pane_id}')
A2=$(t display -p -t a:wa2 '#{pane_id}')
B1=$(t display -p -t b:wb1 '#{pane_id}')
C1=$(t display -p -t c:wc1 '#{pane_id}')
+# pi titles its pane "π - <session name> - <cwd basename>", or "π - <dir>"
+D=$(basename "$DIR")
+t select-pane -t "$A1" -T "π - Deploy the widget - $D"
+t select-pane -t "$A2" -T "π - $D"
+t select-pane -t "$B1" -T "π - Review PR 42 - $D"
t new-session -d -s viewer -x 120 -y 40 "env -u TMUX tmux -u -L $SOCK attach -t b"
for _ in $(seq 50); do CLIENT=$(t list-clients -F '#{client_name}' | head -1); [ -n "$CLIENT" ] && break; sleep 0.1; done
[ -z "$CLIENT" ] && { echo "no client attached"; exit 1; }
@@ -108,6 +113,9 @@ expect "A1 idle on first sight" "opt $A1 @agent_state" idle
expect "A2 idle on first sight" "opt $A2 @agent_state" idle
expect "B1 idle on first sight" "opt $B1 @agent_state" idle
expect "queue empty" "gopt @dingger_queue" ""
+expect "A1 name from pi's title" "opt $A1 @agent_name" "Deploy the widget"
+expect "A2 unnamed pi session has no name" "opt $A2 @agent_name" ""
+expect "B1 name from pi's title" "opt $B1 @agent_name" "Review PR 42"
# --- 2. working, then completion away from the window -> done ----------------
echo "2. completion while away"
@@ -230,7 +238,10 @@ if [ -x "$MENUBAR" ]; then
hook "$A1" working; hook "$A1" idle
expect "A1 done" "opt $A1 @agent_state" done
expect "menu title" "mb --print | head -1" "title: ×1 ✓1"
- expect "menu rows in herdr priority order" "mb --print | tail -n +2 | cut -d' ' -f2,4 | tr '\n' ' '" "blocked a:wa2 done a:wa1 idle b:wb1 idle c:wc1 "
+ expect "menu rows: herdr priority, names as titles, harness when unnamed" \
+ "mb --print | tail -n +2 | cut -f1,2 | tr '\t\n' '|;'" "× blocked|pi;✓ done|Deploy the widget;○ idle|Review PR 42;○ idle|pi;"
+ expect "subtitle: location, harness, waiting time" "mb --print | grep 'Deploy the widget' | cut -f3" "a · wa1 · pi · done now"
+ expect "idle subtitle has no waiting time" "mb --print | grep 'Review PR 42' | cut -f3" "b · wb1 · pi"
mb --click "$A1"
expect "row click jumped to wa1" "client_window" wa1
expect "row click marked A1 idle" "opt $A1 @agent_state" idle