-
Notifications
You must be signed in to change notification settings - Fork 5.7k
164 lines (140 loc) · 5.13 KB
/
Copy pathui-tests.yml
File metadata and controls
164 lines (140 loc) · 5.13 KB
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
name: UI Tests
on:
push:
branches: ['main']
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Build
uses: ./.github/actions/build-dist
ui-tests:
needs: [build]
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
browser: [firefox, chromium]
steps:
- name: Checkout
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@95d85449e4f3f352e261221f6529f8ed307f5728 # v1
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: notebook-dist-${{ github.run_number }}
path: ./dist
- name: Install the package
run: |
cd dist
python -m pip install -vv notebook*.whl
- name: Install the test dependencies
run: |
cd ui-tests
jlpm
jlpm playwright install
- name: Test
env:
# Tag every test with the browser so the merged report can attribute results (see playwright.config.ts).
PLAYWRIGHT_TEST_TAG: '@${{ matrix.browser }}'
# Unique blob filename per browser to avoid collisions when merging (see playwright.config.ts).
BLOB_FILENAME: report-${{ matrix.browser }}.zip
run: |
cd ui-tests
jlpm test --browser ${{ matrix.browser }}
- name: Upload Playwright Test assets
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-${{ matrix.browser }}-test-assets
path: |
ui-tests/test-results
- name: Upload blob report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-blobs-${{ matrix.browser }}
path: ui-tests/blob-report
retention-days: 1
compression-level: 1
- name: Update snapshots
if: failure()
run: |
cd ui-tests
# remove previous snapshots from other browser
jlpm rimraf "test/**/*-snapshots/*.png"
# generate new snapshots
jlpm run test:update --browser ${{ matrix.browser }}
- name: Upload updated snapshots
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-${{ matrix.browser }}-updated-snapshots
path: ui-tests/test
merge-reports:
name: Merge UI Test Reports
if: ${{ !cancelled() }}
needs: ui-tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout lockfile
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
sparse-checkout: ui-tests/yarn.lock
sparse-checkout-cone-mode: false
persist-credentials: false
- name: Find out Playwright version
id: pw-version
run: |
set -e
PW_VERSION=$(grep -m1 '^"playwright@npm:' ui-tests/yarn.lock | sed -E 's/^"playwright@npm:([^"]+)":/\1/')
if ! [[ "$PW_VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Could not extract Playwright version from ui-tests/yarn.lock (got: '$PW_VERSION')" >&2
exit 1
fi
echo "Playwright version: $PW_VERSION"
echo "version=$PW_VERSION" >> $GITHUB_OUTPUT
- name: Download blob artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
path: blob-reports
pattern: notebook-blobs-*
merge-multiple: true
- name: Merge Playwright reports
env:
PW_VERSION: ${{ steps.pw-version.outputs.version }}
run: |
npx "playwright@$PW_VERSION" merge-reports --reporter html,github ./blob-reports/
- name: Upload merged report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: notebook-test-report
path: playwright-report
- name: Inline the report
uses: jupyterlab/maintainer-tools/.github/actions/inline-playwright-report@95d85449e4f3f352e261221f6529f8ed307f5728 # v1
with:
path: playwright-report
- name: Upload inlined report
id: upload-report
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
archive: false
name: notebook-test-report-standalone
path: playwright-report/output.html
- name: Add report link to job summary
env:
REPORT_URL: ${{ steps.upload-report.outputs.artifact-url }}
run: |
echo "**[View UI Test Report]($REPORT_URL)**" >> $GITHUB_STEP_SUMMARY