Skip to content

Commit 5bb3d91

Browse files
committed
Capture Cypress screenshots using headless for consistent results no matter which computer/monitor it's run on
1 parent 8b4faaa commit 5bb3d91

File tree

100 files changed

+3
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

100 files changed

+3
-4
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ cypress/videos
1212
cypress/screenshots/*
1313

1414
# Whitelist manual visual regression screenshot directories
15-
!cypress/screenshots/viewport
16-
!cypress/screenshots/readme
15+
!cypress/screenshots/viewport.cy.ts
16+
!cypress/screenshots/readme.cy.ts
1717

1818
# Test results
1919
results/*.xml
-78.1 KB
Binary file not shown.

screenshot.png

86 Bytes

scripts/screenshot.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Y=80
99

1010
# Install Cypress first before running this script
1111

12-
# TODO: Fix screenshots not being taken when run in headless (run in non-headless for now)
1312
./node_modules/.bin/cypress run --spec cypress/e2e/misc/screenshot.cy.ts
1413

1514
# Crop filter adapted from: https://video.stackexchange.com/a/4571
@@ -18,4 +17,4 @@ Y=80
1817
# TODO: Add video screenshot
1918
# ffmpeg -y -ss 5 -i cypress/videos/screenshot.cy.ts.mp4 -filter:v "crop=$WIDTH:$HEIGHT:$X:$Y,fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 $OUTPUT_FILE
2019

21-
magick convert cypress/screenshots/readme/screenshot.png -resize 50% screenshot.png
20+
magick convert cypress/screenshots/screenshot.cy.ts/readme/screenshot.png -resize 50% screenshot.png

0 commit comments

Comments
 (0)