refactor(screenshots): run a single component

This commit is contained in:
Maria Hutt
2023-07-21 08:47:00 -07:00
parent 38626d9680
commit 0bde81d4a4
2 changed files with 24 additions and 1 deletions

View File

@@ -7,6 +7,11 @@ inputs:
description: 'Playwright total number of test shards (ex: 4)'
update:
description: 'Whether or not to update the reference snapshots'
component:
description: 'The component to update the reference snapshots'
component-folder:
description: 'The component folder to update the reference snapshots'
type: boolean
runs:
using: 'composite'
@@ -47,7 +52,13 @@ runs:
# which is why we not using the upload-archive
# composite step here.
run: |
npm run test.e2e -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }} --update-snapshots
FILE_PATH=""
if [ -n "${{ inputs.component }}" ] && [ "${{ inputs.component-folder }}" == "true" ]; then
FILE_PATH=${{ inputs.component }}
elif [ -n "${{ inputs.component }}" ]; then
FILE_PATH="src/components/${{ inputs.component }}/"
fi
npm run test.e2e ${{FILE_PATH}} -- --shard=${{ inputs.shard }}/${{ inputs.totalShards }} --update-snapshots
git add src/\*.png --force
mkdir updated-screenshots
cd ../ && rsync -R --progress $(git diff --name-only --cached) core/updated-screenshots

View File

@@ -2,6 +2,16 @@ name: 'Update Reference Screenshots'
on:
workflow_dispatch:
inputs:
component:
description: 'Which component should be updated? (leave blank to update all)'
required: false
default: ''
component-folder:
description: 'If a component is selected, should it only update its respective folder? (leave blank to update all)'
required: false
default: true
type: boolean
jobs:
build-core:
@@ -34,6 +44,8 @@ jobs:
shard: ${{ matrix.shard }}
totalShards: ${{ matrix.totalShards }}
update: true
component: ${{ inputs.component}}
component-folder: ${{ inputs.component-folder}}
update-reference-screenshots:
runs-on: ubuntu-latest