Skip to content

Commit

Permalink
More screenshot tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
vpetersson committed Dec 7, 2024
1 parent 0d91e89 commit a47d2ce
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
mkdir -p __image_snapshots__/__diff_output__
# Run tests with update flag to generate snapshots and JSON output
ARTIFACTS_DIR="$(pwd)/__image_snapshots__" xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" npm run test:visual:ci -- -u --json --outputFile=visual-test-results.json
CI=1 ARTIFACTS_DIR="$(pwd)/__image_snapshots__" xvfb-run --auto-servernum --server-args="-screen 0 1280x800x24" npm run test:visual:ci -- -u --json --outputFile=visual-test-results.json
- name: Generate visual test summary
if: always()
Expand All @@ -74,6 +74,15 @@ jobs:
}
echo "" >> $GITHUB_STEP_SUMMARY
# Debug info
echo "### Debug Info" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
pwd >> $GITHUB_STEP_SUMMARY
echo "Directory contents:" >> $GITHUB_STEP_SUMMARY
ls -R __image_snapshots__/ >> $GITHUB_STEP_SUMMARY 2>&1 || echo "No snapshots directory found" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Function to embed image
embed_image() {
local img="$1"
Expand All @@ -88,28 +97,20 @@ jobs:
fi
}
# Debug info
echo "### Debug Info" >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
ls -la __image_snapshots__/ >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Show each screenshot
echo "### Screenshots" >> $GITHUB_STEP_SUMMARY
shopt -s nullglob # Handle case when no files match pattern
for img in __image_snapshots__/*.png; do
if [ -e "$img" ]; then
name=$(basename "$img" -snap.png | sed 's/ci-//')
echo "#### $name" >> $GITHUB_STEP_SUMMARY
embed_image "$img"
fi
name=$(basename "$img" -snap.png | sed 's/ci-//')
echo "#### $name" >> $GITHUB_STEP_SUMMARY
embed_image "$img"
done
# Show any diffs
if [ -d "__image_snapshots__/__diff_output__" ] && [ "$(ls -A __image_snapshots__/__diff_output__)" ]; then
if [ -d "__image_snapshots__/__diff_output__" ]; then
echo "### ⚠️ Visual Differences" >> $GITHUB_STEP_SUMMARY
for diff in __image_snapshots__/__diff_output__/*.png; do
if [ -e "$diff" ]; then
if [ -f "$diff" ]; then
name=$(basename "$diff" .png | sed 's/ci-//' | sed 's/-diff//')
echo "#### $name (diff)" >> $GITHUB_STEP_SUMMARY
embed_image "$diff"
Expand Down

0 comments on commit a47d2ce

Please sign in to comment.