File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,8 @@ def __str__(self) -> str:
8484 return self ._impl_obj .__str__ ()
8585
8686 def _sync (self , task : asyncio .Future ) -> Any :
87+ if not task :
88+ return None
8789 g_self = greenlet .getcurrent ()
8890 future = self ._loop .create_task (task )
8991
Original file line number Diff line number Diff line change 1616
1717import pytest
1818
19- from playwright import Error , sync_playwright
19+ from playwright import Error , TimeoutError , sync_playwright
2020from playwright .sync_api import Browser , Page
2121
2222
@@ -214,3 +214,10 @@ def test_sync_playwright_multiple_times():
214214 with sync_playwright () as pw2 :
215215 assert pw1 .chromium == pw2 .chromium
216216 assert "Can only run one Playwright at a time." in exc .value .message
217+
218+
219+ def test_sync_set_default_timeout (page ):
220+ page .setDefaultTimeout (1 )
221+ with pytest .raises (TimeoutError ) as exc :
222+ page .waitForFunction ("false" )
223+ assert "Timeout 1ms exceeded." in exc .value .message
You can’t perform that action at this time.
0 commit comments