File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -147,3 +147,30 @@ def test_webagg_toolbar(page, toolbar):
147
147
page .mouse .move (x , y , steps = 2 )
148
148
message = page .locator ('span.mpl-message' )
149
149
expect (message ).to_have_text ('x=0.500 y=0.500' )
150
+
151
+
152
+ @pytest .mark .backend ('webagg' )
153
+ def test_webagg_toolbar_save (page ):
154
+ from playwright .sync_api import expect
155
+
156
+ # Listen for all console logs.
157
+ page .on ('console' , lambda msg : print (f'CONSOLE: { msg .text } ' ))
158
+
159
+ fig , ax = plt .subplots (facecolor = 'w' )
160
+
161
+ # Don't start the Tornado event loop, but use the existing event loop
162
+ # started by the `page` fixture.
163
+ WebAggApplication .initialize ()
164
+ WebAggApplication .started = True
165
+
166
+ page .goto (f'http://{ WebAggApplication .address } :{ WebAggApplication .port } /' )
167
+
168
+ save = page .locator ('button.mpl-widget' ).nth (5 )
169
+ expect (save ).to_be_visible ()
170
+
171
+ with page .context .expect_page () as new_page_info :
172
+ save .click ()
173
+ new_page = new_page_info .value
174
+
175
+ new_page .wait_for_load_state ()
176
+ assert new_page .url .endswith ('download.png' )
You can’t perform that action at this time.
0 commit comments