Skip to content

Commit

Permalink
Add visual testing
Browse files Browse the repository at this point in the history
Add Percy.io visual testing
  • Loading branch information
brianlove committed Jul 21, 2023
1 parent bbd5491 commit 5e80e33
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/visual-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Percy visual testing

on:
pull_request:
push:
branches:
- version2

jobs:
build:
name: percy-tests
runs-on: ubuntu-latest
env:
app-dir: ./web/gui-v2

permissions:
contents: 'read'
id-token: 'write'

steps:
- uses: actions/checkout@v3
- name: 'Authenticate to Google Cloud'
id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
workload_identity_provider: 'projects/855475113448/locations/global/workloadIdentityPools/eto-github/providers/eto-github'
service_account: 'eto-artifact-registry-github@gcp-cset-projects.iam.gserviceaccount.com'
token_format: 'access_token'
- name: 'Log into Artifact Registry'
uses: 'docker/login-action@v2'
with:
registry: us-east1-docker.pkg.dev
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install dependencies
run: |
npm run artifactregistry-login
npm install
npm install --save-dev @percy/cli
shell: bash
working-directory: ${{ env.app-dir }}
- name: Run server
run: |
npm run build
npm run serve -- -p 8550 &
shell: bash
working-directory: ${{ env.app-dir }}
- name: Snapshot with Percy
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
run: |
sleep 20 &&
npm run percy-snapshot
shell: bash
working-directory: ${{ env.app-dir }}
1 change: 1 addition & 0 deletions web/gui-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"serve": "gatsby serve",
"clean": "gatsby clean",
"test": "jest",
"percy-snapshot": "npx percy snapshot snapshots.yml",
"artifactregistry-login": "npx google-artifactregistry-auth",
"arlogin": "npm run artifactregistry-login"
},
Expand Down
2 changes: 2 additions & 0 deletions web/gui-v2/snapshots.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- name: List view, unfiltered
url: http://localhost:8550

0 comments on commit 5e80e33

Please sign in to comment.