Skip to content

Commit 7091748

Browse files
authored
chore: roll to Playwright 1.26.0-beta-1663620933000 (microsoft#1555)
Ports: - [x] microsoft/playwright@a07a4a2 (chore: make parent scope explicit (microsoft/playwright#16819)) - [x] microsoft/playwright@306ab34 (feat(assertions): support toBeEnabled({ enabled }) (microsoft/playwright#17058)) - [x] microsoft/playwright@f0c5810 (feat(assertions): support toBeEditable({ editable }) (microsoft/playwright#17065)) - [x] microsoft/playwright@bca13bc (feat(assertions): support toBeVisible({ visible }) (microsoft/playwright#17207)) - [x] microsoft/playwright@17b203a (feat: added follow and redirect arguments to fetch (microsoft/playwright#17033)) - [x] microsoft/playwright@fea8772 (fix: emit load/domcontentloaded events as reported by the browser) - [x] microsoft/playwright@01d83f1 (fix(har): record request overrides to har (microsoft/playwright#17027))
1 parent 2cc7a84 commit 7091748

18 files changed

+592
-212
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H
44

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->105.0.5195.19<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->106.0.5249.30<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->16.0<!-- GEN:stop --> ||||
9-
| Firefox <!-- GEN:firefox-version -->103.0<!-- GEN:stop --> ||||
9+
| Firefox <!-- GEN:firefox-version -->104.0<!-- GEN:stop --> ||||
1010

1111
## Documentation
1212

playwright/_impl/_assertions.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -458,22 +458,26 @@ async def not_to_be_disabled(
458458

459459
async def to_be_editable(
460460
self,
461+
editable: bool = None,
461462
timeout: float = None,
462463
) -> None:
463464
__tracebackhide__ = True
465+
if editable is None:
466+
editable = True
464467
await self._expect_impl(
465-
"to.be.editable",
468+
"to.be.editable" if editable else "to.be.readonly",
466469
FrameExpectOptions(timeout=timeout),
467470
None,
468471
"Locator expected to be editable",
469472
)
470473

471474
async def not_to_be_editable(
472475
self,
476+
editable: bool = None,
473477
timeout: float = None,
474478
) -> None:
475479
__tracebackhide__ = True
476-
await self._not.to_be_editable(timeout)
480+
await self._not.to_be_editable(editable, timeout)
477481

478482
async def to_be_empty(
479483
self,
@@ -496,22 +500,26 @@ async def not_to_be_empty(
496500

497501
async def to_be_enabled(
498502
self,
503+
enabled: bool = None,
499504
timeout: float = None,
500505
) -> None:
501506
__tracebackhide__ = True
507+
if enabled is None:
508+
enabled = True
502509
await self._expect_impl(
503-
"to.be.enabled",
510+
"to.be.enabled" if enabled else "to.be.disabled",
504511
FrameExpectOptions(timeout=timeout),
505512
None,
506513
"Locator expected to be enabled",
507514
)
508515

509516
async def not_to_be_enabled(
510517
self,
518+
enabled: bool = None,
511519
timeout: float = None,
512520
) -> None:
513521
__tracebackhide__ = True
514-
await self._not.to_be_enabled(timeout)
522+
await self._not.to_be_enabled(enabled, timeout)
515523

516524
async def to_be_hidden(
517525
self,
@@ -534,22 +542,26 @@ async def not_to_be_hidden(
534542

535543
async def to_be_visible(
536544
self,
545+
visible: bool = None,
537546
timeout: float = None,
538547
) -> None:
539548
__tracebackhide__ = True
549+
if visible is None:
550+
visible = True
540551
await self._expect_impl(
541-
"to.be.visible",
552+
"to.be.visible" if visible else "to.be.hidden",
542553
FrameExpectOptions(timeout=timeout),
543554
None,
544555
"Locator expected to be visible",
545556
)
546557

547558
async def not_to_be_visible(
548559
self,
560+
visible: bool = None,
549561
timeout: float = None,
550562
) -> None:
551563
__tracebackhide__ = True
552-
await self._not.to_be_visible(timeout)
564+
await self._not.to_be_visible(visible, timeout)
553565

554566
async def to_be_focused(
555567
self,

playwright/_impl/_browser_context.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ def __init__(
114114
lambda params: asyncio.create_task(
115115
self._on_route(
116116
from_channel(params.get("route")),
117-
from_channel(params.get("request")),
118117
)
119118
),
120119
)
@@ -174,15 +173,15 @@ def _on_page(self, page: Page) -> None:
174173
if page._opener and not page._opener.is_closed():
175174
page._opener.emit(Page.Events.Popup, page)
176175

177-
async def _on_route(self, route: Route, request: Request) -> None:
176+
async def _on_route(self, route: Route) -> None:
178177
route_handlers = self._routes.copy()
179178
for route_handler in route_handlers:
180-
if not route_handler.matches(request.url):
179+
if not route_handler.matches(route.request.url):
181180
continue
182181
if route_handler.will_expire:
183182
self._routes.remove(route_handler)
184183
try:
185-
handled = await route_handler.handle(route, request)
184+
handled = await route_handler.handle(route)
186185
finally:
187186
if len(self._routes) == 0:
188187
asyncio.create_task(self._disable_interception())

playwright/_impl/_fetch.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ async def delete(
102102
timeout: float = None,
103103
failOnStatusCode: bool = None,
104104
ignoreHTTPSErrors: bool = None,
105+
maxRedirects: int = None,
105106
) -> "APIResponse":
106107
return await self.fetch(
107108
url,
@@ -114,6 +115,7 @@ async def delete(
114115
timeout=timeout,
115116
failOnStatusCode=failOnStatusCode,
116117
ignoreHTTPSErrors=ignoreHTTPSErrors,
118+
maxRedirects=maxRedirects,
117119
)
118120

119121
async def head(
@@ -124,6 +126,7 @@ async def head(
124126
timeout: float = None,
125127
failOnStatusCode: bool = None,
126128
ignoreHTTPSErrors: bool = None,
129+
maxRedirects: int = None,
127130
) -> "APIResponse":
128131
return await self.fetch(
129132
url,
@@ -133,6 +136,7 @@ async def head(
133136
timeout=timeout,
134137
failOnStatusCode=failOnStatusCode,
135138
ignoreHTTPSErrors=ignoreHTTPSErrors,
139+
maxRedirects=maxRedirects,
136140
)
137141

138142
async def get(
@@ -143,6 +147,7 @@ async def get(
143147
timeout: float = None,
144148
failOnStatusCode: bool = None,
145149
ignoreHTTPSErrors: bool = None,
150+
maxRedirects: int = None,
146151
) -> "APIResponse":
147152
return await self.fetch(
148153
url,
@@ -152,6 +157,7 @@ async def get(
152157
timeout=timeout,
153158
failOnStatusCode=failOnStatusCode,
154159
ignoreHTTPSErrors=ignoreHTTPSErrors,
160+
maxRedirects=maxRedirects,
155161
)
156162

157163
async def patch(
@@ -165,6 +171,7 @@ async def patch(
165171
timeout: float = None,
166172
failOnStatusCode: bool = None,
167173
ignoreHTTPSErrors: bool = None,
174+
maxRedirects: int = None,
168175
) -> "APIResponse":
169176
return await self.fetch(
170177
url,
@@ -177,6 +184,7 @@ async def patch(
177184
timeout=timeout,
178185
failOnStatusCode=failOnStatusCode,
179186
ignoreHTTPSErrors=ignoreHTTPSErrors,
187+
maxRedirects=maxRedirects,
180188
)
181189

182190
async def put(
@@ -190,6 +198,7 @@ async def put(
190198
timeout: float = None,
191199
failOnStatusCode: bool = None,
192200
ignoreHTTPSErrors: bool = None,
201+
maxRedirects: int = None,
193202
) -> "APIResponse":
194203
return await self.fetch(
195204
url,
@@ -202,6 +211,7 @@ async def put(
202211
timeout=timeout,
203212
failOnStatusCode=failOnStatusCode,
204213
ignoreHTTPSErrors=ignoreHTTPSErrors,
214+
maxRedirects=maxRedirects,
205215
)
206216

207217
async def post(
@@ -215,6 +225,7 @@ async def post(
215225
timeout: float = None,
216226
failOnStatusCode: bool = None,
217227
ignoreHTTPSErrors: bool = None,
228+
maxRedirects: int = None,
218229
) -> "APIResponse":
219230
return await self.fetch(
220231
url,
@@ -227,6 +238,7 @@ async def post(
227238
timeout=timeout,
228239
failOnStatusCode=failOnStatusCode,
229240
ignoreHTTPSErrors=ignoreHTTPSErrors,
241+
maxRedirects=maxRedirects,
230242
)
231243

232244
async def fetch(
@@ -241,6 +253,7 @@ async def fetch(
241253
timeout: float = None,
242254
failOnStatusCode: bool = None,
243255
ignoreHTTPSErrors: bool = None,
256+
maxRedirects: int = None,
244257
) -> "APIResponse":
245258
request = (
246259
cast(network.Request, to_impl(urlOrRequest))
@@ -253,6 +266,9 @@ async def fetch(
253266
assert (
254267
(1 if data else 0) + (1 if form else 0) + (1 if multipart else 0)
255268
) <= 1, "Only one of 'data', 'form' or 'multipart' can be specified"
269+
assert (
270+
maxRedirects is None or maxRedirects >= 0
271+
), "'max_redirects' must be greater than or equal to '0'"
256272
url = request.url if request else urlOrRequest
257273
method = method or (request.method if request else "GET")
258274
# Cannot call allHeaders() here as the request may be paused inside route handler.
@@ -319,6 +335,7 @@ def filter_none(input: Dict) -> Dict:
319335
"timeout": timeout,
320336
"failOnStatusCode": failOnStatusCode,
321337
"ignoreHTTPSErrors": ignoreHTTPSErrors,
338+
"maxRedirects": maxRedirects,
322339
}
323340
),
324341
)

playwright/_impl/_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,15 @@ def __init__(
271271
def matches(self, request_url: str) -> bool:
272272
return self.matcher.matches(request_url)
273273

274-
async def handle(self, route: "Route", request: "Request") -> bool:
274+
async def handle(self, route: "Route") -> bool:
275275
handled_future = route._start_handling()
276276
handler_task = []
277277

278278
def impl() -> None:
279279
self._handled_count += 1
280280
result = cast(
281281
Callable[["Route", "Request"], Union[Coroutine, Any]], self.handler
282-
)(route, request)
282+
)(route, route.request)
283283
if inspect.iscoroutine(result):
284284
handler_task.append(asyncio.create_task(result))
285285

playwright/_impl/_page.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,7 @@ def __init__(
193193
self._channel.on(
194194
"route",
195195
lambda params: asyncio.create_task(
196-
self._on_route(
197-
from_channel(params["route"]), from_channel(params["request"])
198-
)
196+
self._on_route(from_channel(params["route"]))
199197
),
200198
)
201199
self._channel.on("video", lambda params: self._on_video(params))
@@ -235,21 +233,21 @@ def _on_frame_detached(self, frame: Frame) -> None:
235233
frame._detached = True
236234
self.emit(Page.Events.FrameDetached, frame)
237235

238-
async def _on_route(self, route: Route, request: Request) -> None:
236+
async def _on_route(self, route: Route) -> None:
239237
route_handlers = self._routes.copy()
240238
for route_handler in route_handlers:
241-
if not route_handler.matches(request.url):
239+
if not route_handler.matches(route.request.url):
242240
continue
243241
if route_handler.will_expire:
244242
self._routes.remove(route_handler)
245243
try:
246-
handled = await route_handler.handle(route, request)
244+
handled = await route_handler.handle(route)
247245
finally:
248246
if len(self._routes) == 0:
249247
asyncio.create_task(self._disable_interception())
250248
if handled:
251249
return
252-
await self._browser_context._on_route(route, request)
250+
await self._browser_context._on_route(route)
253251

254252
def _on_binding(self, binding_call: "BindingCall") -> None:
255253
func = self._bindings.get(binding_call._initializer["name"])

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy