Skip to content
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

QAH-354 | Add GHA workflow to update playwright visual test snapshots #387

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/update-visual-test-snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and update visual test snapshots for playwright tests.
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

permissions:
contents: write
packages: write
id-token: write

name: Update Visual Test Snapshots
on:
workflow_dispatch: # Allow manual triggers
inputs:
target_branch:
description: "The branch to push the updated snapshots to"
required: true
type: string

jobs:
update_snapshots:
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.32.1-focal
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: ./.github/actions/node-step
with:
npm-auth-token: ${{ secrets.NPM_TOKEN }}

- name: Install browsers
run: npx playwright install --with-deps chromium firefox webkit
shell: bash

- name: Run update snapshots
run: HOME=/root npm run e2e-update-snapshots

- name: Push Changes to target branch
run: |
git config --global --add safe.directory /__w/golden-sample-app/golden-sample-app
git checkout ${{ github.event.inputs.target_branch }}
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Update Playwright visual test snapshots"
git push origin ${{ github.event.inputs.target_branch }}
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@
"e2e-test-sndbx-all": "nx run golden-sample-app-e2e:e2e-localhost-ebp-sndbx",
"e2e-test-sndbx-ci": "nx run golden-sample-app-e2e:e2e-localhost-ebp-sndbx --args='test --config=playwright.localhost.config.ts --project=localhost-ebp-sndbx --grep=@identity'",
"e2e-test-responsive": "npx playwright test --project 'mobile-chrome' --grep '@visual.+@responsive|@responsive.+@visual' --workers=2",
"e2e-update-snapshots": "npx playwright test --project 'mobile-chrome' --grep '@visual' --update-snapshots --workers=1",
"lint": "nx run-many --all --target=lint",
"format": "prettier --write \"{apps,libs}/**/*.{ts,md,html}\" \"!{apps,libs}/**/coverage\" ",
"format:check": "prettier --list-different \"{apps,libs}/**/*.{ts,md}\" \"!{apps,libs}/**/coverage\"",