From c69507fecfcb255c241afcbf9a70d909539f9c4a Mon Sep 17 00:00:00 2001 From: mahula Date: Mon, 6 Oct 2025 20:05:34 +0200 Subject: [PATCH] fix: improve screenshot handling in e2e test reports - Add debugging output to trace screenshot copying process in CI - Clean up unwanted 'before-intentional-failure' screenshots - Fix artifact upload path formatting in workflow --- .github/workflows/test.e2e.yml | 3 +-- cypress/scripts/generate-html-report.sh | 22 ++++++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.e2e.yml b/.github/workflows/test.e2e.yml index 964d2360..6109c398 100644 --- a/.github/workflows/test.e2e.yml +++ b/.github/workflows/test.e2e.yml @@ -194,8 +194,7 @@ jobs: uses: actions/upload-artifact@2848b2cda0e5190984587ec6bb1f36730ca78d50 # v4.6.2 with: name: e2e-test-report-${{ github.run_id }} - path: | - cypress/results/html/ + path: cypress/results/html/ retention-days: 14 if-no-files-found: warn diff --git a/cypress/scripts/generate-html-report.sh b/cypress/scripts/generate-html-report.sh index d178a355..3f77b217 100755 --- a/cypress/scripts/generate-html-report.sh +++ b/cypress/scripts/generate-html-report.sh @@ -21,7 +21,20 @@ echo "Report size: $(wc -c < results/html/merged-report.html) bytes" # Copy screenshots with proper structure for the HTML report echo "Copying screenshots to HTML report directory..." +echo "DEBUG: Current working directory: $(pwd)" +echo "DEBUG: Available directories:" +ls -la + if [ -d "screenshots" ]; then + echo "DEBUG: Screenshots directory found" + echo "DEBUG: Screenshots directory structure:" + find screenshots -type f -name "*.png" | head -10 + + # Remove unwanted screenshots (like before-intentional-failure) + echo "Cleaning up unwanted screenshots..." + find screenshots -name "*before-intentional-failure*" -type f -delete 2>/dev/null || true + find screenshots -name "*before-*" -type f -delete 2>/dev/null || true + # Create screenshots directory in the HTML output mkdir -p "results/html/screenshots" @@ -29,10 +42,15 @@ if [ -d "screenshots" ]; then cp -r screenshots/* results/html/screenshots/ 2>/dev/null || true echo "✅ Screenshots copied successfully" - echo "Screenshot structure:" - find results/html/screenshots -type f -name "*.png" | head -5 + echo "DEBUG: Final screenshot structure in HTML output:" + find results/html/screenshots -type f -name "*.png" | head -10 + + echo "DEBUG: Full results/html structure:" + find results/html -type f | head -20 else echo "⚠️ No screenshots directory found" + echo "DEBUG: Available files and directories:" + find . -maxdepth 2 -type d fi echo "=== Final consolidated report ready ==="