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:
84
84
return self ._impl_obj .__str__ ()
85
85
86
86
def _sync (self , task : asyncio .Future ) -> Any :
87
+ if not task :
88
+ return None
87
89
g_self = greenlet .getcurrent ()
88
90
future = self ._loop .create_task (task )
89
91
Original file line number Diff line number Diff line change 16
16
17
17
import pytest
18
18
19
- from playwright import Error , sync_playwright
19
+ from playwright import Error , TimeoutError , sync_playwright
20
20
from playwright .sync_api import Browser , Page
21
21
22
22
@@ -214,3 +214,10 @@ def test_sync_playwright_multiple_times():
214
214
with sync_playwright () as pw2 :
215
215
assert pw1 .chromium == pw2 .chromium
216
216
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