diff options
Diffstat (limited to 'tests/pi-live.sh')
| -rwxr-xr-x | tests/pi-live.sh | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/pi-live.sh b/tests/pi-live.sh index de35bc5..3f4b4b8 100755 --- a/tests/pi-live.sh +++ b/tests/pi-live.sh @@ -7,8 +7,9 @@ # tests/pi-live.sh <pi binary> [dingger binary] # # Covers: identification, the extension's state and session reports, a turn -# (working, then done), /reload, an extension's blocked event, screen -# detection for a pi without the extension, restore (`pi --session`), exit. +# (working, then done), /reload, an extension's blocked event, /importance, +# screen detection for a pi without the extension, restore (`pi --session`, +# importance included), exit. set -u PI_BIN=$(cd "$(dirname "$1")" && pwd)/$(basename "$1") ROOT=$(cd "$(dirname "$0")/.." && pwd) @@ -65,7 +66,9 @@ ln -s "$PI_BIN" "$D/bin/pi" # Plain shells: a login shell would read the user's profile, which puts the # user's own pi first on PATH. printf 'set -g default-shell /bin/sh\nset -g default-command /bin/sh\n' >"$D/tmux.conf" -export PATH="$D/bin:$PATH" PI_OFFLINE=1 PI_SKIP_VERSION_CHECK=1 PI_TELEMETRY=0 +# Every pi here uses the test's agent directory, including one a restore +# starts (`pi --session`, without the command line's own variables). +export PATH="$D/bin:$PATH" PI_CODING_AGENT_DIR="$D/agent" PI_OFFLINE=1 PI_SKIP_VERSION_CHECK=1 PI_TELEMETRY=0 export DINGGER_TMUX_SOCKET="$R" DINGGER_AGENT_SOCKET="$D/hook.sock" DINGGER_STATE_DIR="$D/state" DINGGER_TMUX_CONFIG="$D/tmux.conf" t -f "$D/tmux.conf" new-session -d -s main -n agent -x 140 -y 40 -c "$D/work" t new-window -d -t main: -n plain -c "$D/work2" @@ -104,6 +107,11 @@ type_line agent "/ask" sleep 1.5 note "during a pi confirm dialog dingger shows: $(st agent) (pi gives extensions no dialog event)" t send-keys -t main:agent Escape +sleep 0.5 +type_line agent "/importance high" +expect "/importance high: the pane option" "t show -pv -t main:agent @dingger_importance 2>/dev/null" high 50 +expect "and pi's footer (its last line)" "t capture-pane -p -t main:agent | grep -v '^ *$' | tail -1 | sed 's/^ *//'" "importance: high" 30 +expect "saved in the session file" "grep -c '\"customType\":\"dingger-importance\"' \"\$(t show -pv -t main:agent @agent_session)\"" 1 30 echo "2. screen detection (pi without the extension)" t send-keys -t main:plain "PI_CODING_AGENT_DIR=$D/agent-plain pi $NO_MCP" Enter @@ -125,6 +133,7 @@ expect "restore resumes it by its session file" "grep -c -- \"resume .*pi --sess expect "resumed 1 of 1 agents" "grep -c '^resumed 1 of 1 agents' $D/restore.out" 1 expect "it runs again, reporting the same session" "t show -pv -t main:agent @agent_session 2>/dev/null" "$SESSION" 150 expect "with its conversation" "t capture-pane -p -t main:agent -S - | grep -c 'slow 3 hello'" 1 50 +expect "and its importance" "t show -pv -t main:agent @dingger_importance 2>/dev/null" high 50 echo "4. exit" t send-keys -t main:agent C-d |
