fix: only show Failed Tests section when there are actual failures (#8575)

## Description

The Playwright test comment was showing a " Failed Tests" section
header even when there were only flaky tests (no actual failures). This
was confusing because the red X suggested failure when tests actually
passed.

**Before:** Shows " Failed Tests" section for flaky-only runs
**After:** Only shows " Failed Tests" section when there are actual
failures; flaky tests are treated as passing

## Related Issue

Fixes the misleading comment behavior seen in PR #8573



┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-8575-fix-only-show-Failed-Tests-section-when-there-are-actual-failures-2fc6d73d36508167889cc252e4e06f2e)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Alexander Brown <drjkl@comfy.org>
This commit is contained in:
Christian Byrne
2026-02-08 13:14:38 -08:00
committed by GitHub
parent c0a209226d
commit b583c92c64

View File

@@ -283,34 +283,27 @@ else
done done
unset IFS unset IFS
# Determine overall status # Determine overall status (flaky tests are treated as passing)
if [ $total_failed -gt 0 ]; then if [ $total_failed -gt 0 ]; then
status_icon="❌" status_icon="❌"
status_text="Failed"
elif [ $total_flaky -gt 0 ]; then
status_icon="⚠️"
status_text="Passed with flaky tests"
elif [ $total_tests -gt 0 ]; then elif [ $total_tests -gt 0 ]; then
status_icon="✅" status_icon="✅"
status_text="Passed"
else else
status_icon="🕵🏻" status_icon="🕵🏻"
status_text="No test results"
fi fi
# Generate concise completion comment # Build flaky indicator if any (small subtext, no warning icon)
comment="$COMMENT_MARKER flaky_note=""
## 🎭 Playwright Tests: $status_icon **$status_text**" if [ $total_flaky -gt 0 ]; then
flaky_note=" · $total_flaky flaky"
# Add summary counts if we have test data
if [ $total_tests -gt 0 ]; then
comment="$comment
**Results:** $total_passed passed, $total_failed failed, $total_flaky flaky, $total_skipped skipped (Total: $total_tests)"
fi fi
# Generate compact single-line comment
comment="$COMMENT_MARKER
**Playwright:** $status_icon $total_passed passed, $total_failed failed$flaky_note"
# Extract and display failed tests from all browsers # Extract and display failed tests from all browsers (flaky tests are treated as passing)
if [ $total_failed -gt 0 ] || [ $total_flaky -gt 0 ]; then if [ $total_failed -gt 0 ]; then
comment="$comment comment="$comment
### ❌ Failed Tests" ### ❌ Failed Tests"