diff --git a/.github/workflows/actions/test-core-screenshot/action.yml b/.github/workflows/actions/test-core-screenshot/action.yml index afb213fcb1..2f64d87d86 100644 --- a/.github/workflows/actions/test-core-screenshot/action.yml +++ b/.github/workflows/actions/test-core-screenshot/action.yml @@ -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 diff --git a/.github/workflows/update-screenshots.yml b/.github/workflows/update-screenshots.yml index 7ff2c49901..d933a92767 100644 --- a/.github/workflows/update-screenshots.yml +++ b/.github/workflows/update-screenshots.yml @@ -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