fix: CI e2e分3批跑全部32个spec,每批新启Electron释放内存
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 7s
Test / e2e-test (push) Failing after 3m36s
Some checks failed
PR Preview / teardown-preview (pull_request) Has been skipped
Test / unit-test (push) Successful in 6s
Test / build-check (push) Successful in 4s
PR Preview / test (pull_request) Successful in 6s
PR Preview / deploy-preview (pull_request) Successful in 7s
Test / e2e-test (push) Failing after 3m36s
Batch1: API/数据测试(8个) Batch2: UI流程测试(9个) Batch3: 其他测试(15个,含demo-walkthrough) 每批5分钟超时,总共不超过15分钟,避免内存累积导致崩溃。 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,23 +62,37 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Run specs excluding slow/memory-heavy ones
|
# Run all specs in 3 batches to avoid Electron memory crashes
|
||||||
cd frontend
|
cd frontend
|
||||||
timeout 600 npx cypress run \
|
CYPRESS_CFG="video=false,defaultCommandTimeout=5000,pageLoadTimeout=10000,requestTimeout=5000,responseTimeout=10000,baseUrl=http://localhost:$FE_PORT,experimentalMemoryManagement=true,numTestsKeptInMemory=0"
|
||||||
--spec "cypress/e2e/!(demo-walkthrough|recipe-detail|manage-recipes|visual-check).cy.js" \
|
|
||||||
--config "video=false,defaultCommandTimeout=5000,pageLoadTimeout=10000,requestTimeout=5000,responseTimeout=10000,baseUrl=http://localhost:$FE_PORT,experimentalMemoryManagement=true,numTestsKeptInMemory=0" \
|
echo "=== Batch 1: API & data tests ==="
|
||||||
--env "ADMIN_TOKEN=$ADMIN_TOKEN"
|
timeout 300 npx cypress run \
|
||||||
EXIT_CODE=$?
|
--spec "cypress/e2e/api-crud.cy.js,cypress/e2e/api-health.cy.js,cypress/e2e/oil-data-integrity.cy.js,cypress/e2e/recipe-cost-parity.cy.js,cypress/e2e/endpoint-parity.cy.js,cypress/e2e/registration-flow.cy.js,cypress/e2e/pr27-features.cy.js,cypress/e2e/kit-export.cy.js" \
|
||||||
|
--config "$CYPRESS_CFG" --env "ADMIN_TOKEN=$ADMIN_TOKEN"
|
||||||
|
B1=$?
|
||||||
|
|
||||||
|
echo "=== Batch 2: UI flow tests ==="
|
||||||
|
timeout 300 npx cypress run \
|
||||||
|
--spec "cypress/e2e/auth-flow.cy.js,cypress/e2e/admin-flow.cy.js,cypress/e2e/navigation.cy.js,cypress/e2e/recipe-detail.cy.js,cypress/e2e/recipe-search.cy.js,cypress/e2e/manage-recipes.cy.js,cypress/e2e/diary-flow.cy.js,cypress/e2e/favorites.cy.js,cypress/e2e/inventory-flow.cy.js" \
|
||||||
|
--config "$CYPRESS_CFG" --env "ADMIN_TOKEN=$ADMIN_TOKEN"
|
||||||
|
B2=$?
|
||||||
|
|
||||||
|
echo "=== Batch 3: Remaining tests ==="
|
||||||
|
timeout 300 npx cypress run \
|
||||||
|
--spec "cypress/e2e/app-load.cy.js,cypress/e2e/account-settings.cy.js,cypress/e2e/audit-log-advanced.cy.js,cypress/e2e/batch-operations.cy.js,cypress/e2e/bug-tracker-flow.cy.js,cypress/e2e/category-modules.cy.js,cypress/e2e/notification-flow.cy.js,cypress/e2e/oil-reference.cy.js,cypress/e2e/performance.cy.js,cypress/e2e/price-display.cy.js,cypress/e2e/projects-flow.cy.js,cypress/e2e/responsive.cy.js,cypress/e2e/search-advanced.cy.js,cypress/e2e/user-management-flow.cy.js,cypress/e2e/visual-check.cy.js,cypress/e2e/demo-walkthrough.cy.js" \
|
||||||
|
--config "$CYPRESS_CFG" --env "ADMIN_TOKEN=$ADMIN_TOKEN"
|
||||||
|
B3=$?
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
kill $BE_PID $FE_PID 2>/dev/null
|
kill $BE_PID $FE_PID 2>/dev/null
|
||||||
pkill -f "Cypress" 2>/dev/null || true
|
pkill -f "Cypress" 2>/dev/null || true
|
||||||
rm -f "$DB_FILE"
|
rm -f "$DB_FILE"
|
||||||
if [ $EXIT_CODE -eq 124 ]; then
|
|
||||||
echo "ERROR: Cypress timed out after 15 minutes"
|
echo "Results: Batch1=$B1 Batch2=$B2 Batch3=$B3"
|
||||||
|
if [ $B1 -ne 0 ] || [ $B2 -ne 0 ] || [ $B3 -ne 0 ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
exit $EXIT_CODE
|
|
||||||
|
|
||||||
build-check:
|
build-check:
|
||||||
runs-on: test
|
runs-on: test
|
||||||
|
|||||||
Reference in New Issue
Block a user