-
Notifications
You must be signed in to change notification settings - Fork 102
150 lines (131 loc) · 4.11 KB
/
e2e.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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
name: Run e2e tests
on:
pull_request:
workflow_dispatch:
inputs:
wpversion:
description: 'WordPress version to run tests against'
required: false
default: 'latest'
url:
description: 'Alternative Test URL'
required: false
default: ''
user:
description: 'Alternative User Name'
required: false
default: ''
password:
description: 'Alternative Password'
required: false
default: ''
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
DO_NOT_TRACK: "1"
jobs:
Run_e2e_tests:
name: Run E2E Tests
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@v2
with:
egress-policy: block
allowed-endpoints:
1.gravatar.com:80
2.gravatar.com:80
api.github.com:443
api.wordpress.org:443
artifactcache.actions.githubusercontent.com:443
auth.docker.io:443
dl-cdn.alpinelinux.org:443
docker.io:443
downloads.wordpress.org:443
e2e-test-site.vipdev.lndo.site:443
geoip.elastic.co:443
ghcr.io:443
github.com:443
nodejs.org:443
objects.githubusercontent.com:443
pkg-containers.githubusercontent.com:443
planet.wordpress.org:443
playwright.azureedge.net:443
production.cloudflare.docker.com:443
public-api.wordpress.com:443
raw.githubusercontent.com:443
registry-1.docker.io:443
registry.npmjs.org:443
s.w.org:443
storage.googleapis.com:443
vaultpress.com:443
wordpress.org:443
- name: Check out repository code
uses: actions/[email protected]
with:
submodules: true
- name: Prepare source code
uses: ./.github/actions/prepare-source
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: __tests__/e2e/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: __tests__/e2e
- name: Install Playwright with Chromium
run: npx playwright install chromium
working-directory: __tests__/e2e
- name: Install VIP CLI
run: npm install -g @automattic/vip
- name: Determine WP version
run: |
if [ -z "${{ github.event.inputs.wpversion }}" ]; then
echo "WORDPRESS_VERSION=latest" >> $GITHUB_ENV
else
echo "WORDPRESS_VERSION=${{ github.event.inputs.wpversion }}" >> $GITHUB_ENV
fi
- name: Setup test env variables
if: ${{ github.event.inputs.url != '' }}
run: |
echo "E2E_BASE_URL=${{ github.event.inputs.url }}" >> $GITHUB_ENV
echo "E2E_USER=${{ github.event.inputs.user }}" >> $GITHUB_ENV
echo "E2E_PASSWORD=${{ github.event.inputs.password }}" >> $GITHUB_ENV
- name: Run e2e tests
run: npm test
working-directory: __tests__/e2e
- name: Archive test results
uses: actions/upload-artifact@v4
if: failure()
with:
name: test-results
path: |
__tests__/e2e/test-results
__tests__/e2e/screenshots
lint_e2e:
name: Run ESLint on E2E tests
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/[email protected]
with:
egress-policy: audit
- name: Check out repository code
uses: actions/[email protected]
- name: Setup Node
uses: actions/[email protected]
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: __tests__/e2e/package-lock.json
- name: Install dependencies
run: npm ci
working-directory: __tests__/e2e
- name: Run ESLint
run: npm run lint
working-directory: __tests__/e2e