aboutsummaryrefslogtreecommitdiff
path: root/tests/e2e.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/e2e.sh')
-rwxr-xr-xtests/e2e.sh41
1 files changed, 40 insertions, 1 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh
index 670f84a..75dbc31 100755
--- a/tests/e2e.sh
+++ b/tests/e2e.sh
@@ -250,7 +250,10 @@ if [ -x "$MENUBAR" ]; then
expect "menu title" "mb --print | head -1" "title: ×1 ✓1"
expect "menu rows: herdr priority; idle most recent first (C1 since its jump in step 4, B1 since the start)" \
"mb --print | tail -n +2 | cut -f1,2 | tr '\t\n' '|;'" "× blocked|pi;✓ done|Deploy the widget;○ idle|pi;○ idle|Review PR 42;"
- hook "$B1" working; hook "$B1" idle
+ # Wait for working: B1 was idle before, so idle alone would not show the turn.
+ hook "$B1" working
+ expect "B1 working" "opt $B1 @agent_state" working
+ hook "$B1" idle
expect "B1 finishes a turn while watched: idle" "opt $B1 @agent_state" idle
expect "and is now the most recent idle agent: listed first" \
"mb --print | tail -n +2 | cut -f1,2 | tr '\t\n' '|;'" "× blocked|pi;✓ done|Deploy the widget;○ idle|Review PR 42;○ idle|pi;"
@@ -618,6 +621,7 @@ expect "claude is detected" "r show -pv -t '=cc:talked' @agent 2>/dev/null; r sh
claude" 80
expect "its hook's session is kept on its pane" "r show -pv -t $TALKED @agent_session 2>/dev/null" "$W/claude/talked.jsonl" 80
expect "snapshot: claude's session" "in_snapshot '\"session\": \"$W/claude/talked.jsonl\"'" True 80
+expect "snapshot: the command line of the claude without a transcript" "in_snapshot '\"command\": \"claude fresh\"'" True 80
r kill-server
expect "a new restore candidate" \
"python3 -c 'import json,sys; print(\"cc\" in [s[\"name\"] for s in json.load(open(sys.argv[1]))[\"snapshot\"][\"sessions\"]])' $STATE2/restore.json 2>/dev/null" True 80
@@ -634,6 +638,41 @@ expect "the resumed claude reports its session again" \
"r show -pv -t '=cc:talked' @agent_session 2>/dev/null" "$W/claude/talked.jsonl" 80
[ "$FAILS" -gt 0 ] && { echo "--- restore-cc:"; cat "$DIR/restore-cc.out"; }
+# --- 19. a session group: its panes once, its windows saved once -------------
+echo "19. session group"
+start_viewer
+r new-session -d -s grp -n agent -c "$W/one"
+r new-window -d -t '=grp:' -n other -c "$W/two"
+r new-session -d -t grp -s grp-2
+r send-keys -t '=grp:agent' 'pi' Enter
+GA=$(r display -p -t '=grp:agent' '#{pane_id}')
+expect "the group's agent is detected" "r show -pv -t $GA @agent 2>/dev/null" pi 80
+expect "dingger status lists it once" "renv \"$DINGGER\" status | grep -c ' grp'" 1
+expect "the menu lists it once" "mbr --print | grep -c 'grp'" 1
+# Watched only through grp-2: grp shows another window, nobody attaches it.
+r select-window -t '=grp:other'
+r select-window -t '=grp-2:agent'
+r switch-client -c "$(r list-clients -F '#{client_name}' | head -1)" -t '=grp-2'
+touch "$W/sessions/grp.jsonl"
+# Wait for working: the agent was idle before, so idle alone would not show the turn.
+hook2 "$GA" working "$W/sessions/grp.jsonl"
+expect "the group's agent working" "r show -pv -t $GA @agent_state" working 80
+hook2 "$GA" idle "$W/sessions/grp.jsonl"
+expect "a turn finished while watched through grp-2 is idle, not done" "r show -pv -t $GA @agent_state" idle 80
+expect "snapshot: the group is saved once" \
+ "python3 -c 'import json,sys; print(sorted(s[\"name\"] for s in json.load(open(sys.argv[1]))[\"sessions\"] if s[\"name\"].startswith(\"grp\")))' \"\$(latest_snapshot)\"" \
+ "['grp']" 80
+expect "snapshot: with the agent's session" "in_snapshot '\"session\": \"$W/sessions/grp.jsonl\"'" True 80
+r kill-server
+expect "the candidate: the group once" \
+ "python3 -c 'import json,sys; print(sorted(s[\"name\"] for s in json.load(open(sys.argv[1]))[\"snapshot\"][\"sessions\"] if s[\"name\"].startswith(\"grp\")))' $STATE2/restore.json 2>/dev/null" "['grp']" 80
+expect "dry run plans the group once" "renv \"$DINGGER\" restore --dry-run 2>/dev/null | grep -E '^[a-z]+ +grp' | cut -c1-14" "create grp: "
+: >"$DIR/pi-args"
+renv "$DINGGER" restore --session grp >"$DIR/restore-grp.out" 2>&1
+expect "restore: the agent is resumed once" "grep -c -- '--session $W/sessions/grp.jsonl' $DIR/pi-args" 1
+expect "with both windows" "r list-windows -t '=grp' -F '#{window_name}' | tr '\n' ' '" "agent other "
+expect "no real agent runs in a test pane (group)" "real_agents" ""
+
# Every daemon this run started must stop with it.
kill "$DAEMON_PID" "$DAEMON2_PID" 2>/dev/null
expect "the test daemons stop" "ps -o pid= -p $DAEMON_PID,$DAEMON2_PID | wc -l | tr -d ' '" 0