aboutsummaryrefslogtreecommitdiff
path: root/tests/e2e.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/e2e.sh')
-rwxr-xr-xtests/e2e.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/e2e.sh b/tests/e2e.sh
index 1a5cba0..983912c 100755
--- a/tests/e2e.sh
+++ b/tests/e2e.sh
@@ -18,6 +18,9 @@ set -u
ROOT=$(cd "$(dirname "$0")/.." && pwd)
DINGGER="${1:-$ROOT/target/release/dingger}"
MENUBAR="${2:-$ROOT/target/dingger-menu}"
+# tmux hooks run these from other directories: make them absolute.
+case "$DINGGER" in /*) ;; *) DINGGER="$PWD/$DINGGER" ;; esac
+case "$MENUBAR" in /*) ;; *) MENUBAR="$PWD/$MENUBAR" ;; esac
SOCK=dingger-e2e
DIR=$(mktemp -d /tmp/dingger-e2e.XXXXXX)
HOOK="$DIR/agent.sock"
@@ -327,6 +330,21 @@ expect "A2 done" "opt $A2 @agent_state" done
launchd_env "$DINGGER" focus
expect "dingger focus (jump shortcut) jumps, under launchd's PATH" "client_window" wa2
+# --- 15. agent search ----------------------------------------------------------
+echo "15. agent search"
+if [ -x "$MENUBAR" ]; then
+ mb() { DINGGER_TMUX_SOCKET="$SOCK" DINGGER_BIN="$DINGGER" "$MENUBAR" "$@"; }
+ expect "empty query lists every agent" "mb --print-search '' | tail -1 | cut -d' ' -f1,2" "4 agents"
+ expect "fuzzy name match, selected" "mb --print-search 'rvw42' | head -1 | cut -f1,2" "› ○ idle Review PR 42"
+ expect "every word must match" "mb --print-search 'deploy 42' | head -1" "No agents match 'deploy 42'"
+ expect "finds an agent by its window" "mb --print-search wc1 | head -1 | cut -f3" "c · wc1 · pi"
+ expect "finds agents by directory" "mb --print-search \"$(basename "$DIR")\" | tail -1 | cut -d' ' -f1,2" "4 agents"
+ hook "$A2" working
+ expect "status word ranks first" "mb --print-search working | head -1 | cut -f1" "› ◐ working"
+else
+ fail "menu bar binary not found at $MENUBAR"
+fi
+
echo
echo "$PASSES passed, $FAILS failed"
[ "$FAILS" -eq 0 ] || { echo "--- daemon log tail"; tail -30 "$DIR/daemon.log"; exit 1; }