From 23cad37e0392f7cd13affd5300c7d5d8f05fde1b Mon Sep 17 00:00:00 2001 From: zhi Date: Sat, 21 Mar 2026 10:10:59 +0000 Subject: [PATCH] test: simplify frontend test runner and rely on image default command - remove --test-real-plugin option - stop overriding test container CMD - let Frontend.Test Dockerfile own proxy startup and playwright launch --- HarborForge.Frontend.Test | 2 +- run-test-frontend.sh | 35 +++++++---------------------------- 2 files changed, 8 insertions(+), 29 deletions(-) diff --git a/HarborForge.Frontend.Test b/HarborForge.Frontend.Test index d8007fa..df05820 160000 --- a/HarborForge.Frontend.Test +++ b/HarborForge.Frontend.Test @@ -1 +1 @@ -Subproject commit d8007fab3d2a0ce5dc70de6aa8911d7ff66f303b +Subproject commit df05820a95f102714ad9fd9b95a1d38d3a37ccca diff --git a/run-test-frontend.sh b/run-test-frontend.sh index c5cdbf7..33983b4 100755 --- a/run-test-frontend.sh +++ b/run-test-frontend.sh @@ -1,16 +1,13 @@ #!/bin/bash # Run frontend test with optional port exposure -# Usage: ./run-test-frontend.sh [--expose-port {on|off}] [--test-real-plugin] -# Default: +# Usage: ./run-test-frontend.sh [--expose-port {on|off}] +# Default: # --expose-port off: Auto cleanup after test -# --test-real-plugin: Run only real-plugin.spec.ts (requires vps.t1 plugin) set -e EXPOSE_PORT="off" -TEST_REAL_PLUGIN="off" COMPOSE_FILE="docker-compose-frontend.yml" -TEST_PATTERN="" # Load environment variables from .env.TEST if exists if [ -f ".env.TEST" ]; then @@ -31,13 +28,9 @@ while [[ $# -gt 0 ]]; do EXPOSE_PORT="${1#*=}" shift ;; - --test-real-plugin) - TEST_REAL_PLUGIN="on" - shift - ;; *) echo "Unknown option: $1" - echo "Usage: $0 [--expose-port {on|off}] [--test-real-plugin]" + echo "Usage: $0 [--expose-port {on|off}]" exit 1 ;; esac @@ -49,14 +42,6 @@ if [[ "$EXPOSE_PORT" != "on" && "$EXPOSE_PORT" != "off" ]]; then exit 1 fi -# Set test pattern for real plugin test -if [[ "$TEST_REAL_PLUGIN" == "on" ]]; then - TEST_PATTERN="real-plugin.spec.ts" - echo "๐Ÿ”Œ Real Plugin Test Mode: ON" - echo " Will run: tests/real-plugin.spec.ts" - echo " Requires vps.t1 to have OpenClaw plugin installed" -fi - # Select compose file based on expose-port if [[ "$EXPOSE_PORT" == "on" ]]; then COMPOSE_FILE="docker-compose-frontend-expose.yml" @@ -125,15 +110,9 @@ fi echo "โœ… Services ready!" -# Run test +# Run test using the image default CMD so proxy startup stays inside Frontend.Test Dockerfile echo "๐Ÿงช Running test..." -if [[ -n "$TEST_PATTERN" ]]; then - # Run specific test for real plugin only when explicitly requested - docker compose -f "$COMPOSE_FILE" run --rm -e WORKERS=1 test npx playwright test tests/real-plugin.spec.ts --reporter=list -else - # Default: run all frontend tests EXCEPT real-plugin.spec.ts - docker compose -f "$COMPOSE_FILE" run --rm -e WORKERS=1 test sh -lc 'npx playwright test $(find tests -name "*.spec.ts" ! -name "real-plugin.spec.ts" | sort) --reporter=list' -fi +docker compose -f "$COMPOSE_FILE" run --rm -e WORKERS=1 test TEST_EXIT_CODE=$? # Cleanup decision based on expose-port @@ -143,7 +122,7 @@ if [[ "$EXPOSE_PORT" == "on" ]]; then echo " Use './run-test-frontend.sh --expose-port on' to cleanup" echo " Or manually: docker compose -f $COMPOSE_FILE down -v" echo "" - + if [ $TEST_EXIT_CODE -eq 0 ]; then echo "โœ… Test passed!" else @@ -153,7 +132,7 @@ else echo "" echo "๐Ÿงน Cleaning up containers and volumes..." docker compose -f "$COMPOSE_FILE" down -v - + if [ $TEST_EXIT_CODE -eq 0 ]; then echo "โœ… Test passed!" else