File tree 3 files changed +40
-0
lines changed
3 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,8 @@ jobs:
105
105
python -m pip install --upgrade pip
106
106
pip install file://$PWD/python/ipywidgets#egg=ipywidgets[test]
107
107
- name : Test with pytest
108
+ env :
109
+ SOLARA_TEST_RUNNERS : " jupyter_notebook,jupyter_lab"
108
110
run : |
109
111
pip install pytest
110
112
cd python/ipywidgets
Original file line number Diff line number Diff line change
1
+ import playwright .async_api
2
+ from IPython .display import display
3
+
4
+
5
+ def center (locator ):
6
+ box = locator .bounding_box ()
7
+ x , y = box ["x" ] + box ["width" ] / 2 , box ["y" ] + box ["height" ] / 2
8
+ return x , y
9
+
10
+
11
+ def test_slider_tap (ipywidgets_runner , page_session : playwright .sync_api .Page ):
12
+ def kernel ():
13
+ import ipywidgets as widgets
14
+
15
+ slider = widgets .IntSlider (
16
+ continuous_update = False ,
17
+ )
18
+ text = widgets .HTML (value = "Nothing happened" )
19
+
20
+ def echo (change ):
21
+ if change ["new" ] > 0 :
22
+ text .value = "slider is greater than 0"
23
+ else :
24
+ text .value = "slider is 0"
25
+
26
+ slider .observe (echo , names = "value" )
27
+ slider .add_class ("slider-test" )
28
+ text .add_class ("text-test" )
29
+ display (slider )
30
+ display (text )
31
+
32
+ ipywidgets_runner (kernel )
33
+ text = page_session .locator (".text-test" )
34
+ slider = page_session .wait_for_selector (".slider-test" )
35
+ x , y = center (slider )
36
+ page_session .mouse .click (x , y )
37
+ text .locator ("text=slider is greater than 0" ).wait_for ()
Original file line number Diff line number Diff line change 47
47
pytest>=3.6.0
48
48
pytest-cov
49
49
pytz
50
+ solara[pytest]
50
51
51
52
[options.package_data]
52
53
ipywidgets =
You can’t perform that action at this time.
0 commit comments