Skip to content

Commit d8b0d45

Browse files
committed
gha
1 parent 6001653 commit d8b0d45

2 files changed

Lines changed: 44 additions & 11 deletions

File tree

.github/actions/post-maestro-screenshot/action.yml

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,49 @@ runs:
2323
id: check-screenshot
2424
shell: bash
2525
run: |
26-
SS_FILE="$HOME/output/screenshots/${{ inputs.platform }}-tests-completed.png"
26+
# First try the expected location with new naming
27+
SS_FILE="$HOME/output/screenshots/${{ inputs.platform }}-test-result.png"
28+
2729
if [ -f "$SS_FILE" ]; then
2830
echo "exists=true" >> $GITHUB_OUTPUT
2931
echo "file_path=$SS_FILE" >> $GITHUB_OUTPUT
3032
echo "Screenshot found at $SS_FILE"
3133
else
32-
echo "exists=false" >> $GITHUB_OUTPUT
33-
echo "Screenshot not found at $SS_FILE"
34-
echo "Listing output directory contents:"
35-
ls -lR $HOME/output/ || echo "Output directory does not exist"
34+
# If not found, look in the timestamped directories
35+
echo "Screenshot not found at expected location: $SS_FILE"
36+
echo "Searching for screenshots in timestamped directories..."
37+
38+
# Find the most recent timestamped directory
39+
LATEST_DIR=$(find $HOME/output -maxdepth 1 -type d -name "20*" 2>/dev/null | sort -r | head -1)
40+
41+
if [ -n "$LATEST_DIR" ]; then
42+
echo "Found timestamped directory: $LATEST_DIR"
43+
44+
# Look for screenshot matching our naming pattern (Maestro may add emojis/timestamps to the filename)
45+
# We use the name we specified: ${PLATFORM}-test-result
46+
SCREENSHOT=$(find "$LATEST_DIR" -name "*${{ inputs.platform }}-test-result*.png" 2>/dev/null | head -1)
47+
48+
if [ -z "$SCREENSHOT" ]; then
49+
# Fallback: look for any screenshot file
50+
echo "No platform-specific screenshot found, looking for any screenshot..."
51+
SCREENSHOT=$(find "$LATEST_DIR" -name "screenshot-*.png" 2>/dev/null | head -1)
52+
fi
53+
54+
if [ -n "$SCREENSHOT" ] && [ -f "$SCREENSHOT" ]; then
55+
echo "exists=true" >> $GITHUB_OUTPUT
56+
echo "file_path=$SCREENSHOT" >> $GITHUB_OUTPUT
57+
echo "Screenshot found at $SCREENSHOT"
58+
else
59+
echo "exists=false" >> $GITHUB_OUTPUT
60+
echo "No screenshots found in $LATEST_DIR"
61+
ls -la "$LATEST_DIR" || true
62+
fi
63+
else
64+
echo "exists=false" >> $GITHUB_OUTPUT
65+
echo "No timestamped directories found"
66+
echo "Listing output directory contents:"
67+
ls -lR $HOME/output/ || echo "Output directory does not exist"
68+
fi
3669
fi
3770
3871
- name: Upload screenshot to ImgBB

example/test/e2e/test-suites-flow.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ jsEngine: graaljs
2727
- waitForAnimationToEnd:
2828
timeout: 2000
2929

30-
# Take screenshot after selecting all
31-
- takeScreenshot: ${PLATFORM}-tests-selected
30+
# Take screenshot after selecting all (will be overwritten)
31+
- takeScreenshot: ${PLATFORM}-test-result
3232

3333
# Run all tests by tapping "Run"
3434
- tapOn: 'Run'
@@ -37,8 +37,8 @@ jsEngine: graaljs
3737
- waitForAnimationToEnd:
3838
timeout: 5000
3939

40-
# Take screenshot of tests running
41-
- takeScreenshot: ${PLATFORM}-tests-running
40+
# Take screenshot of tests running (will be overwritten)
41+
- takeScreenshot: ${PLATFORM}-test-result
4242

4343
# Wait for all tests to complete by waiting for completion stats to appear
4444
# The completion-stats element shows "✅ X | ❌ Y | ⏱️ Zms" when all tests finish
@@ -47,8 +47,8 @@ jsEngine: graaljs
4747
id: 'completion-stats'
4848
timeout: 60000
4949

50-
# Take final screenshot
51-
- takeScreenshot: ${PLATFORM}-tests-completed
50+
# Take final screenshot (this is the one we want to keep)
51+
- takeScreenshot: ${PLATFORM}-test-result
5252

5353
# Verify no test suites have failures
5454
- evalScript: ${output.suiteIndex = 0}

0 commit comments

Comments
 (0)