fix paths in reporting job

This commit is contained in:
mahula 2025-10-04 10:01:36 +02:00
parent 352780853d
commit c96d631b46
2 changed files with 42 additions and 15 deletions

View File

@ -176,42 +176,69 @@ jobs:
name: cypress-test-results-${{ github.run_id }}
path: ./downloaded-reports
- name: Debug downloaded artifacts
run: |
echo "=== Downloaded artifact structure ==="
find downloaded-reports/ -type f 2>/dev/null || echo "No files found"
echo ""
echo "=== Looking for JSON files ==="
find downloaded-reports/ -name "*.json" 2>/dev/null || echo "No JSON files found"
- name: Copy reports to expected location
run: |
mkdir -p cypress/cypress/results
if [ -d "downloaded-reports/cypress/results" ]; then
cp -r downloaded-reports/cypress/results/* cypress/cypress/results/
fi
if [ -d "downloaded-reports/screenshots" ]; then
cp -r downloaded-reports/screenshots cypress/
fi
if [ -d "downloaded-reports/videos" ]; then
cp -r downloaded-reports/videos cypress/
# Create the target directory structure in cypress directory
mkdir -p cypress/results
# Copy all files from downloaded artifacts, preserving structure
if [ -d "downloaded-reports" ]; then
# Find and copy all JSON files regardless of their path in the artifact
find downloaded-reports/ -name "*.json" -exec cp {} cypress/results/ \;
# Copy screenshots if they exist
if [ -d "downloaded-reports/screenshots" ]; then
cp -r downloaded-reports/screenshots cypress/
fi
# Copy videos if they exist
if [ -d "downloaded-reports/videos" ]; then
cp -r downloaded-reports/videos cypress/
fi
echo "=== Files copied to cypress/results/ ==="
ls -la cypress/results/ || echo "No files in cypress/results/"
fi
- name: Merge test reports
run: |
if [ -d "cypress/results" ] && [ "$(find cypress/results/ -name "*.json" 2>/dev/null)" ]; then
if [ -d "results" ] && [ "$(find results/ -name "*.json" 2>/dev/null)" ]; then
echo "Found JSON reports, merging..."
npm run report:merge
echo "=== Merge result ==="
ls -la results/merged-report.json || echo "Merge failed"
else
echo "No JSON reports found to merge"
echo "=== Debug: results directory ==="
ls -la results/ || echo "Directory does not exist"
fi
working-directory: ./cypress
- name: Generate HTML report
run: |
if [ -f "cypress/results/merged-report.json" ]; then
if [ -f "results/merged-report.json" ]; then
echo "Generating HTML report..."
npm run report:generate
echo "=== HTML generation result ==="
ls -la results/html/ || echo "HTML generation failed"
else
echo "No merged report found, skipping HTML generation"
fi
working-directory: ./cypress
- name: Upload processed reports
uses: actions/upload-artifact@v4
with:
name: e2e-test-reports-${{ github.run_id }}
path: |
cypress/cypress/results/
cypress/results/
retention-days: 30
if-no-files-found: warn

View File

@ -7,9 +7,9 @@
"test": "cypress run --e2e --browser chromium",
"test:open": "cypress open --e2e",
"test:split:auto": "SPEC_COUNT=$(find e2e -name '*.cy.ts' | wc -l) && echo \"Running $SPEC_COUNT chunks in parallel\" && for i in $(seq 0 $((SPEC_COUNT-1))); do SPLIT=$SPEC_COUNT SPLIT_INDEX=$i cypress run --e2e --browser chromium & done; wait",
"report:merge": "mochawesome-merge cypress/results/*.json > cypress/results/merged-report.json",
"report:generate": "marge cypress/results/merged-report.json --reportDir cypress/results/html --reportTitle 'Utopia Map E2E Tests' --reportPageTitle 'Utopia Map E2E Test Report' --inline --charts",
"report:clean": "rm -rf cypress/results cypress/screenshots cypress/videos",
"report:merge": "mochawesome-merge results/*.json > results/merged-report.json",
"report:generate": "marge results/merged-report.json --reportDir results/html --reportTitle 'Utopia Map E2E Tests' --reportPageTitle 'Utopia Map E2E Test Report' --inline --charts",
"report:clean": "rm -rf results screenshots videos",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},