-
Notifications
You must be signed in to change notification settings - Fork 102
154 lines (138 loc) · 4.63 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
151
152
153
154
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
codeload.github.com:443
dl-cdn.alpinelinux.org:443
dl-cdn.alpinelinux.org:80
downloads.wordpress.org:443
frsnacprodeus2file1.blob.core.windows.net:443
ghcr.io:443
github.com:443
nodejs.org:443
pkg-containers.githubusercontent.com:443
planet.wordpress.org:443
playwright.azureedge.net:443
production.cloudflare.docker.com:443
public-api.wordpress.com:443
registry-1.docker.io:443
registry.npmjs.org:443
s.w.org:443
update.containous.cloud:443
update.traefik.io:443
vaultpress.com:443
wordpress.org:443
dns.google:53
e2e-test-site.vipdev.lndo.site:80
playwright-akamai.azureedge.net:443
playwright-verizon.azureedge.net:443
playwright.azureedge.net:443
ppa.launchpad.net:80
ppa.launchpad.net:443
azure.archive.ubuntu.com:80
azure.archive.ubuntu.com:443
packages.microsoft.com:443
download.cypress.io:443
cdn.cypress.io:443
foresight.service.thundra.io:443
foresight-cli-test-artifact-prod.s3-accelerate.amazonaws.com:443
upload.service.runforesight.com:443
api.service.runforesight.com:443
api.wpvip.com:443
- name: Check out repository code
uses: actions/checkout@v3.3.0
with:
submodules: true
- name: Prepare source code
uses: ./.github/actions/prepare-source
- name: Setup Node
uses: actions/setup-node@v3.6.0
with:
node-version: 'lts/*'
cache: npm
cache-dependency-path: __tests__/e2e/package-lock.json
- name: Instrument workflow processes for E2E tests
uses: runforesight/foresight-workflow-kit-action@v1
if: success() || failure()
with:
api_key: ${{secrets.FORESIGHT_API_KEY}}
- 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@2.24.2
- 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: Instrument Tests in ForeSight
if: success() || failure()
uses: thundra-io/foresight-test-kit-action@v1
with:
api_key: ${{secrets.FORESIGHT_API_KEY}}
test_format: JUNIT
test_framework: JEST
test_path: __tests__/e2e/results.xml
- name: Archive test results
uses: actions/upload-artifact@v3
if: failure()
with:
name: test-results
path: |
__tests__/e2e/test-results
__tests__/e2e/screenshots