Merge branch 'main' into e2e_test

This commit is contained in:
Nathan
2025-08-22 14:28:22 +08:00
36 changed files with 1810 additions and 1056 deletions

View File

@@ -82,15 +82,15 @@ jobs:
set -e
echo "Testing container fails without environment variables..."
OUTPUT=$(docker run --rm appflowy-web-test:ci 2>&1 || true)
echo "$OUTPUT" | grep -q "ERROR: AF_BASE_URL environment variable is required" || (echo "ERROR: Container should fail without env vars" && exit 1)
echo "$OUTPUT" | grep -q "ERROR: APPFLOWY_BASE_URL environment variable is required" || (echo "ERROR: Container should fail without env vars" && exit 1)
echo "✓ Container correctly fails without required env vars"
- name: Run container with injected env vars
run: |
docker run -d --rm --name appflowy-web-test -p 8080:80 \
-e AF_BASE_URL=https://ci-backend.example.com \
-e AF_GOTRUE_URL=https://ci-backend.example.com/gotrue \
-e AF_WS_V2_URL=wss://ci-backend.example.com/ws/v2 \
-e APPFLOWY_BASE_URL=https://ci-backend.example.com \
-e APPFLOWY_GOTRUE_BASE_URL=https://ci-backend.example.com/gotrue \
-e APPFLOWY_WS_BASE_URL=wss://ci-backend.example.com/ws/v2 \
appflowy-web-test:ci
- name: Wait for server to be ready
@@ -111,15 +111,15 @@ jobs:
echo "✓ Found window.__APP_CONFIG__"
echo "Verifying injected values..."
# Note: The config is injected as a single line with format: {AF_BASE_URL:'value',AF_GOTRUE_URL:'value',AF_WS_V2_URL:'value'}
echo "$HTML" | grep -q "AF_BASE_URL:'https://ci-backend.example.com'" || (echo "ERROR: AF_BASE_URL not correctly injected" && exit 1)
echo "✓ AF_BASE_URL correctly injected"
# Note: The config is injected as a single line with format: {APPFLOWY_BASE_URL:'value',APPFLOWY_GOTRUE_BASE_URL:'value',APPFLOWY_WS_BASE_URL:'value'}
echo "$HTML" | grep -q "APPFLOWY_BASE_URL:'https://ci-backend.example.com'" || (echo "ERROR: APPFLOWY_BASE_URL not correctly injected" && exit 1)
echo "✓ APPFLOWY_BASE_URL correctly injected"
echo "$HTML" | grep -q "AF_GOTRUE_URL:'https://ci-backend.example.com/gotrue'" || (echo "ERROR: AF_GOTRUE_URL not correctly injected" && exit 1)
echo "✓ AF_GOTRUE_URL correctly injected"
echo "$HTML" | grep -q "APPFLOWY_GOTRUE_BASE_URL:'https://ci-backend.example.com/gotrue'" || (echo "ERROR: APPFLOWY_GOTRUE_BASE_URL not correctly injected" && exit 1)
echo "✓ APPFLOWY_GOTRUE_BASE_URL correctly injected"
echo "$HTML" | grep -q "AF_WS_V2_URL:'wss://ci-backend.example.com/ws/v2'" || (echo "ERROR: AF_WS_V2_URL not correctly injected" && exit 1)
echo "✓ AF_WS_V2_URL correctly injected"
echo "$HTML" | grep -q "APPFLOWY_WS_BASE_URL:'wss://ci-backend.example.com/ws/v2'" || (echo "ERROR: APPFLOWY_WS_BASE_URL not correctly injected" && exit 1)
echo "✓ APPFLOWY_WS_BASE_URL correctly injected"
echo "All runtime configuration values verified successfully!"
@@ -133,7 +133,7 @@ jobs:
echo "Extracted config: $CONFIG"
# Verify it's a valid JavaScript object format
echo "$CONFIG" | grep -q "window.__APP_CONFIG__={AF_BASE_URL:'[^']*',AF_GOTRUE_URL:'[^']*',AF_WS_V2_URL:'[^']*'}" || \
echo "$CONFIG" | grep -q "window.__APP_CONFIG__={APPFLOWY_BASE_URL:'[^']*',APPFLOWY_GOTRUE_BASE_URL:'[^']*',APPFLOWY_WS_BASE_URL:'[^']*'}" || \
(echo "ERROR: Config format is invalid" && exit 1)
echo "✓ Configuration format and structure verified"