@@ -55,6 +55,7 @@ async def test_basic_response(self):
55
55
assert resp .meta ["playwright_page" ].url == resp .url
56
56
await resp .meta ["playwright_page" ].close ()
57
57
58
+ @allow_windows
58
59
async def test_post_request (self ):
59
60
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
60
61
with MockServer () as server :
@@ -66,6 +67,7 @@ async def test_post_request(self):
66
67
assert_correct_response (resp , req )
67
68
assert "Request body: foo=bar" in resp .text
68
69
70
+ @allow_windows
69
71
async def test_timeout_error (self ):
70
72
settings_dict = {
71
73
"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type ,
@@ -83,6 +85,7 @@ async def test_timeout_error(self):
83
85
f" exc_type={ type (excinfo .value )} exc_msg={ str (excinfo .value )} " ,
84
86
) in self ._caplog .record_tuples
85
87
88
+ @allow_windows
86
89
async def test_retry_page_content_still_navigating (self ):
87
90
if self .browser_type != "chromium" :
88
91
pytest .skip ("Only Chromium seems to redirect meta tags within the same goto call" )
@@ -104,6 +107,7 @@ async def test_retry_page_content_still_navigating(self):
104
107
) in self ._caplog .record_tuples
105
108
106
109
@patch ("scrapy_playwright.handler.logger" )
110
+ @allow_windows
107
111
async def test_route_continue_exception (self , logger ):
108
112
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
109
113
scrapy_request = Request (url = "https://example.org" , method = "GET" )
@@ -154,6 +158,7 @@ async def test_route_continue_exception(self, logger):
154
158
with pytest .raises (PlaywrightError ):
155
159
await req_handler (route , playwright_request )
156
160
161
+ @allow_windows
157
162
async def test_event_handler_dialog_callable (self ):
158
163
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
159
164
with StaticMockServer () as server :
@@ -175,6 +180,7 @@ async def test_event_handler_dialog_callable(self):
175
180
176
181
assert spider .dialog_message == "foobar"
177
182
183
+ @allow_windows
178
184
async def test_event_handler_dialog_str (self ):
179
185
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
180
186
with StaticMockServer () as server :
@@ -196,6 +202,7 @@ async def test_event_handler_dialog_str(self):
196
202
197
203
assert spider .dialog_message == "foobar"
198
204
205
+ @allow_windows
199
206
async def test_event_handler_dialog_missing (self ):
200
207
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
201
208
with StaticMockServer () as server :
@@ -219,6 +226,7 @@ async def test_event_handler_dialog_missing(self):
219
226
) in self ._caplog .record_tuples
220
227
assert getattr (spider , "dialog_message" , None ) is None
221
228
229
+ @allow_windows
222
230
async def test_response_attributes (self ):
223
231
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
224
232
with MockServer () as server :
@@ -230,6 +238,7 @@ async def test_response_attributes(self):
230
238
231
239
assert response .ip_address == ip_address (server .address )
232
240
241
+ @allow_windows
233
242
async def test_page_goto_kwargs_referer (self ):
234
243
if self .browser_type != "chromium" :
235
244
pytest .skip ("referer as goto kwarg seems to work only with chromium :shrug:" )
@@ -248,6 +257,7 @@ async def test_page_goto_kwargs_referer(self):
248
257
headers = json .loads (response .css ("pre::text" ).get ())
249
258
assert headers ["Referer" ] == fake_referer
250
259
260
+ @allow_windows
251
261
async def test_navigation_returns_none (self ):
252
262
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
253
263
with MockServer ():
@@ -263,6 +273,7 @@ async def test_navigation_returns_none(self):
263
273
assert not response .headers
264
274
assert response .status == 200
265
275
276
+ @allow_windows
266
277
async def test_abort_requests (self ):
267
278
async def should_abort_request_async (request ):
268
279
return request .resource_type == "image"
@@ -295,6 +306,7 @@ def should_abort_request_sync(request):
295
306
assert handler .stats .get_value (f"{ resp_prefix } /resource_type/image" ) is None
296
307
assert handler .stats .get_value (f"{ req_prefix } /aborted" ) == 3
297
308
309
+ @allow_windows
298
310
async def test_page_initialization_ok (self ):
299
311
async def init_page (page , _request ):
300
312
await page .set_extra_http_headers ({"Extra-Header" : "Qwerty" })
@@ -315,6 +327,7 @@ async def init_page(page, _request):
315
327
headers = {key .lower (): value for key , value in headers .items ()}
316
328
assert headers ["extra-header" ] == "Qwerty"
317
329
330
+ @allow_windows
318
331
async def test_page_initialization_fail (self ):
319
332
async def init_page (page , _request , _missing ):
320
333
await page .set_extra_http_headers ({"Extra-Header" : "Qwerty" })
@@ -341,6 +354,7 @@ async def init_page(page, _request, _missing):
341
354
assert f"[Context=default] Page init callback exception for { req !r} " in entry [2 ]
342
355
assert "init_page() missing 1 required positional argument: '_missing'" in entry [2 ]
343
356
357
+ @allow_windows
344
358
async def test_redirect (self ):
345
359
async with make_handler ({"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type }) as handler :
346
360
with MockServer () as server :
@@ -358,6 +372,7 @@ async def test_redirect(self):
358
372
server .urljoin ("/redirect" ),
359
373
]
360
374
375
+ @allow_windows
361
376
async def test_logging_record_spider (self ):
362
377
"""Make sure at least one log record has the spider as an attribute
363
378
(records sent before opening the spider will not have it).
@@ -370,6 +385,7 @@ async def test_logging_record_spider(self):
370
385
371
386
assert any (getattr (rec , "spider" , None ) is spider for rec in self ._caplog .records )
372
387
388
+ @allow_windows
373
389
async def test_download_file (self ):
374
390
settings_dict = {
375
391
"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type ,
@@ -385,6 +401,7 @@ async def test_download_file(self):
385
401
assert response .body .startswith (b"%PDF-1.5" )
386
402
assert handler .stats .get_value ("playwright/download_count" ) == 1
387
403
404
+ @allow_windows
388
405
async def test_download_file_delay_ok (self ):
389
406
settings_dict = {
390
407
"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type ,
@@ -401,6 +418,7 @@ async def test_download_file_delay_ok(self):
401
418
assert response .body .startswith (b"%PDF-1.5" )
402
419
assert handler .stats .get_value ("playwright/download_count" ) == 1
403
420
421
+ @allow_windows
404
422
async def test_download_file_delay_error (self ):
405
423
settings_dict = {
406
424
"PLAYWRIGHT_BROWSER_TYPE" : self .browser_type ,
@@ -421,6 +439,7 @@ async def test_download_file_delay_error(self):
421
439
f" exc_type={ type (excinfo .value )} exc_msg={ str (excinfo .value )} " ,
422
440
) in self ._caplog .record_tuples
423
441
442
+ @allow_windows
424
443
async def test_download_file_failure (self ):
425
444
if self .browser_type != "chromium" :
426
445
pytest .skip ()
0 commit comments