Skip to content

Commit eb28cc7

Browse files
authored
chore(roll): roll Playwright to v1.47.0 (#2546)
1 parent 876a414 commit eb28cc7

13 files changed

+306
-139
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 -->128.0.6613.18<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->129.0.6668.29<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->18.0<!-- GEN:stop --> ||||
9-
| Firefox <!-- GEN:firefox-version -->128.0<!-- GEN:stop --> ||||
9+
| Firefox <!-- GEN:firefox-version -->130.0<!-- GEN:stop --> ||||
1010

1111
## Documentation
1212

playwright/_impl/_api_structures.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,11 @@ class StorageState(TypedDict, total=False):
104104
class ClientCertificate(TypedDict, total=False):
105105
origin: str
106106
certPath: Optional[Union[str, Path]]
107+
cert: Optional[bytes]
107108
keyPath: Optional[Union[str, Path]]
109+
key: Optional[bytes]
108110
pfxPath: Optional[Union[str, Path]]
111+
pfx: Optional[bytes]
109112
passphrase: Optional[str]
110113

111114

playwright/_impl/_element_handle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@ async def select_option(
157157
params = locals_to_params(
158158
dict(
159159
timeout=timeout,
160-
noWaitAfter=noWaitAfter,
161160
force=force,
162161
**convert_select_option_values(value, index, label, element)
163162
)

playwright/_impl/_fetch.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import typing
1919
from pathlib import Path
2020
from typing import Any, Dict, List, Optional, Union, cast
21+
from urllib.parse import parse_qs
2122

2223
import playwright._impl._network as network
2324
from playwright._impl._api_structures import (
@@ -53,7 +54,7 @@
5354
FormType = Dict[str, Union[bool, float, str]]
5455
DataType = Union[Any, bytes, str]
5556
MultipartType = Dict[str, Union[bytes, bool, float, str, FilePayload]]
56-
ParamsType = Dict[str, Union[bool, float, str]]
57+
ParamsType = Union[Dict[str, Union[bool, float, str]], str]
5758

5859

5960
class APIRequest:
@@ -404,7 +405,7 @@ async def _inner_fetch(
404405
"fetch",
405406
{
406407
"url": url,
407-
"params": object_to_array(params),
408+
"params": params_to_protocol(params),
408409
"method": method,
409410
"headers": serialized_headers,
410411
"postData": post_data,
@@ -429,6 +430,23 @@ async def storage_state(
429430
return result
430431

431432

433+
def params_to_protocol(params: Optional[ParamsType]) -> Optional[List[NameValue]]:
434+
if not params:
435+
return None
436+
if isinstance(params, dict):
437+
return object_to_array(params)
438+
if params.startswith("?"):
439+
params = params[1:]
440+
parsed = parse_qs(params)
441+
if not parsed:
442+
return None
443+
out = []
444+
for name, values in parsed.items():
445+
for value in values:
446+
out.append(NameValue(name=name, value=value))
447+
return out
448+
449+
432450
def file_payload_to_json(payload: FilePayload) -> ServerFilePayload:
433451
return ServerFilePayload(
434452
name=payload["name"],

playwright/_impl/_frame.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,6 @@ async def select_option(
670670
dict(
671671
selector=selector,
672672
timeout=timeout,
673-
noWaitAfter=noWaitAfter,
674673
strict=strict,
675674
force=force,
676675
**convert_select_option_values(value, index, label, element),

playwright/_impl/_network.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,20 @@ async def to_client_certificates_protocol(
9696
}
9797
if passphrase := clientCertificate.get("passphrase"):
9898
out_record["passphrase"] = passphrase
99+
if pfx := clientCertificate.get("pfx"):
100+
out_record["pfx"] = base64.b64encode(pfx).decode()
99101
if pfx_path := clientCertificate.get("pfxPath"):
100102
out_record["pfx"] = base64.b64encode(
101103
await async_readfile(pfx_path)
102104
).decode()
105+
if cert := clientCertificate.get("cert"):
106+
out_record["cert"] = base64.b64encode(cert).decode()
103107
if cert_path := clientCertificate.get("certPath"):
104108
out_record["cert"] = base64.b64encode(
105109
await async_readfile(cert_path)
106110
).decode()
111+
if key := clientCertificate.get("key"):
112+
out_record["key"] = base64.b64encode(key).decode()
107113
if key_path := clientCertificate.get("keyPath"):
108114
out_record["key"] = base64.b64encode(
109115
await async_readfile(key_path)

playwright/async_api/_generated.py

Lines changed: 58 additions & 64 deletions
Large diffs are not rendered by default.

playwright/sync_api/_generated.py

Lines changed: 58 additions & 64 deletions
Large diffs are not rendered by default.

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
InWheel = None
3131
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand
3232

33-
driver_version = "1.46.0"
33+
driver_version = "1.47.0-beta-1725889926000"
3434

3535

3636
def extractall(zip: zipfile.ZipFile, path: str) -> None:

tests/async/test_browsercontext_client_certificates.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,47 @@ async def test_should_work_with_new_context(browser: Browser, assetdir: Path) ->
172172
await context.close()
173173

174174

175+
async def test_should_work_with_new_context_passing_as_content(
176+
browser: Browser, assetdir: Path
177+
) -> None:
178+
context = await browser.new_context(
179+
# TODO: Remove this once we can pass a custom CA.
180+
ignore_https_errors=True,
181+
client_certificates=[
182+
{
183+
"origin": "https://127.0.0.1:8000",
184+
"cert": (
185+
assetdir / "client-certificates/client/trusted/cert.pem"
186+
).read_bytes(),
187+
"key": (
188+
assetdir / "client-certificates/client/trusted/key.pem"
189+
).read_bytes(),
190+
}
191+
],
192+
)
193+
page = await context.new_page()
194+
await page.goto("https://localhost:8000")
195+
await expect(page.get_by_test_id("message")).to_have_text(
196+
"Sorry, but you need to provide a client certificate to continue."
197+
)
198+
await page.goto("https://127.0.0.1:8000")
199+
await expect(page.get_by_test_id("message")).to_have_text(
200+
"Hello Alice, your certificate was issued by localhost!"
201+
)
202+
203+
response = await page.context.request.get("https://localhost:8000")
204+
assert (
205+
"Sorry, but you need to provide a client certificate to continue."
206+
in await response.text()
207+
)
208+
response = await page.context.request.get("https://127.0.0.1:8000")
209+
assert (
210+
"Hello Alice, your certificate was issued by localhost!"
211+
in await response.text()
212+
)
213+
await context.close()
214+
215+
175216
async def test_should_work_with_new_persistent_context(
176217
browser_type: BrowserType, assetdir: Path, launch_arguments: Dict
177218
) -> None:

0 commit comments

Comments
 (0)