-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (49 loc) · 1.84 KB
/
playwright.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Playwright Tests
on: pull_request
permissions:
contents: read
actions: write
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Download baseline snapshots
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ARTIFACT_NAME: baseline_${{ github.base_ref }}
run: |
# actions/download-artifact@v3 does not support downloading artifacts from workflow.
# issues: https://github.com/actions/toolkit/issues/501
# so, use gh cli.
artifact_id=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${{ github.repository }}/actions/artifacts?name=${{ env.ARTIFACT_NAME}}" \
| jq -r '.artifacts[0].id')
gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"/repos/${{ github.repository }}/actions/artifacts/${artifact_id}/zip" >> baseline.zip
unzip baseline.zip -d playwright/screenshots
pwd
tree ./playwright
rm -rf baseline.zip
- uses: actions/setup-node@v3
with:
node-version-file: ".node-version"
- uses: pnpm/action-setup@v2
- run: pnpm install
- name: Install Playwright Browsers
run: pnpm exec playwright install --with-deps
- name: Run Playwright tests
run: pnpm exec playwright test
# If you want to view the report via artifact, you need to manually download the zip once and view it.
# If you want to browse via url, you can easily browse by uploading to aws s3, gcp gcs, etc.
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30