mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2026-03-01 12:44:17 +00:00
solve xvfb issue with parallele test execution in e2e test workflow
This commit is contained in:
parent
b1f0e4a91f
commit
d6367e5ad6
31
.github/workflows/test.e2e.yml
vendored
31
.github/workflows/test.e2e.yml
vendored
@ -90,40 +90,25 @@ jobs:
|
||||
# Ensure xvfb is available
|
||||
which xvfb-run || (sudo apt-get update && sudo apt-get install -y xvfb)
|
||||
|
||||
# Create a wrapper script for parallel execution with display isolation
|
||||
cat > /tmp/cypress-parallel-wrapper.sh << 'EOF'
|
||||
#!/bin/bash
|
||||
|
||||
# Get parameters
|
||||
SPEC_COUNT="$1"
|
||||
SPLIT_INDEX="$2"
|
||||
|
||||
# Calculate unique display number starting from 100 to avoid conflicts with :99
|
||||
DISPLAY_NUM=$((100 + SPLIT_INDEX))
|
||||
|
||||
echo "Running Cypress chunk $((SPLIT_INDEX + 1))/$SPEC_COUNT on display :$DISPLAY_NUM"
|
||||
|
||||
# Run Cypress with isolated display using xvfb-run
|
||||
SPLIT="$SPEC_COUNT" SPLIT_INDEX="$SPLIT_INDEX" \
|
||||
xvfb-run --server-num="$DISPLAY_NUM" \
|
||||
--server-args="-screen 0 1280x720x24 -ac +extension GLX +render -noreset" \
|
||||
cypress run --e2e --browser chromium
|
||||
EOF
|
||||
|
||||
chmod +x /tmp/cypress-parallel-wrapper.sh
|
||||
|
||||
echo "Display environment setup complete"
|
||||
|
||||
- name: Run E2E Tests
|
||||
id: cypress-tests
|
||||
continue-on-error: true
|
||||
run: |
|
||||
# Override the npm script to use xvfb-run with display isolation
|
||||
SPEC_COUNT=$(find e2e -name "*.cy.ts" | wc -l)
|
||||
echo "Running $SPEC_COUNT test chunks in parallel with display isolation"
|
||||
|
||||
# Launch parallel processes with isolated displays
|
||||
for i in $(seq 0 $((SPEC_COUNT-1))); do
|
||||
/tmp/cypress-parallel-wrapper.sh "$SPEC_COUNT" "$i" &
|
||||
echo "Starting Cypress chunk $((i + 1))/$SPEC_COUNT on display :$((100 + i))"
|
||||
(
|
||||
SPLIT="$SPEC_COUNT" SPLIT_INDEX="$i" SPLIT_SUMMARY=false \
|
||||
xvfb-run --server-num="$((100 + i))" \
|
||||
--server-args="-screen 0 1280x720x24 -ac +extension GLX +render -noreset" \
|
||||
npx cypress run --e2e --browser chromium
|
||||
) &
|
||||
done
|
||||
|
||||
# Wait for all background processes to complete
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user