fix: enable screen recording and non-headless Playwright on all platforms

Run Playwright without --headless on macOS/Windows so the browser window
is visible for screen capture. Restore avfoundation (macOS) and gdigrab
(Windows) recording steps. Remove 2>/dev/null from ffmpeg to surface
errors in CI logs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
snomiao
2026-03-08 07:28:57 +00:00
parent 6be36f4f52
commit 1acc0f8894

View File

@@ -89,20 +89,34 @@ jobs:
echo $! > "${{ runner.temp }}/ffmpeg.pid"
sleep 1
# Note: Screen recording is only available on Linux (Xvfb provides a
# virtual display). On macOS/Windows, Playwright runs --headless so
# there is no visible browser to capture.
# --- Recording: macOS (avfoundation) ---
- name: Start recording (macOS)
if: runner.os == 'macOS'
run: |
mkdir -p "$QA_ARTIFACTS"
ffmpeg -y -f avfoundation -framerate 10 -capture_cursor 1 \
-i "1:none" -c:v libx264 -preset ultrafast -crf 28 \
-pix_fmt yuv420p "$QA_ARTIFACTS/qa-session.mp4" &
echo $! > "${{ runner.temp }}/ffmpeg.pid"
sleep 1
# --- Recording: Windows (gdigrab) ---
- name: Start recording (Windows)
if: runner.os == 'Windows'
shell: bash
run: |
mkdir -p "$QA_ARTIFACTS"
ffmpeg -y -f gdigrab -framerate 10 -i desktop \
-c:v libx264 -preset ultrafast -crf 28 \
-pix_fmt yuv420p "$QA_ARTIFACTS/qa-session.mp4" &
echo $! > "${{ runner.temp }}/ffmpeg.pid"
sleep 1
- name: Create MCP config
shell: bash
run: |
if [ "$RUNNER_OS" = "Linux" ]; then
ARGS='["@playwright/mcp@0.0.68"]'
else
ARGS='["@playwright/mcp@0.0.68", "--headless"]'
fi
cat > "${{ runner.temp }}/mcp-config.json" <<EOF
{"mcpServers":{"playwright":{"command":"npx","args":${ARGS}}}}
{"mcpServers":{"playwright":{"command":"npx","args":["@playwright/mcp@0.0.68"]}}}
EOF
- name: Write QA prompt