Skip to content

Commit 08e5ff1

Browse files
committed
run UI tests in CI
1 parent ebd0c11 commit 08e5ff1

File tree

2 files changed

+108
-0
lines changed

2 files changed

+108
-0
lines changed

.github/workflows/test.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Test
2+
3+
on: [push]
4+
5+
#on:
6+
# push:
7+
# branches: main
8+
# pull_request:
9+
# branches: '*'
10+
11+
jobs:
12+
integration-tests:
13+
name: Playwright UI tests
14+
runs-on: ubuntu-latest
15+
16+
env:
17+
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/pw-browsers
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
22+
23+
- name: Base Setup
24+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
25+
26+
- name: Install ogdf-python
27+
run: |
28+
set -eux
29+
python -m pip install .[quickstart]
30+
31+
- name: Install test dependencies
32+
working-directory: ui-tests
33+
env:
34+
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
35+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
36+
run: jlpm install
37+
38+
- name: Set up browser cache
39+
uses: actions/cache@v3
40+
with:
41+
path: |
42+
${{ github.workspace }}/pw-browsers
43+
key: ${{ runner.os }}-${{ hashFiles('ui-tests/yarn.lock') }}
44+
45+
- name: Install browser
46+
run: jlpm playwright install chromium
47+
working-directory: ui-tests
48+
49+
- name: Execute playwright tests
50+
working-directory: ui-tests
51+
run: |
52+
jlpm playwright test
53+
54+
- name: Upload playwright test report
55+
if: always()
56+
uses: actions/upload-artifact@v3
57+
with:
58+
name: playwright-tests
59+
path: |
60+
ui-tests/test-results
61+
ui-tests/playwright-report
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Update Playwright Snapshots
2+
3+
on:
4+
issue_comment:
5+
types: [created, edited]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
update-snapshots:
13+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, 'please update playwright snapshots') }}
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
with:
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Configure git to use https
23+
run: git config --global hub.protocol https
24+
25+
- name: Checkout the branch from the PR that triggered the job
26+
run: hub pr checkout ${{ github.event.issue.number }}
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Base Setup
31+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
32+
33+
- name: Install dependencies
34+
run: python -m pip install -U "jupyterlab>=4.0.0,<5"
35+
36+
- name: Install extension
37+
run: |
38+
set -eux
39+
jlpm
40+
python -m pip install .
41+
42+
- uses: jupyterlab/maintainer-tools/.github/actions/update-snapshots@v1
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
# Playwright knows how to start JupyterLab server
46+
start_server_script: 'null'
47+
test_folder: ui-tests

0 commit comments

Comments
 (0)