-
Notifications
You must be signed in to change notification settings - Fork 3
81 lines (71 loc) · 2.58 KB
/
e2e-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
name: E2E
on:
push:
branches:
- main
workflow_dispatch:
pull_request:
concurrency:
group: 'playwright-${{ github.head_ref }}'
cancel-in-progress: true
jobs:
test:
name: Playwright
timeout-minutes: 30
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
group: [1, 2, 3, 4, 5]
steps:
# Commercial
- name: Checkout
uses: actions/checkout@v3
with:
path: ./commercial
- run: corepack enable
working-directory: ./commercial
shell: bash
- name: Setup node
uses: actions/setup-node@v4
with:
node-version-file: './commercial/.nvmrc'
cache: 'pnpm'
cache-dependency-path: './commercial/pnpm-lock.yaml'
- name: Install dependencies
working-directory: ./commercial
run: pnpm install --frozen-lockfile
# We always run our commercial code against the latest main of DCR
# This does make our tests sensitive to changes in DCR
# (e.g. imagine someone removes the top-above-nav slot from DCR)
# This is something we accept in order to easily test our own code
#
# Note we use the containerised version of DCR, published from:
# https://github.com/guardian/dotcom-rendering/blob/6a6df272/.github/workflows/container.yml
#
# The argument `--network host` is crucial here, as it means the container shares the networking stack of the host
# This makes the commercial dev server available from inside the container
# Note that GHA provides a service container feature, but it does not support this argument
- name: Start DCR in a container
run: |
/usr/bin/docker run -d \
--network host \
-p 3030:3030 \
-e "PORT=3030" \
-e "COMMERCIAL_BUNDLE_URL=http://localhost:3031/graun.standalone.commercial.js" \
ghcr.io/guardian/dotcom-rendering:main
- name: Install Playwright Browsers
run: pnpm playwright install --with-deps chromium
working-directory: ./commercial
- name: Start Commercial server
run: pnpm serve & npx wait-on -v -i 1000 http://localhost:3031/graun.standalone.commercial.js
working-directory: ./commercial
- name: Run Playwright
run: pnpm playwright test --shard=${{ matrix.group }}/5
working-directory: ./commercial
- uses: actions/upload-artifact@v4
if: always()
with:
name: playwright-report-${{ matrix.group }}
path: ./commercial/playwright-report
retention-days: 5