tools/ui/ — scripts + Playwright config that let Claude Code (and
humans) drive the Flutter WASM build in a real browser. The point is
to avoid screenshot round-trips: every interactive widget in clide
ships a Semantics wrapper anyway (a11y requirement), so the automation
layer just queries the `flt-semantics[aria-label]` DOM.
* build.sh — `flutter build web --wasm` from app/
* serve.sh — `python3 -m http.server 4280` in the background.
Before binding, kills any stale listener on the port (orphans
from earlier failed runs no longer accumulate).
* stop.sh — port-based kill; escalates to SIGKILL after 300ms.
The pidfile is now advisory — port ownership is the source of
truth.
* driver.ts — `ClideDriver` class with `byLabel`, `click`, `type`,
`readText`, `screenshot`, `dumpSemanticsTree`, and
`waitUntilReady` that auto-clicks the `flt-semantics-placeholder`
so the semantic tree is populated before queries.
* tests/smoke.spec.ts — first driver test; asserts welcome +
disconnected labels surface in the Semantics DOM.
Co-Authored-By: Claude <noreply@anthropic.com>
36 lines
1.0 KiB
Bash
Executable File
36 lines
1.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Kill the dev web server on $CLIDE_UI_PORT (default 4280). Port-based
|
|
# kill so any orphan from a previous `serve.sh` that lost its pidfile
|
|
# dies too.
|
|
set -euo pipefail
|
|
|
|
PORT=${CLIDE_UI_PORT:-4280}
|
|
HERE="$(cd "$(dirname "$0")" && pwd)"
|
|
PID_FILE="$HERE/.serve.pid"
|
|
|
|
pids=""
|
|
if command -v lsof >/dev/null 2>&1; then
|
|
pids=$(lsof -ti:"$PORT" 2>/dev/null || true)
|
|
elif command -v fuser >/dev/null 2>&1; then
|
|
pids=$(fuser -n tcp "$PORT" 2>/dev/null | tr -d ' /tcp' || true)
|
|
fi
|
|
|
|
if [[ -n "$pids" ]]; then
|
|
echo "stop: killing $pids (port $PORT)"
|
|
echo "$pids" | xargs -r kill 2>/dev/null || true
|
|
# Give SIGTERM 300ms to land; escalate to SIGKILL for stragglers.
|
|
sleep 0.3
|
|
remaining=""
|
|
if command -v lsof >/dev/null 2>&1; then
|
|
remaining=$(lsof -ti:"$PORT" 2>/dev/null || true)
|
|
fi
|
|
if [[ -n "$remaining" ]]; then
|
|
echo "stop: escalating to SIGKILL for $remaining"
|
|
echo "$remaining" | xargs -r kill -9 2>/dev/null || true
|
|
fi
|
|
else
|
|
echo "stop: no server on port $PORT"
|
|
fi
|
|
|
|
rm -f "$PID_FILE"
|