Skip to content

Commit 7511b82

Browse files
committed
Test widgets with galata
1 parent d72ce50 commit 7511b82

37 files changed

+5050
-0
lines changed

.github/workflows/ui-tests.yml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: UI Tests
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
ui-tests:
7+
name: Visual Regression
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python: [3.8]
12+
fail-fast: false
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- name: Base Setup
18+
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
19+
20+
- name: Install ipyleaflet
21+
run: |
22+
python -m pip install --upgrade jupyterlab~=3.0 ipywidgets~=7.6
23+
python -m pip install .
24+
cd ui-tests
25+
jlpm install
26+
27+
- name: Install browser
28+
run: |
29+
cd ui-tests
30+
jlpm playwright install chromium
31+
32+
- name: Launch JupyterLab
33+
run: |
34+
cd ui-tests
35+
jlpm start-jlab:detached 2>&1 > /tmp/jupyterlab_server.log &
36+
37+
- name: Wait for JupyterLab
38+
uses: ifaxity/wait-on-action@v1
39+
with:
40+
resource: http-get://localhost:8888/
41+
timeout: 360000
42+
43+
- uses: iterative/setup-cml@v1
44+
- name: Widget rendering tests
45+
shell: bash
46+
run: |
47+
cd ui-tests
48+
jlpm run test
49+
50+
- name: Upload Playwright Test assets
51+
if: always()
52+
uses: actions/upload-artifact@v2
53+
with:
54+
name: ipyleaflet-test-assets
55+
path: |
56+
ui-tests/test-results
57+
58+
- name: Upload Playwright Test report
59+
if: always()
60+
uses: actions/upload-artifact@v2
61+
with:
62+
name: ipyleaflet-test-report
63+
path: |
64+
ui-tests/playwright-report
65+
66+
- name: Update snapshots
67+
if: failure()
68+
run: |
69+
cd ui-tests
70+
# remove previous snapshots from other browser
71+
jlpm rimraf "tests/**/*-snapshots/*.png"
72+
# generate new snapshots
73+
jlpm run test:update
74+
75+
- name: Print JupyterLab logs
76+
if: always()
77+
run: |
78+
cat /tmp/jupyterlab_server.log
79+

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ docs/*.nc
2424

2525
# Untitled Notebooks
2626
*Untitled*.ipynb
27+
28+
#Galata
29+
ui-test/playwright-report
30+
ui-test/test-results

ui-tests/jupyter_server_config.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
c.ServerApp.port = 8888
2+
c.ServerApp.token = ""
3+
c.ServerApp.password = ""
4+
c.ServerApp.disable_check_xsrf = True
5+
c.ServerApp.open_browser = False
6+
c.LabApp.open_browser = False
7+
c.LabApp.expose_app_in_browser = True
8+
c.ServerApp.notebook_dir = './notebooks'

ui-tests/notebooks/DivIcon.ipynb

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "127cb16f-da76-4e86-98d5-47478b7b2709",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from ipyleaflet import Marker, DivIcon, Map\n",
11+
"\n",
12+
"center = (52.204793, 360.121558)\n",
13+
"\n",
14+
"m = Map(center=center, zoom=10)\n",
15+
"icon = DivIcon(html='foo bar', bg_pos=[0, 0], icon_size=[150, 150])\n",
16+
"mark = Marker(location=center, icon=icon)\n",
17+
"m.add_layer(mark);\n",
18+
"\n",
19+
"m"
20+
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": null,
25+
"id": "e314f6c7-b36c-4021-ba13-caf49ade7111",
26+
"metadata": {},
27+
"outputs": [],
28+
"source": []
29+
},
30+
{
31+
"cell_type": "code",
32+
"execution_count": null,
33+
"id": "03c1de8d-b1bb-456d-aea6-0b2d22638909",
34+
"metadata": {},
35+
"outputs": [],
36+
"source": []
37+
}
38+
],
39+
"metadata": {
40+
"kernelspec": {
41+
"display_name": "Python 3 (ipykernel)",
42+
"language": "python",
43+
"name": "python3"
44+
},
45+
"language_info": {
46+
"codemirror_mode": {
47+
"name": "ipython",
48+
"version": 3
49+
},
50+
"file_extension": ".py",
51+
"mimetype": "text/x-python",
52+
"name": "python",
53+
"nbconvert_exporter": "python",
54+
"pygments_lexer": "ipython3",
55+
"version": "3.9.7"
56+
}
57+
},
58+
"nbformat": 4,
59+
"nbformat_minor": 5
60+
}

ui-tests/notebooks/DrawControl.ipynb

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "c20a6cec-25df-44f8-b92d-80a5b2053d3c",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from ipyleaflet import Map, basemaps, DrawControl\n",
11+
"\n",
12+
"center = (52.204793, 360.121558)\n",
13+
"\n",
14+
"m = Map(center=center, zoom=15)\n",
15+
"\n",
16+
"draw_control = DrawControl()\n",
17+
"draw_control.polyline = {\n",
18+
" \"shapeOptions\": {\n",
19+
" \"color\": \"#6bc2e5\",\n",
20+
" \"weight\": 8,\n",
21+
" \"opacity\": 1.0\n",
22+
" }\n",
23+
"}\n",
24+
"draw_control.polygon = {\n",
25+
" \"shapeOptions\": {\n",
26+
" \"fillColor\": \"#6be5c3\",\n",
27+
" \"color\": \"#6be5c3\",\n",
28+
" \"fillOpacity\": 1.0\n",
29+
" },\n",
30+
" \"drawError\": {\n",
31+
" \"color\": \"#dd253b\",\n",
32+
" \"message\": \"Oups!\"\n",
33+
" },\n",
34+
" \"allowIntersection\": False\n",
35+
"}\n",
36+
"draw_control.circle = {\n",
37+
" \"shapeOptions\": {\n",
38+
" \"fillColor\": \"#efed69\",\n",
39+
" \"color\": \"#efed69\",\n",
40+
" \"fillOpacity\": 1.0\n",
41+
" }\n",
42+
"}\n",
43+
"draw_control.rectangle = {\n",
44+
" \"shapeOptions\": {\n",
45+
" \"fillColor\": \"#fca45d\",\n",
46+
" \"color\": \"#fca45d\",\n",
47+
" \"fillOpacity\": 1.0\n",
48+
" }\n",
49+
"}\n",
50+
"\n",
51+
"m.add_control(draw_control)\n",
52+
"\n",
53+
"m"
54+
]
55+
},
56+
{
57+
"cell_type": "code",
58+
"execution_count": null,
59+
"id": "6961a753-ba4f-45e2-92c4-b184fa384f27",
60+
"metadata": {},
61+
"outputs": [],
62+
"source": []
63+
}
64+
],
65+
"metadata": {
66+
"kernelspec": {
67+
"display_name": "Python 3 (ipykernel)",
68+
"language": "python",
69+
"name": "python3"
70+
},
71+
"language_info": {
72+
"codemirror_mode": {
73+
"name": "ipython",
74+
"version": 3
75+
},
76+
"file_extension": ".py",
77+
"mimetype": "text/x-python",
78+
"name": "python",
79+
"nbconvert_exporter": "python",
80+
"pygments_lexer": "ipython3",
81+
"version": "3.9.7"
82+
}
83+
},
84+
"nbformat": 4,
85+
"nbformat_minor": 5
86+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "a025fcc0-52a0-46cd-b987-9d9f0df48f2d",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from ipyleaflet import Map, FullScreenControl\n",
11+
"\n",
12+
"m = Map(zoom=5, center=[51.64, -76.52])\n",
13+
"m.add_control(FullScreenControl())\n",
14+
"\n",
15+
"m"
16+
]
17+
},
18+
{
19+
"cell_type": "code",
20+
"execution_count": null,
21+
"id": "9df299bf-0646-482d-abb0-6dcca8edbf0e",
22+
"metadata": {},
23+
"outputs": [],
24+
"source": []
25+
}
26+
],
27+
"metadata": {
28+
"kernelspec": {
29+
"display_name": "Python 3 (ipykernel)",
30+
"language": "python",
31+
"name": "python3"
32+
},
33+
"language_info": {
34+
"codemirror_mode": {
35+
"name": "ipython",
36+
"version": 3
37+
},
38+
"file_extension": ".py",
39+
"mimetype": "text/x-python",
40+
"name": "python",
41+
"nbconvert_exporter": "python",
42+
"pygments_lexer": "ipython3",
43+
"version": "3.9.7"
44+
}
45+
},
46+
"nbformat": 4,
47+
"nbformat_minor": 5
48+
}

ui-tests/notebooks/Icon.ipynb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "code",
5+
"execution_count": null,
6+
"id": "029a1de7-9342-4cea-b490-2532256b7364",
7+
"metadata": {},
8+
"outputs": [],
9+
"source": [
10+
"from ipyleaflet import Marker, Icon, Map\n",
11+
"\n",
12+
"center = (52.204793, 360.121558)\n",
13+
"\n",
14+
"m = Map(center=center, zoom=10)\n",
15+
"icon = Icon(icon_url='https://leafletjs.com/examples/custom-icons/leaf-green.png', icon_size=[38, 95], icon_anchor=[22,94])\n",
16+
"mark = Marker(location=center, icon=icon, rotation_angle=90, rotation_origin='22px 94px')\n",
17+
"m.add_layer(mark);\n",
18+
"\n",
19+
"m"
20+
]
21+
},
22+
{
23+
"cell_type": "code",
24+
"execution_count": null,
25+
"id": "e977a7cf-4836-4c03-84fb-756bd090a4e3",
26+
"metadata": {},
27+
"outputs": [],
28+
"source": []
29+
}
30+
],
31+
"metadata": {
32+
"kernelspec": {
33+
"display_name": "Python 3 (ipykernel)",
34+
"language": "python",
35+
"name": "python3"
36+
},
37+
"language_info": {
38+
"codemirror_mode": {
39+
"name": "ipython",
40+
"version": 3
41+
},
42+
"file_extension": ".py",
43+
"mimetype": "text/x-python",
44+
"name": "python",
45+
"nbconvert_exporter": "python",
46+
"pygments_lexer": "ipython3",
47+
"version": "3.9.7"
48+
}
49+
},
50+
"nbformat": 4,
51+
"nbformat_minor": 5
52+
}

0 commit comments

Comments
 (0)