Skip to content

Commit 3e192de

Browse files
committed
feat: shard tests across multiple runners with integrated testservice & job to collect reports
1 parent 0795218 commit 3e192de

File tree

2 files changed

+62
-8
lines changed

2 files changed

+62
-8
lines changed

.github/workflows/precommit-crit-flows.yml

Lines changed: 60 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,21 +163,37 @@ jobs:
163163

164164
e2e_crit_flow:
165165
name: Playwright Critical Flow (precommit)
166-
if: ${{ github.repository == 'wireapp/wire-webapp' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot' }}
167-
runs-on: [self-hosted, Linux, X64, office]
168-
needs: [deploy_to_aws]
166+
if: ${{ !cancelled() && github.repository == 'wireapp/wire-webapp' && github.actor != 'dependabot[bot]' && github.actor != 'dependabot' }}
167+
runs-on: ubuntu-latest
168+
needs: [deploy_to_aws, build_testservice]
169169
timeout-minutes: 35
170+
strategy:
171+
fail-fast: false
172+
matrix:
173+
shard: [0, 1, 2, 3]
170174

171175
steps:
172-
- uses: actions/checkout@v4
176+
- uses: actions/checkout@v6
173177
with:
174178
ref: ${{ github.event.pull_request.head.sha }}
175179

176-
- uses: actions/setup-node@v4
180+
- name: Set up JDK
181+
uses: actions/setup-java@v4
182+
with:
183+
java-version: '17'
184+
distribution: 'temurin'
185+
186+
- uses: actions/setup-node@v6
177187
with:
178-
node-version: 18.16.x
188+
node-version-file: .nvmrc
179189
cache: yarn
180190

191+
- name: Download Testservice Jar
192+
uses: actions/download-artifact@v5
193+
with:
194+
name: kalium-testservice
195+
path: testservice
196+
181197
- run: yarn --immutable
182198
- run: yarn playwright install --with-deps && yarn playwright install chrome
183199
- uses: 1password/install-cli-action@143a85f84a90555d121cde2ff5872e393a47ab9f
@@ -193,12 +209,49 @@ jobs:
193209
echo "Using precommit URL: https://wire-webapp-precommit.zinfra.io/"
194210
curl -s -o /dev/null -w "HTTP %{http_code}\n" https://wire-webapp-precommit.zinfra.io/
195211
212+
- name: Start Testservice in background
213+
run: java -jar testservice/build/libs/testservice-*-all.jar server testservice/config.yml &
214+
196215
- name: Run critical flow tests
197216
env:
198217
# TODO: remove hardcoded precommit env in the future when ephemeral PR envs will exist
199218
# Overrides URL from .env file
200219
WEBAPP_URL: https://wire-webapp-precommit.zinfra.io/
201-
run: yarn e2e-test --grep "@crit-flow-web"
220+
TEST_SERVICE_URL: http://localhost:8080 # Run tests agains locally running test service
221+
run: yarn e2e-test --shard=${{ matrix.shard }}/${{ strategy.job-total }} --grep "@crit-flow-web"
222+
223+
- name: Upload blob report
224+
if: ${{ !cancelled() }}
225+
uses: actions/upload-artifact@v4
226+
with:
227+
name: blob-report-${{ matrix.shard }}
228+
path: blob-report
229+
retention-days: 1
230+
231+
e2e-report:
232+
runs-on: ubuntu-latest
233+
if: ${{ !cancelled() }}
234+
needs: [e2e_crit_flow]
235+
steps:
236+
- uses: actions/checkout@v6
237+
with:
238+
ref: ${{ github.event.pull_request.head.sha }}
239+
240+
- uses: actions/setup-node@v6
241+
with:
242+
node-version-file: .nvmrc
243+
cache: yarn
244+
- run: yarn --immutable
245+
246+
- name: Download blob reports
247+
uses: actions/download-artifact@v5
248+
with:
249+
path: all-blob-reports
250+
pattern: blob-report-*
251+
merge-multiple: true
252+
253+
- name: Merge playwright reports
254+
run: yarn playwright merge-reports --reporter html ./all-blob-reports
202255

203256
- name: Upload test report
204257
if: always()

playwright.config.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*
1818
*/
1919

20-
import {defineConfig, devices} from '@playwright/test';
20+
import {defineConfig, devices, ReporterDescription} from '@playwright/test';
2121
import {config} from 'dotenv';
2222

2323
config({path: './test/e2e_tests/.env'});
@@ -44,6 +44,7 @@ module.exports = defineConfig({
4444
reporter: [
4545
['html', {outputFolder: 'playwright-report', open: 'never'}],
4646
['json', {outputFile: 'playwright-report/report.json'}],
47+
...(process.env.CI ? [['blob'] satisfies ReporterDescription] : []),
4748
],
4849
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
4950
use: {

0 commit comments

Comments
 (0)