-
Notifications
You must be signed in to change notification settings - Fork 172
81 lines (66 loc) · 2.83 KB
/
Copy pathplaywright.yml
File metadata and controls
81 lines (66 loc) · 2.83 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# Security Notes
# Only selected Actions are allowed within this repository. Please refer to (https://github.com/nodejs/learn/settings/actions)
# for the full list of available actions. If you want to add a new one, please reach out a maintainer with Admin permissions.
# REVIEWERS, please always double-check security practices before merging a PR that contains workflow changes!!
# AUTHORS, please only use actions with explicit SHA references, and avoid using `@master` or `@main` references or `@version` tags.
name: Playwright Tests
# Runs end-to-end tests against the Vercel preview of each pull request, so the
# site is exercised exactly as Vercel builds it (VERCEL_ENV=preview), not just
# as it builds locally. Ported from nodejs/nodejs.org's playwright.yml.
#
# Unlike nodejs.org, Dependabot PRs are NOT skipped here: dependency bumps
# (e.g. doc-kit, #138) are one of the likeliest ways for Learn to break.
on:
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
actions: read
jobs:
playwright:
name: Playwright Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup Node.js
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version-file: '.nvmrc'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Capture Vercel Preview
id: deployment
uses: patrickedqvist/wait-for-vercel-preview@d7982701e6fcd3ae073bff929e408e004404d38d # v1.3.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
max_timeout: 300 # timeout after 5 minutes
check_interval: 10 # check every 10 seconds
- name: Get Playwright version
id: playwright-version
run: echo "version=$(node_modules/.bin/playwright --version | awk '{print $2}')" >> "$GITHUB_OUTPUT"
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ steps.playwright-version.outputs.version }}
- name: Install Playwright Browsers
run: node_modules/.bin/playwright install --with-deps chromium
- name: Run Playwright tests
run: node --run test:e2e
env:
PLAYWRIGHT_BASE_URL: ${{ steps.deployment.outputs.url }}
- name: Upload Playwright test results
if: always()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report
path: playwright-report/