SPB Git

Repository Public

smoke-test.sh 2.6 KB 47 lines shellscript

1#!/bin/bash2# Repeatable UI smoke test driven through System Events (XCUITest automation mode is unavailable on3# this Xcode 27.2 / macOS 27.0 combination). Requires Accessibility permission for the invoking terminal.4# Launches a *fresh* workspace in an isolated data directory, splits panes, types into them and verifies5# that each pane owns a distinct PTY and that typed text reached only the focused pane.6set -euo pipefail7cd "$(dirname "$0")/.."8APP="${1:-build/DerivedData/Build/Products/Debug/NEXTERM.app}"9DATA=$(mktemp -d /tmp/nexterm-smoke.XXXX)10PANES="${PANES:-8}"11pkill -x NEXTERM 2>/dev/null || true; sleep 0.512open "$APP" --args -NEXTERMDataDir "$DATA" -NEXTERMFreshWorkspace 113sleep 414NX=$(pgrep -x NEXTERM | head -1)15[ -n "$NX" ] || { echo "FAIL: app not running"; exit 1; }16osascript -e 'tell application "NEXTERM" to activate' -e 'delay 1'17for i in $(seq 2 "$PANES"); do18  if [ $((i % 2)) -eq 0 ]; then item="Split Right"; else item="Split Down"; fi19  osascript -e "tell application \"System Events\" to tell process \"NEXTERM\" to click menu item \"$item\" of menu \"Shell\" of menu bar 1" >/dev/null20  sleep 0.621done22sleep 123# Type a marker into each pane in DFS order using "Focus Next Pane".24for i in $(seq 1 "$PANES"); do25  # No '>' or '|' (not plain keys on every layout): record the pane's tty as a symlink target.26  osascript -e "tell application \"System Events\" to tell process \"NEXTERM\" to keystroke \"ln -s \$(tty) $DATA/pane$i\" & return" >/dev/null27  sleep 0.428  osascript -e 'tell application "System Events" to tell process "NEXTERM" to click menu item "Focus Next Pane" of menu "Pane" of menu bar 1' >/dev/null29  sleep 0.330done31sleep 1.532CHILDREN=$(pgrep -P "$NX" | wc -l | tr -d ' ')33TTYS=$(ps -o tty= -p "$(pgrep -P "$NX" | paste -sd, -)" | sort -u | wc -l | tr -d ' ')34echo "child shells=$CHILDREN distinct ttys=$TTYS"35fail=036for i in $(seq 1 "$PANES"); do37  f="$DATA/pane$i"38  if [ ! -L "$f" ]; then echo "FAIL: pane $i produced no marker (keystrokes lost or leaked)"; fail=1; continue; fi39  echo "pane $i -> $(readlink "$f")"40done41DISTINCT=$(for i in $(seq 1 "$PANES"); do readlink "$DATA/pane$i" 2>/dev/null; done | sort -u | wc -l | tr -d ' ')42[ "$DISTINCT" = "$PANES" ] || { echo "FAIL: expected $PANES distinct ttys, got $DISTINCT"; fail=1; }43[ "$CHILDREN" -ge "$PANES" ] || { echo "FAIL: expected ≥$PANES shells"; fail=1; }44swift Scripts/window-shot.swift NEXTERM "$DATA/smoke.png" >/dev/null && echo "screenshot: $DATA/smoke.png"45osascript -e 'tell application "NEXTERM" to quit' >/dev/null 2>&1 || true46[ $fail -eq 0 ] && echo "PASS: $PANES panes isolated ($DATA)" || { echo "see $DATA"; exit 1; }47
Files main
Menu

Theme