makepad/tools/run_ui_tests.sh
Sabin Regmi 0cff3fd7f6
ft makepad_test (#974)
* ft makepad_test

* Improve run handling, manifest parsing, and stdout newline

Replace dynamic free-port lookup with an ephemeral localhost SocketAddr in test runtime and remove the unused find_free_listen_address helper. Ensure headless stdout messages end with a newline. Simplify send_to_app error handling and add a test that queued bootstrap messages are delivered once an app socket connects. Substantially enhance process_manager: unify cargo flag parsing, parse Cargo.toml to determine package/bin targets, resolve the correct binary name for direct stdio runs, and build the cargo/build+exec script from the resolved args. Add unit tests for manifest parsing and script generation and adjust related call sites.

* test harness

* Preserve test attrs; return Vec for gateway binds

In the test macro (libs/makepad_test/macros/src/lib.rs) preserve wrapper-only attributes (ignore and should_panic) on the generated wrapper test while removing them from the inner function. Added Attribute import, is_wrapper_only_test_attr helper, adjusted attribute filtering and emission, and added unit tests to verify attribute placement and expansion.

In the hub (studio/hub/src/hub.rs) change gateway_bind_candidates to return a Vec<SocketAddr> instead of an iterator and special-case ephemeral port 0 to preserve ephemeral binding; otherwise collect the range of candidate ports into a Vec. Added tests to validate candidate behavior. Also minor formatting/whitespace tweaks and a small IPv6 formatting adjustment.

* Add visible Studio mode and remote client

Enable running UI tests visibly through a running Makepad Studio. Adds a new makepad-network dependency and studio_remote client (libs/makepad_test/src/studio_remote.rs) and integrates it into the runtime via a TestConnection enum. Introduces visible-mode tooling: env vars (MAKEPAD_TEST_VISIBLE, MAKEPAD_TEST_STUDIO, MAKEPAD_TEST_STUDIO_MOUNT, MAKEPAD_TEST_STARTUP_DELAY_MS, MAKEPAD_TEST_ACTION_DELAY_MS, MAKEPAD_TEST_KEEP_OPEN_MS), pacing/delays after actions, and pause-before-shutdown. Splits startup into start_headless_app/start_visible_app, clears existing visible builds before launching, and updates tests, docs (GUIDE.md, README.md), and selector/runtime minor cleanups/formatting.
2026-03-25 16:09:03 +01:00

61 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT_DIR"
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "makepad UI suites are currently validated on macOS only."
exit 1
fi
packages=(
"makepad-example-text-input:examples/text_input"
"makepad-example-counter:examples/counter"
"makepad-example-todo:examples/todo"
"makepad-example-floating-panel:examples/floating_panel"
"makepad-example-splash:examples/splash"
)
passed=()
failed=()
for entry in "${packages[@]}"; do
package="${entry%%:*}"
rel_dir="${entry#*:}"
artifact_dir="$ROOT_DIR/$rel_dir/target/makepad_test/$package"
echo
echo "==> $package"
echo " artifacts: $artifact_dir"
if cargo test -p "$package" --test ui -- --test-threads=1; then
passed+=("$package")
else
failed+=("$package")
fi
done
echo
echo "UI suite summary"
echo " passed: ${#passed[@]}"
for package in "${passed[@]}"; do
echo " - $package"
done
echo " failed: ${#failed[@]}"
for package in "${failed[@]}"; do
case "$package" in
makepad-example-text-input) rel_dir="examples/text_input" ;;
makepad-example-counter) rel_dir="examples/counter" ;;
makepad-example-todo) rel_dir="examples/todo" ;;
makepad-example-floating-panel) rel_dir="examples/floating_panel" ;;
makepad-example-splash) rel_dir="examples/splash" ;;
*) rel_dir="." ;;
esac
echo " - $package ($ROOT_DIR/$rel_dir/target/makepad_test/$package)"
done
if ((${#failed[@]} > 0)); then
exit 1
fi