Skip to content

Commit 74e2177

Browse files
authored
chore(roll): roll Playwright to 1.52.0 (omitting glob changes) (#2823)
1 parent 68d96cb commit 74e2177

19 files changed

+724
-63
lines changed

README.md

+2-2
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 -->134.0.6998.35<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->136.0.7103.25<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->18.4<!-- GEN:stop --> ||||
9-
| Firefox <!-- GEN:firefox-version -->135.0<!-- GEN:stop --> ||||
9+
| Firefox <!-- GEN:firefox-version -->137.0<!-- GEN:stop --> ||||
1010

1111
## Documentation
1212

playwright/_impl/_assertions.py

+39
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,45 @@ async def not_to_have_class(
300300
__tracebackhide__ = True
301301
await self._not.to_have_class(expected, timeout)
302302

303+
async def to_contain_class(
304+
self,
305+
expected: Union[
306+
Sequence[str],
307+
str,
308+
],
309+
timeout: float = None,
310+
) -> None:
311+
__tracebackhide__ = True
312+
if isinstance(expected, collections.abc.Sequence) and not isinstance(
313+
expected, str
314+
):
315+
expected_text = to_expected_text_values(expected)
316+
await self._expect_impl(
317+
"to.contain.class.array",
318+
FrameExpectOptions(expectedText=expected_text, timeout=timeout),
319+
expected,
320+
"Locator expected to contain class names",
321+
)
322+
else:
323+
expected_text = to_expected_text_values([expected])
324+
await self._expect_impl(
325+
"to.contain.class",
326+
FrameExpectOptions(expectedText=expected_text, timeout=timeout),
327+
expected,
328+
"Locator expected to contain class",
329+
)
330+
331+
async def not_to_contain_class(
332+
self,
333+
expected: Union[
334+
Sequence[str],
335+
str,
336+
],
337+
timeout: float = None,
338+
) -> None:
339+
__tracebackhide__ = True
340+
await self._not.to_contain_class(expected, timeout)
341+
303342
async def to_have_count(
304343
self,
305344
count: int,

playwright/_impl/_fetch.py

+1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ async def new_context(
7474
storageState: Union[StorageState, str, Path] = None,
7575
clientCertificates: List[ClientCertificate] = None,
7676
failOnStatusCode: bool = None,
77+
maxRedirects: int = None,
7778
) -> "APIRequestContext":
7879
params = locals_to_params(locals())
7980
if "storageState" in params:

playwright/_impl/_js_handle.py

+52
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import base64
1516
import collections.abc
1617
import datetime
1718
import math
19+
import struct
1820
import traceback
1921
from pathlib import Path
2022
from typing import TYPE_CHECKING, Any, Dict, List, Optional, Union
@@ -260,6 +262,56 @@ def parse_value(value: Any, refs: Optional[Dict[int, Any]] = None) -> Any:
260262

261263
if "b" in value:
262264
return value["b"]
265+
266+
if "ta" in value:
267+
encoded_bytes = value["ta"]["b"]
268+
decoded_bytes = base64.b64decode(encoded_bytes)
269+
array_type = value["ta"]["k"]
270+
if array_type == "i8":
271+
word_size = 1
272+
fmt = "b"
273+
elif array_type == "ui8" or array_type == "ui8c":
274+
word_size = 1
275+
fmt = "B"
276+
elif array_type == "i16":
277+
word_size = 2
278+
fmt = "h"
279+
elif array_type == "ui16":
280+
word_size = 2
281+
fmt = "H"
282+
elif array_type == "i32":
283+
word_size = 4
284+
fmt = "i"
285+
elif array_type == "ui32":
286+
word_size = 4
287+
fmt = "I"
288+
elif array_type == "f32":
289+
word_size = 4
290+
fmt = "f"
291+
elif array_type == "f64":
292+
word_size = 8
293+
fmt = "d"
294+
elif array_type == "bi64":
295+
word_size = 8
296+
fmt = "q"
297+
elif array_type == "bui64":
298+
word_size = 8
299+
fmt = "Q"
300+
else:
301+
raise ValueError(f"Unsupported array type: {array_type}")
302+
303+
byte_len = len(decoded_bytes)
304+
if byte_len % word_size != 0:
305+
raise ValueError(
306+
f"Decoded bytes length {byte_len} is not a multiple of word size {word_size}"
307+
)
308+
309+
if byte_len == 0:
310+
return []
311+
array_len = byte_len // word_size
312+
# "<" denotes little-endian
313+
format_string = f"<{array_len}{fmt}"
314+
return list(struct.unpack(format_string, decoded_bytes))
263315
return value
264316

265317

playwright/_impl/_locator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ async def screenshot(
540540
),
541541
)
542542

543-
async def aria_snapshot(self, timeout: float = None) -> str:
543+
async def aria_snapshot(self, timeout: float = None, ref: bool = None) -> str:
544544
return await self._frame._channel.send(
545545
"ariaSnapshot",
546546
{

0 commit comments

Comments
 (0)