agent-desktop/tests/fixture-app/build.sh
Lahfir 30e80b90bc test: add E2E fixture app and dual-mode harness
Drives the release binary against a real SwiftUI/AppKit fixture and verifies
every effect by independent before/after observation — never the command's own
ok:true — so a command that reports success without an effect is caught. This is
the layer mock-adapter unit tests cannot cover: it exercises the contract
against the real macOS Accessibility API.

- AgentDeskFixture.swift exposes a fixed, diverse AX surface (native AppKit
  slider/stepper, gesture-only and ambiguous controls, a sheet, a press-toggled
  disclosure, async-appearing elements, a drag canvas). It is never tuned to
  make a command pass; a failure is a finding about the CLI or the harness.
- run.sh drives every ref-action command in BOTH headless and --headed mode with
  mode-specific target values, plus the double-click discriminator (headless
  fails closed with POLICY_DENIED, --headed completes) that proves the two modes
  differ. It also covers strict resolution, wait predicates, skeleton drill-down,
  sessions, trace redaction, surfaces, drag, expand, and force-close.
- The compiled fixture .app is a build artifact (gitignored; built on demand).

Run: cargo build --release && bash tests/e2e/run.sh (needs AX permission).
2026-06-17 13:43:19 -07:00

39 lines
1.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Builds the agent-desktop E2E fixture into a runnable .app bundle.
# Usage: tests/fixture-app/build.sh [output-dir]
# Output: <output-dir>/AgentDeskFixture.app (default: alongside this script)
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
out_dir="${1:-$here/build}"
app="$out_dir/AgentDeskFixture.app"
macos_dir="$app/Contents/MacOS"
bin="$macos_dir/AgentDeskFixture"
rm -rf "$app"
mkdir -p "$macos_dir"
swiftc -O -parse-as-library \
-framework SwiftUI -framework AppKit \
-o "$bin" \
"$here/AgentDeskFixture.swift"
cat > "$app/Contents/Info.plist" <<'PLIST'
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleName</key><string>AgentDeskFixture</string>
<key>CFBundleDisplayName</key><string>AgentDeskFixture</string>
<key>CFBundleIdentifier</key><string>com.agentdesktop.fixture</string>
<key>CFBundleVersion</key><string>1</string>
<key>CFBundleShortVersionString</key><string>1.0</string>
<key>CFBundlePackageType</key><string>APPL</string>
<key>CFBundleExecutable</key><string>AgentDeskFixture</string>
<key>LSMinimumSystemVersion</key><string>13.0</string>
<key>NSHighResolutionCapable</key><true/>
</dict>
</plist>
PLIST
echo "Built: $app"