mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-22 13:28:10 +00:00
test(e2e): show browser CDP smoke diagnostics
This commit is contained in:
@@ -5,7 +5,16 @@ ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
source "$ROOT_DIR/scripts/lib/docker-e2e-image.sh"
|
||||
|
||||
BASE_IMAGE="$(docker_e2e_resolve_image "openclaw-browser-cdp-base-e2e" OPENCLAW_BROWSER_CDP_BASE_E2E_IMAGE)"
|
||||
IMAGE_NAME="$(docker_e2e_resolve_image "openclaw-browser-cdp-snapshot-e2e" OPENCLAW_BROWSER_CDP_SNAPSHOT_E2E_IMAGE)"
|
||||
if [ -n "${OPENCLAW_BROWSER_CDP_SNAPSHOT_E2E_IMAGE:-}" ]; then
|
||||
IMAGE_NAME="$OPENCLAW_BROWSER_CDP_SNAPSHOT_E2E_IMAGE"
|
||||
DERIVED_SHARED_IMAGE="0"
|
||||
elif [ -n "${OPENCLAW_DOCKER_E2E_IMAGE:-}" ]; then
|
||||
IMAGE_NAME="openclaw-browser-cdp-snapshot-e2e:${OPENCLAW_DOCKER_ALL_LANE_NAME:-shared}"
|
||||
DERIVED_SHARED_IMAGE="1"
|
||||
else
|
||||
IMAGE_NAME="openclaw-browser-cdp-snapshot-e2e"
|
||||
DERIVED_SHARED_IMAGE="0"
|
||||
fi
|
||||
SKIP_BUILD="${OPENCLAW_BROWSER_CDP_SNAPSHOT_E2E_SKIP_BUILD:-0}"
|
||||
PORT="18789"
|
||||
CDP_PORT="19222"
|
||||
@@ -19,7 +28,9 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
if [ "${OPENCLAW_SKIP_DOCKER_BUILD:-0}" = "1" ] || [ "$SKIP_BUILD" = "1" ]; then
|
||||
# Targeted Docker runs reuse the shared functional image as the base, but this
|
||||
# lane still needs a derived image with Chromium installed.
|
||||
if [ "$SKIP_BUILD" = "1" ] || { [ "$DERIVED_SHARED_IMAGE" = "0" ] && [ "${OPENCLAW_SKIP_DOCKER_BUILD:-0}" = "1" ]; }; then
|
||||
echo "Reusing Docker image: $IMAGE_NAME"
|
||||
docker_e2e_docker_cmd image inspect "$IMAGE_NAME" >/dev/null
|
||||
else
|
||||
@@ -82,7 +93,7 @@ if ! docker_e2e_wait_container_bash "$CONTAINER_NAME" 180 0.5 "
|
||||
fi
|
||||
|
||||
echo "Running browser CDP snapshot smoke..."
|
||||
docker_e2e_docker_cmd exec "$CONTAINER_NAME" bash -lc "
|
||||
if ! docker_e2e_docker_cmd exec "$CONTAINER_NAME" bash -lc "
|
||||
set -euo pipefail
|
||||
source /tmp/openclaw-test-state-env
|
||||
source scripts/lib/openclaw-e2e-instance.sh
|
||||
@@ -93,6 +104,10 @@ grep -q 'OK live-snapshot' /tmp/browser-cdp-doctor.txt
|
||||
node \"\$entry\" browser \"\${base_args[@]}\" --browser-profile docker-cdp open http://127.0.0.1:$FIXTURE_PORT/ >/tmp/browser-cdp-open.txt
|
||||
node \"\$entry\" browser \"\${base_args[@]}\" --browser-profile docker-cdp snapshot --interactive --urls --out /tmp/browser-cdp-snapshot.txt >/tmp/browser-cdp-snapshot.out
|
||||
node scripts/e2e/lib/browser-cdp-snapshot/assert-snapshot.mjs /tmp/browser-cdp-snapshot.txt
|
||||
"
|
||||
"; then
|
||||
echo "Browser CDP snapshot smoke failed"
|
||||
docker_e2e_tail_container_file_if_running "$CONTAINER_NAME" "/tmp/browser-cdp-doctor.txt /tmp/browser-cdp-open.txt /tmp/browser-cdp-snapshot.out /tmp/browser-cdp-snapshot.txt /tmp/browser-cdp-chromium.log /tmp/browser-cdp-gateway.log /tmp/browser-cdp-fixture.log" 200
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Browser CDP snapshot Docker E2E passed."
|
||||
|
||||
Reference in New Issue
Block a user