Skip to content

Commit 4dbc172

Browse files
committed
chore(roll): rol to Playwright v1.45.0-beta-1719505820000
1 parent c6cc4c9 commit 4dbc172

File tree

6 files changed

+52
-102
lines changed

6 files changed

+52
-102
lines changed

README.md

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

55
| | Linux | macOS | Windows |
66
| :--- | :---: | :---: | :---: |
7-
| Chromium <!-- GEN:chromium-version -->127.0.6533.5<!-- GEN:stop --> ||||
7+
| Chromium <!-- GEN:chromium-version -->127.0.6533.17<!-- GEN:stop --> ||||
88
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> ||||
99
| Firefox <!-- GEN:firefox-version -->127.0<!-- GEN:stop --> ||||
1010

playwright/_impl/_clock.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ def __init__(self, browser_context: "BrowserContext") -> None:
2525
self._loop = browser_context._loop
2626
self._dispatcher_fiber = browser_context._dispatcher_fiber
2727

28-
async def install(self, time: Union[int, str, datetime.datetime] = None) -> None:
28+
async def install(self, time: Union[float, str, datetime.datetime] = None) -> None:
2929
await self._browser_context._channel.send(
3030
"clockInstall", parse_time(time) if time is not None else {}
3131
)
3232

3333
async def fast_forward(
3434
self,
35-
ticks: Union[int, str],
35+
ticks: Union[float, str],
3636
) -> None:
3737
await self._browser_context._channel.send(
3838
"clockFastForward", parse_ticks(ticks)
3939
)
4040

4141
async def pause_at(
4242
self,
43-
time: Union[int, str, datetime.datetime],
43+
time: Union[float, str, datetime.datetime],
4444
) -> None:
4545
await self._browser_context._channel.send("clockPauseAt", parse_time(time))
4646

@@ -51,34 +51,36 @@ async def resume(
5151

5252
async def run_for(
5353
self,
54-
ticks: Union[int, str],
54+
ticks: Union[float, str],
5555
) -> None:
5656
await self._browser_context._channel.send("clockRunFor", parse_ticks(ticks))
5757

5858
async def set_fixed_time(
5959
self,
60-
time: Union[int, str, datetime.datetime],
60+
time: Union[float, str, datetime.datetime],
6161
) -> None:
6262
await self._browser_context._channel.send("clockSetFixedTime", parse_time(time))
6363

6464
async def set_system_time(
6565
self,
66-
time: Union[int, str, datetime.datetime],
66+
time: Union[float, str, datetime.datetime],
6767
) -> None:
6868
await self._browser_context._channel.send(
6969
"clockSetSystemTime", parse_time(time)
7070
)
7171

7272

73-
def parse_time(time: Union[int, str, datetime.datetime]) -> Dict[str, Union[int, str]]:
74-
if isinstance(time, int):
75-
return {"timeNumber": time}
73+
def parse_time(
74+
time: Union[float, str, datetime.datetime]
75+
) -> Dict[str, Union[int, str]]:
76+
if isinstance(time, (int, float)):
77+
return {"timeNumber": int(time)}
7678
if isinstance(time, str):
7779
return {"timeString": time}
7880
return {"timeNumber": int(time.timestamp())}
7981

8082

81-
def parse_ticks(ticks: Union[int, str]) -> Dict[str, Union[int, str]]:
82-
if isinstance(ticks, int):
83-
return {"ticksNumber": ticks}
83+
def parse_ticks(ticks: Union[float, str]) -> Dict[str, Union[int, str]]:
84+
if isinstance(ticks, (float, int)):
85+
return {"ticksNumber": int(ticks)}
8486
return {"ticksString": ticks}

playwright/async_api/_generated.py

Lines changed: 16 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -6664,7 +6664,9 @@ def set_test_id_attribute(self, attribute_name: str) -> None:
66646664

66656665
class Clock(AsyncBase):
66666666
async def install(
6667-
self, *, time: typing.Optional[typing.Union[int, str, datetime.datetime]] = None
6667+
self,
6668+
*,
6669+
time: typing.Optional[typing.Union[float, str, datetime.datetime]] = None
66686670
) -> None:
66696671
"""Clock.install
66706672

@@ -6686,13 +6688,13 @@ async def install(
66866688

66876689
Parameters
66886690
----------
6689-
time : Union[datetime.datetime, int, str, None]
6691+
time : Union[datetime.datetime, float, str, None]
66906692
Time to initialize with, current system time by default.
66916693
"""
66926694

66936695
return mapping.from_maybe_impl(await self._impl_obj.install(time=time))
66946696

6695-
async def fast_forward(self, ticks: typing.Union[int, str]) -> None:
6697+
async def fast_forward(self, ticks: typing.Union[float, str]) -> None:
66966698
"""Clock.fast_forward
66976699

66986700
Advance the clock by jumping forward in time. Only fires due timers at most once. This is equivalent to user
@@ -6707,14 +6709,14 @@ async def fast_forward(self, ticks: typing.Union[int, str]) -> None:
67076709

67086710
Parameters
67096711
----------
6710-
ticks : Union[int, str]
6712+
ticks : Union[float, str]
67116713
Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are
67126714
"08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
67136715
"""
67146716

67156717
return mapping.from_maybe_impl(await self._impl_obj.fast_forward(ticks=ticks))
67166718

6717-
async def pause_at(self, time: typing.Union[int, str, datetime.datetime]) -> None:
6719+
async def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> None:
67186720
"""Clock.pause_at
67196721

67206722
Advance the clock by jumping forward in time and pause the time. Once this method is called, no timers are fired
@@ -6733,7 +6735,7 @@ async def pause_at(self, time: typing.Union[int, str, datetime.datetime]) -> Non
67336735

67346736
Parameters
67356737
----------
6736-
time : Union[datetime.datetime, int, str]
6738+
time : Union[datetime.datetime, float, str]
67376739
"""
67386740

67396741
return mapping.from_maybe_impl(await self._impl_obj.pause_at(time=time))
@@ -6746,7 +6748,7 @@ async def resume(self) -> None:
67466748

67476749
return mapping.from_maybe_impl(await self._impl_obj.resume())
67486750

6749-
async def run_for(self, ticks: typing.Union[int, str]) -> None:
6751+
async def run_for(self, ticks: typing.Union[float, str]) -> None:
67506752
"""Clock.run_for
67516753

67526754
Advance the clock, firing all the time-related callbacks.
@@ -6760,15 +6762,15 @@ async def run_for(self, ticks: typing.Union[int, str]) -> None:
67606762

67616763
Parameters
67626764
----------
6763-
ticks : Union[int, str]
6765+
ticks : Union[float, str]
67646766
Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are
67656767
"08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
67666768
"""
67676769

67686770
return mapping.from_maybe_impl(await self._impl_obj.run_for(ticks=ticks))
67696771

67706772
async def set_fixed_time(
6771-
self, time: typing.Union[int, str, datetime.datetime]
6773+
self, time: typing.Union[float, str, datetime.datetime]
67726774
) -> None:
67736775
"""Clock.set_fixed_time
67746776

@@ -6784,14 +6786,14 @@ async def set_fixed_time(
67846786

67856787
Parameters
67866788
----------
6787-
time : Union[datetime.datetime, int, str]
6789+
time : Union[datetime.datetime, float, str]
67886790
Time to be set.
67896791
"""
67906792

67916793
return mapping.from_maybe_impl(await self._impl_obj.set_fixed_time(time=time))
67926794

67936795
async def set_system_time(
6794-
self, time: typing.Union[int, str, datetime.datetime]
6796+
self, time: typing.Union[float, str, datetime.datetime]
67956797
) -> None:
67966798
"""Clock.set_system_time
67976799

@@ -6807,7 +6809,7 @@ async def set_system_time(
68076809

68086810
Parameters
68096811
----------
6810-
time : Union[datetime.datetime, int, str]
6812+
time : Union[datetime.datetime, float, str]
68116813
"""
68126814

68136815
return mapping.from_maybe_impl(await self._impl_obj.set_system_time(time=time))
@@ -8662,22 +8664,6 @@ async def main():
86628664
asyncio.run(main())
86638665
```
86648666

8665-
An example of passing an element handle:
8666-
8667-
```py
8668-
async def print(source, element):
8669-
print(await element.text_content())
8670-
8671-
await page.expose_binding(\"clicked\", print, handle=true)
8672-
await page.set_content(\"\"\"
8673-
<script>
8674-
document.addEventListener('click', event => window.clicked(event.target));
8675-
</script>
8676-
<div>Click me</div>
8677-
<div>Or click me</div>
8678-
\"\"\")
8679-
```
8680-
86818667
Parameters
86828668
----------
86838669
name : str
@@ -8687,6 +8673,7 @@ async def print(source, element):
86878673
handle : Union[bool, None]
86888674
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
86898675
supported. When passing by value, multiple arguments are supported.
8676+
Deprecated: This option will be removed in the future.
86908677
"""
86918678

86928679
return mapping.from_maybe_impl(
@@ -12849,22 +12836,6 @@ async def main():
1284912836
asyncio.run(main())
1285012837
```
1285112838

12852-
An example of passing an element handle:
12853-
12854-
```py
12855-
async def print(source, element):
12856-
print(await element.text_content())
12857-
12858-
await context.expose_binding(\"clicked\", print, handle=true)
12859-
await page.set_content(\"\"\"
12860-
<script>
12861-
document.addEventListener('click', event => window.clicked(event.target));
12862-
</script>
12863-
<div>Click me</div>
12864-
<div>Or click me</div>
12865-
\"\"\")
12866-
```
12867-
1286812839
Parameters
1286912840
----------
1287012841
name : str
@@ -12874,6 +12845,7 @@ async def print(source, element):
1287412845
handle : Union[bool, None]
1287512846
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
1287612847
supported. When passing by value, multiple arguments are supported.
12848+
Deprecated: This option will be removed in the future.
1287712849
"""
1287812850

1287912851
return mapping.from_maybe_impl(

0 commit comments

Comments
 (0)