forked from elementor/elementor
-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (193 loc) · 7.06 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
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: Playwright
on:
pull_request:
paths-ignore:
- '**.md'
- '**.txt'
- '.github/config.json'
- 'bin/**'
- '.gitignore'
- 'docs/**'
schedule:
- cron: '30 08 * * 0,1,2,3,4,5'
workflow_dispatch:
inputs:
reporter:
required: false
description: 'Select a reporter'
type: choice
options:
- allure-playwright
- html
- blob
- list
default: allure-playwright
path-to-results:
required: false
description: 'Provide path to reporter files'
default: allure-results
type: choice
options:
- test-results/
- tests/playwright/blob-report
- allure-results
fail_fast:
type: boolean
required: true
description: 'Cancel tests when one of them fails'
default: false
tag:
description: 'Provide @tag or a keyword'
required: false
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}'
cancel-in-progress: true
jobs:
build-plugin:
name: Build plugin
uses: ./.github/workflows/build.yml
Playwright:
name: Playwright test - ${{ matrix.shardIndex }} on PHP 8.0
runs-on: ubuntu-latest
needs: [build-plugin]
if: ${{ ( github.event.pull_request.title == null || needs.build-plugin.outputs.changelog_diff ) && github.event.inputs.tag == '' }}
strategy:
fail-fast: ${{ inputs.fail_fast || false }}
matrix:
shardIndex: [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
shardTotal: [ 10 ]
include:
- shardIndex: "elements-regression"
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: |
npm ci
sed -i -e "s/image: 'mariadb:lts'/image: 'mariadb:11.2.4-jammy'/g" node_modules/@wordpress/env/lib/build-docker-compose-config.js
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-plugin.outputs.artifact_name }}
path: ./build
- name: Update wp-env.json file
env:
PHP_VERSION: '8.0'
WP_CORE_VERSION: 'latest'
run: node ./.github/scripts/build-wp-env.js
- name: Install WordPress environment
run: |
npm run start-local-server
- name: Update wordpress to nightly build
if: ${{ github.event_name == 'schedule' }}
run: npx wp-env run cli wp core update https://wordpress.org/nightly-builds/wordpress-latest.zip
- name: Setup test data
run: npm run test:setup:playwright
- name: WordPress debug information
run: |
npx wp-env run cli wp core version
npx wp-env run cli wp --info
- name: Install playwright/test
run: |
npx playwright install chromium
- name: Run Playwright tests
if: ${{ matrix.shardIndex != 'elements-regression' }}
run: npm run test:playwright -- --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=${{ inputs.reporter || 'list,github' }}
- name: Run element regression tests
if: ${{ matrix.shardIndex == 'elements-regression' }}
run: npm run test:playwright:elements-regression -- --reporter=${{ inputs.reporter || 'list,github' }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results-${{ matrix.shardIndex }}
path: ${{ inputs.path-to-results || 'test-results/' }}
if-no-files-found: ignore
retention-days: 2
PlaywrightWithTag:
name: Playwright test - tagged tests on PHP 8.0
runs-on: ubuntu-latest
needs: [ build-plugin ]
if: ${{ github.event.inputs.tag }}
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Install dependencies
run: |
npm ci
sed -i -e "s/image: 'mariadb:lts'/image: 'mariadb:11.2.4-jammy'/g" node_modules/@wordpress/env/lib/build-docker-compose-config.js
- name: Download build artifact
uses: actions/download-artifact@v4
with:
name: ${{ needs.build-plugin.outputs.artifact_name }}
path: ./build
- name: Update wp-env.json file
env:
PHP_VERSION: '8.0'
WP_CORE_VERSION: 'latest'
run: node ./.github/scripts/build-wp-env.js
- name: Install WordPress environment
run: |
npm run start-local-server
- name: Setup test data
run: npm run test:setup:playwright
- name: WordPress debug information
run: |
npx wp-env run cli wp core version
npx wp-env run cli wp --info
- name: Install playwright/test
run: |
npx playwright install chromium
- name: Run Playwright tests
run: |
npm run test:playwright -- --grep="${{ inputs.tag }}" --reporter=list,allure-playwright
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-test-results-tagged-tests
path: ${{ inputs.path-to-results || 'test-results/' }}
if-no-files-found: ignore
retention-days: 2
test-result:
needs: Playwright
if: ${{ always() }} # Will be run even if 'Playwright' matrix will be skipped
runs-on: ubuntu-22.04
name: Playwright - Test Results
steps:
- name: Test status
run: echo "Test status is - ${{ needs.Playwright.result }}"
- name: Checkout source code
if: ${{ needs.Playwright.result == 'failure' && github.event_name == 'schedule' }}
uses: actions/checkout@v4
- name: Send slack message
if: ${{ needs.Playwright.result == 'failure' && github.event_name == 'schedule' }}
uses: ./.github/workflows/post-to-slack
with:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_TOKEN }}
SLACK_TAG_CHANNELS: ${{ secrets.TEST_AUTOMATION_RESULTS }}
PAYLOAD: |
{
"text": "Elementor Core: Playwright with WordPress nightly has failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Elementor Core: Playwright with WordPress nightly failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
- name: Check Playwright matrix status
if: ${{ needs.Playwright.result != 'success' && needs.Playwright.result != 'skipped' }}
run: exit 1