-
Notifications
You must be signed in to change notification settings - Fork 28
add snapshot checking in CI #1587
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Update Snapshots on a PR | ||
description: | | ||
Runs previously failed snapshot tests, and commits the changes. | ||
|
||
Your PR will receive a commit with the changes so you can manually verify before merging. | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
pr_number: | ||
description: 'Pull Request Number (Warning: This action will push a commit to the referenced PR)' | ||
required: true | ||
type: number | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
update-pr-with-snapshots: | ||
name: Update PR With Snapshots | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout PR ${{ github.event.inputs.pr_number }} | ||
if: github.event_name == 'workflow_dispatch' | ||
run: gh pr checkout ${{ github.event.inputs.pr_number }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.npm | ||
~/.cache/ms-playwright | ||
key: ${{ runner.os }}-node-playwright-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-playwright- | ||
${{ runner.os }}-node- | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build all | ||
run: npm run build | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
|
||
- name: Run Screenshot tests | ||
id: screenshot_tests | ||
run: npm run test-int-snapshots | ||
|
||
- if: ${{ steps.screenshot_tests.conclusion == 'success' }} | ||
run: | | ||
echo "nothing to update - tests all passed" | ||
|
||
- name: Re-Running Playwright to update snapshots | ||
id: screenshot_tests_update | ||
if: ${{ failure() && steps.screenshot_tests.conclusion == 'failure' }} | ||
run: npm run test-int-snapshots-update | ||
|
||
- name: Commit the updated files to the PR branch | ||
if: ${{ failure() && steps.screenshot_tests_update.conclusion == 'success' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
# Configure Git with a bot's username and email for committing changes | ||
# This makes it easy to identify in the PR | ||
git config user.name "github-actions[bot]" | ||
git config user.email "github-actions[bot]@users.noreply.github.com" | ||
|
||
# Stage all updated PNG files for commit | ||
git add "*.png" | ||
|
||
# Commit the changes with a descriptive message | ||
git commit -m "Updated snapshots via workflow" | ||
|
||
# Push the changes to the current branch in the PR | ||
git push origin HEAD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Test Snapshots | ||
description: | | ||
Runs snapshot tests and uploads test reports as artifacts | ||
|
||
If this workflow fails, you can trigger `update-snapshots.yml` from the | ||
GitHub UI. | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
snapshots: | ||
timeout-minutes: 5 | ||
runs-on: macos-14 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: '.nvmrc' | ||
- uses: actions/cache@v4 | ||
with: | ||
path: | | ||
~/.npm | ||
~/.cache/ms-playwright | ||
key: ${{ runner.os }}-node-playwright-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-node-playwright- | ||
${{ runner.os }}-node- | ||
|
||
- run: npm ci | ||
- run: npm run build | ||
|
||
- run: npm run lint | ||
continue-on-error: true | ||
|
||
- run: npm run stylelint | ||
continue-on-error: true | ||
|
||
- run: npm run test-unit | ||
continue-on-error: true | ||
|
||
- name: 'Clean tree' | ||
run: 'npm run test-clean-tree' | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
|
||
- run: npm run test-int-snapshots | ||
|
||
- uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: playwright-report-pages | ||
path: | | ||
special-pages/playwright-report | ||
special-pages/test-results | ||
injected/playwright-report | ||
injected/test-results | ||
retention-days: 5 |
Binary file modified
BIN
-2.72 KB
(92%)
...integration-test/duckplayer-mobile.spec.js-snapshots/overlay-android-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+131 Bytes
(100%)
...screenshots.spec.js-snapshots/youtube-error-sign-in-required-android-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+5.95 KB
(120%)
...s.spec.js-snapshots/youtube-error-sign-in-required-android-landscape-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-29 Bytes
(100%)
...yer-screenshots.spec.js-snapshots/youtube-error-sign-in-required-ios-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.14 KB
(100%)
...r-screenshots.spec.js-snapshots/youtube-error-sign-in-required-macos-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+520 Bytes
(100%)
...screenshots.spec.js-snapshots/youtube-error-sign-in-required-windows-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1.55 KB
(100%)
...ckplayer-screenshots.spec.js-snapshots/youtube-error-unknown-android-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.6 KB
(130%)
...creenshots.spec.js-snapshots/youtube-error-unknown-android-landscape-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+1002 Bytes
(100%)
...s/duckplayer-screenshots.spec.js-snapshots/youtube-error-unknown-ios-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+994 Bytes
(100%)
...duckplayer-screenshots.spec.js-snapshots/youtube-error-unknown-macos-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
-303 Bytes
(99%)
...ckplayer-screenshots.spec.js-snapshots/youtube-error-unknown-windows-darwin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.