diff --git a/package.json b/package.json index 44405693f..24a14a615 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "e2e:supersync:down": "docker compose -f docker-compose.yaml -f docker-compose.supersync.yaml down supersync", "e2e:docker": "docker compose -f docker-compose.e2e.yaml up -d app && ./scripts/wait-for-app.sh && E2E_BASE_URL=http://localhost:${APP_PORT:-4242} npm run e2e; docker compose -f docker-compose.e2e.yaml down", "e2e:docker:webdav": "docker compose -f docker-compose.e2e.yaml up -d app webdav && ./scripts/wait-for-app.sh && ./scripts/wait-for-webdav.sh && E2E_BASE_URL=http://localhost:${APP_PORT:-4242} npm run e2e; docker compose -f docker-compose.e2e.yaml down", - "e2e:docker:all": "docker compose -f docker-compose.e2e.yaml up -d app webdav && ./scripts/wait-for-app.sh && ./scripts/wait-for-webdav.sh && E2E_BASE_URL=http://localhost:${APP_PORT:-4242} npm run e2e; docker compose -f docker-compose.e2e.yaml down", + "e2e:docker:all": "docker compose -f docker-compose.e2e.yaml -f docker-compose.yaml -f docker-compose.supersync.yaml up -d app webdav db supersync && ./scripts/wait-for-app.sh && ./scripts/wait-for-webdav.sh && ./scripts/wait-for-supersync.sh && E2E_BASE_URL=http://localhost:${APP_PORT:-4242} npm run e2e -- --grep-invert @supersync; PHASE1_EXIT=$?; E2E_BASE_URL=http://localhost:${APP_PORT:-4242} npm run e2e -- --grep @supersync --workers=3; PHASE2_EXIT=$?; docker compose -f docker-compose.e2e.yaml -f docker-compose.yaml -f docker-compose.supersync.yaml down; if [ $PHASE1_EXIT -ne 0 ]; then exit $PHASE1_EXIT; fi; exit $PHASE2_EXIT", "electron": "NODE_ENV=PROD electron .", "electron:build": "tsc -p electron/tsconfig.electron.json", "electron:watch": "tsc -p electron/tsconfig.electron.json --watch", diff --git a/scripts/wait-for-supersync.sh b/scripts/wait-for-supersync.sh new file mode 100755 index 000000000..6a0ca73d7 --- /dev/null +++ b/scripts/wait-for-supersync.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# Wait for SuperSync server to be ready at http://localhost:1901 +# Retries for up to 90 seconds (accounts for PostgreSQL + SuperSync startup) + +echo "Waiting for SuperSync server on http://localhost:1901..." + +MAX_WAIT=90 +elapsed=0 +until curl -s http://localhost:1901/health > /dev/null 2>&1; do + if [ $elapsed -ge $MAX_WAIT ]; then + echo "Timeout: SuperSync server did not start within ${MAX_WAIT}s" + echo "--- SuperSync logs ---" + docker compose -f docker-compose.yaml -f docker-compose.supersync.yaml logs supersync + exit 1 + fi + sleep 1 + elapsed=$((elapsed + 1)) +done + +echo "SuperSync server is ready!"