-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test, playwright - adapt smoke test workflow for better playwright tests
- Externalize a custom action to simplify workflow - Upload the whole output folder as artefact - Add a new input to update snapshot in cache before running tests
- Loading branch information
Showing
2 changed files
with
79 additions
and
13 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
.github/workflows/actions/setup-playwright-tests/action.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: "Setup playwright tests" | ||
description: "Install Playwright, and restore snapshot cache or update snapshots" | ||
inputs: | ||
playwright-tests-path: | ||
description: "Path to playwright tests" | ||
required: true | ||
default: "./tests/integration/playwright" | ||
playwright-snapshots-path: | ||
description: "Path to playwright snapshot path" | ||
required: true | ||
default: "./tests/integration/playwright/.test/spec/snaps" | ||
update-snapshots: | ||
description: "Update Playwright Snapshots?" | ||
type: boolean | ||
required: false | ||
default: false | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install node if necessary | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install tests dependencies | ||
run: yarn | ||
working-directory: ${{ inputs.playwright-tests-path }} | ||
shell: bash | ||
|
||
- name: Install Playwright Browsers | ||
run: npx playwright install --with-deps | ||
working-directory: ${{ inputs.playwright-tests-path }} | ||
shell: bash | ||
|
||
- name: Set up cache for snapshot playwright tests | ||
id: cache-playwright | ||
uses: actions/cache@v4 | ||
with: | ||
key: cache/${{github.repository}}/${{github.ref}} | ||
restore-keys: cache/${{github.repository}}/refs/heads/main | ||
path: ${{ inputs.playwright-snapshots-path }} | ||
|
||
- name: Initialize snapshots | ||
if: ${{steps.cache-playwright.outputs.cache-hit != 'true' || inputs.update-snapshots == 'true'}} | ||
run: npx playwright test --update-snapshots | ||
working-directory: ${{ inputs.playwright-tests-path }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters