Skip to content

Support 'use original image' for header images #29

Support 'use original image' for header images

Support 'use original image' for header images #29

Workflow file for this run

name: Run e2e tests
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
AUNTY_HOST: localhost # This tells aunty to serve on localhost
TERMINUS_FETCH_API_KEY: ${{ secrets.TERMINUS_FETCH_API_KEY }}
jobs:
e2e:
runs-on: ubuntu-latest
steps:
- name: Checkout the PR branch
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install dependencies
run: npm ci
- name: Install Playwright browsers
run: npx playwright install --with-deps
- name: Setup terminus API key
run: echo "TERMINUS_FETCH_API_KEY=$TERMINUS_FETCH_API_KEY" > .env
- name: Run Playwright tests
run: |
npm run test | tee >(sed $'s/\033[[][^A-Za-z]*[A-Za-z]//g' > output.log)
if grep -q -F -e "Error: A snapshot doesn't exist at" -e "Screenshot comparison failed" -e "Error: expect(locator).toHaveScreenshot(expected)" output.log; then
echo "Playwright tests failed due to a snapshot issue."
echo "SNAPSHOT_DIFFERENCES=true" >> $GITHUB_ENV
exit 1
elif grep -q "failed" output.log; then
echo "Playwright tests failed due to a non-snapshot issue."
exit 1
fi
- uses: actions/upload-artifact@v4
id: artifact-upload
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
- name: Comment on PR with report link
uses: thollander/actions-comment-pull-request@v3
if: ${{ failure() && env.SNAPSHOT_DIFFERENCES == 'true' }}
with:
message: |
### Playwright visual snapshot differences were detected.
View the [Playwright report](${{ steps.artifact-upload.outputs.artifact-url }}) to review the visual differences.
**To approve the snapshot changes and update the snapshots, please comment:** /approve-snapshots