Skip to content

Commit cbe2368

Browse files
committed
Print messages from console
1 parent b5699de commit cbe2368

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

lib/matplotlib/tests/test_backend_webagg.py

+18
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ def test_webagg_core_no_toolbar():
5757
def test_webagg_general(random_port, page):
5858
from playwright.sync_api import expect
5959

60+
# Listen for all console logs.
61+
page.on("console", lambda msg: print(msg.text))
62+
6063
fig, ax = plt.subplots(facecolor='w')
6164

6265
# Don't start the Tornado event loop, but use the existing event loop
@@ -87,6 +90,9 @@ def test_webagg_general(random_port, page):
8790

8891
@pytest.mark.backend('webagg')
8992
def test_webagg_resize(random_port, page):
93+
# Listen for all console logs.
94+
page.on("console", lambda msg: print(msg.text))
95+
9096
fig, ax = plt.subplots(facecolor='w')
9197
orig_bbox = fig.bbox.frozen()
9298

@@ -120,6 +126,9 @@ def test_webagg_resize(random_port, page):
120126
def test_webagg_toolbar(random_port, page, toolbar):
121127
from playwright.sync_api import expect
122128

129+
# Listen for all console logs.
130+
page.on("console", lambda msg: print(msg.text))
131+
123132
with warnings.catch_warnings():
124133
warnings.filterwarnings('ignore', message='Treat the new Tool classes',
125134
category=UserWarning)
@@ -178,6 +187,9 @@ def test_webagg_toolbar(random_port, page, toolbar):
178187
def test_webagg_toolbar_save(random_port, page):
179188
from playwright.sync_api import expect
180189

190+
# Listen for all console logs.
191+
page.on("console", lambda msg: print(msg.text))
192+
181193
fig, ax = plt.subplots(facecolor='w')
182194

183195
# Don't start the Tornado event loop, but use the existing event loop
@@ -202,6 +214,9 @@ def test_webagg_toolbar_save(random_port, page):
202214
def test_webagg_toolbar_pan(random_port, page):
203215
from playwright.sync_api import expect
204216

217+
# Listen for all console logs.
218+
page.on("console", lambda msg: print(msg.text))
219+
205220
fig, ax = plt.subplots(facecolor='w')
206221
ax.plot([3, 2, 1])
207222
orig_lim = ax.viewLim.frozen()
@@ -314,6 +329,9 @@ def test_webagg_toolbar_pan(random_port, page):
314329
def test_webagg_toolbar_zoom(random_port, page):
315330
from playwright.sync_api import expect
316331

332+
# Listen for all console logs.
333+
page.on("console", lambda msg: print(msg.text))
334+
317335
fig, ax = plt.subplots(facecolor='w')
318336
ax.plot([3, 2, 1])
319337
orig_lim = ax.viewLim.frozen()

0 commit comments

Comments
 (0)