-
Notifications
You must be signed in to change notification settings - Fork 168
72 lines (72 loc) · 2.85 KB
/
Copy pathplaywright.yml
File metadata and controls
72 lines (72 loc) · 2.85 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
name: Running Playwright test on UI
on:
push:
branches: [main]
paths:
- 'static/nginxaas-azure/js/cost-calculator_v2.js'
- 'content/nginxaas-azure/billing/usage-and-cost-estimator.md'
- 'static/nginxaas/google/js/cost-calculator_gc.js'
- 'content/nginxaas/google/billing/usage-and-cost-estimator.md'
pull_request:
paths:
- 'static/nginxaas-azure/js/cost-calculator_v2.js'
- 'content/nginxaas-azure/billing/usage-and-cost-estimator.md'
- 'static/nginxaas/google/js/cost-calculator_gc.js'
- 'content/nginxaas/google/billing/usage-and-cost-estimator.md'
permissions:
contents: read
jobs:
get-playwright-version:
name: Get Playwright Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.get-playwright-version.outputs.version }}
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Get version from package.json
id: get-playwright-version
run: |
version=$(jq -r '.devDependencies["@playwright/test"] // .dependencies["@playwright/test"]' package.json)
test -n "$version" || { echo "No @playwright/test version found in package.json"; exit 1; }
echo "version=$version" >> $GITHUB_OUTPUT
echo "Version: " $version
run-playwright-tests:
name: Run Playwright
needs: get-playwright-version
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v${{needs.get-playwright-version.outputs.version}}-jammy
steps:
- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0
with:
hugo-version: '0.147.8'
extended: true
- uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 #v6.2.0
with:
go-version: '1.24.6'
- name: Install dependencies
run: npm ci
- name: Run Playwright tests
id: test-ui
# Check done to set the home variable. Workaround as browser is unable to launch if the $HOME folder isn't owned by the current user.
if: ${{ runner.os == 'Linux' }}
env:
HOME: /root
run: |
git config --global --add safe.directory /__w/documentation/documentation
cd tests && npx playwright test | tee output.log
if grep -q "failed" output.log; then
echo "Playwright tests failed. Please view the Playwright report to see full error."
exit 1
fi
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
id: artifact-upload
if: ${{ !cancelled() && failure() && steps.test-ui.conclusion == 'failure' }}
with:
name: playwright-report
path: tests/playwright-report/
retention-days: 3