Skip to content

Commit de71069

Browse files
committed
Debug retries
1 parent 6f88140 commit de71069

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

.github/actions/e2e/run-log-tests/action.yml

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,48 @@ runs:
2828
shell: bash
2929
# Filter failed E2E files from the result JSON file, and re-run them.
3030
run: |
31-
# Debug: Check if results file exists and show its structure
31+
# Debug: Check if results file exists
3232
echo "Checking for results file: $E2E_RESULT_FILEPATH"
3333
if [[ -f "$E2E_RESULT_FILEPATH" ]]; then
3434
echo "Results file exists, size: $(wc -c < "$E2E_RESULT_FILEPATH") bytes"
35-
echo "First 500 characters of results file:"
36-
head -c 500 "$E2E_RESULT_FILEPATH"
37-
echo ""
3835
3936
# Extract failed test files and run only those
4037
echo "Extracting failed test files..."
38+
39+
# Try multiple JSON structures to find failed tests
40+
FAILED_FILES=""
41+
42+
# Method 1: Standard structure
43+
echo "Trying standard JSON structure..."
4144
FAILED_FILES=$(cat "$E2E_RESULT_FILEPATH" | jq -r '[.suites[] | (if has("suites") then .suites[] | .specs[] else .specs[] end) | select(.tests[].status == "unexpected") | .file] | unique | .[]' 2>/dev/null)
4245
43-
if [[ $? -ne 0 ]]; then
44-
echo "Error: jq command failed. Trying alternative JSON structure..."
45-
# Try alternative structure - maybe tests are directly in specs
46+
# Method 2: Direct specs structure
47+
if [[ -z "$FAILED_FILES" ]]; then
48+
echo "Trying direct specs structure..."
4649
FAILED_FILES=$(cat "$E2E_RESULT_FILEPATH" | jq -r '[.suites[] | .specs[] | select(.tests[].status == "unexpected") | .file] | unique | .[]' 2>/dev/null)
4750
fi
4851
52+
# Method 3: Look for any file with unexpected status
53+
if [[ -z "$FAILED_FILES" ]]; then
54+
echo "Trying to find any file with unexpected status..."
55+
FAILED_FILES=$(cat "$E2E_RESULT_FILEPATH" | jq -r '[.. | select(.status? == "unexpected") | .file] | unique | .[]' 2>/dev/null)
56+
fi
57+
58+
# Method 4: Look for files in test results
59+
if [[ -z "$FAILED_FILES" ]]; then
60+
echo "Trying to extract from test results..."
61+
FAILED_FILES=$(cat "$E2E_RESULT_FILEPATH" | jq -r '[.suites[] | .specs[] | select(.tests[] | .status == "unexpected") | .file] | unique | .[]' 2>/dev/null)
62+
fi
63+
4964
if [[ -n "$FAILED_FILES" ]]; then
5065
echo "Retrying failed test files: $FAILED_FILES"
5166
npx playwright test --config=tests/e2e/playwright.config.ts --grep-invert @todo $FAILED_FILES
5267
else
5368
echo "No failed test files found to retry"
54-
echo "Debug: Full JSON structure:"
55-
cat "$E2E_RESULT_FILEPATH" | jq '.' | head -50
69+
echo "Debug: Checking JSON structure..."
70+
echo "JSON keys: $(cat "$E2E_RESULT_FILEPATH" | jq -r 'keys | .[]' 2>/dev/null || echo "Failed to get keys")"
71+
echo "Has suites: $(cat "$E2E_RESULT_FILEPATH" | jq -r 'has("suites")' 2>/dev/null || echo "Failed to check suites")"
72+
echo "Suites count: $(cat "$E2E_RESULT_FILEPATH" | jq -r '.suites | length' 2>/dev/null || echo "Failed to get suites count")"
5673
fi
5774
else
5875
echo "Error: Results file not found at $E2E_RESULT_FILEPATH"

0 commit comments

Comments
 (0)