Skip to content

Commit

Permalink
chore(roll): roll to Playwright 1.45.1-beta-1719996498000 (#2474)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt authored Jul 3, 2024
1 parent d83dc6e commit 8f9bcd1
Show file tree
Hide file tree
Showing 8 changed files with 86 additions and 124 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Playwright is a Python library to automate [Chromium](https://www.chromium.org/H

| | Linux | macOS | Windows |
| :--- | :---: | :---: | :---: |
| Chromium <!-- GEN:chromium-version -->127.0.6533.5<!-- GEN:stop --> ||||
| Chromium <!-- GEN:chromium-version -->127.0.6533.17<!-- GEN:stop --> ||||
| WebKit <!-- GEN:webkit-version -->17.4<!-- GEN:stop --> ||||
| Firefox <!-- GEN:firefox-version -->127.0<!-- GEN:stop --> ||||

Expand Down
18 changes: 10 additions & 8 deletions playwright/_impl/_clock.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self, browser_context: "BrowserContext") -> None:
self._loop = browser_context._loop
self._dispatcher_fiber = browser_context._dispatcher_fiber

async def install(self, time: Union[int, str, datetime.datetime] = None) -> None:
async def install(self, time: Union[float, str, datetime.datetime] = None) -> None:
await self._browser_context._channel.send(
"clockInstall", parse_time(time) if time is not None else {}
)
Expand All @@ -40,7 +40,7 @@ async def fast_forward(

async def pause_at(
self,
time: Union[int, str, datetime.datetime],
time: Union[float, str, datetime.datetime],
) -> None:
await self._browser_context._channel.send("clockPauseAt", parse_time(time))

Expand All @@ -57,25 +57,27 @@ async def run_for(

async def set_fixed_time(
self,
time: Union[int, str, datetime.datetime],
time: Union[float, str, datetime.datetime],
) -> None:
await self._browser_context._channel.send("clockSetFixedTime", parse_time(time))

async def set_system_time(
self,
time: Union[int, str, datetime.datetime],
time: Union[float, str, datetime.datetime],
) -> None:
await self._browser_context._channel.send(
"clockSetSystemTime", parse_time(time)
)


def parse_time(time: Union[int, str, datetime.datetime]) -> Dict[str, Union[int, str]]:
if isinstance(time, int):
return {"timeNumber": time}
def parse_time(
time: Union[float, str, datetime.datetime]
) -> Dict[str, Union[int, str]]:
if isinstance(time, (float, int)):
return {"timeNumber": int(time * 1_000)}
if isinstance(time, str):
return {"timeString": time}
return {"timeNumber": int(time.timestamp())}
return {"timeNumber": int(time.timestamp() * 1_000)}


def parse_ticks(ticks: Union[int, str]) -> Dict[str, Union[int, str]]:
Expand Down
54 changes: 14 additions & 40 deletions playwright/async_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -6664,7 +6664,9 @@ def set_test_id_attribute(self, attribute_name: str) -> None:

class Clock(AsyncBase):
async def install(
self, *, time: typing.Optional[typing.Union[int, str, datetime.datetime]] = None
self,
*,
time: typing.Optional[typing.Union[float, str, datetime.datetime]] = None
) -> None:
"""Clock.install

Expand All @@ -6686,7 +6688,7 @@ async def install(

Parameters
----------
time : Union[datetime.datetime, int, str, None]
time : Union[datetime.datetime, float, str, None]
Time to initialize with, current system time by default.
"""

Expand Down Expand Up @@ -6714,7 +6716,7 @@ async def fast_forward(self, ticks: typing.Union[int, str]) -> None:

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

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

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

Parameters
----------
time : Union[datetime.datetime, int, str]
time : Union[datetime.datetime, float, str]
Time to pause at.
"""

return mapping.from_maybe_impl(await self._impl_obj.pause_at(time=time))
Expand Down Expand Up @@ -6768,7 +6771,7 @@ async def run_for(self, ticks: typing.Union[int, str]) -> None:
return mapping.from_maybe_impl(await self._impl_obj.run_for(ticks=ticks))

async def set_fixed_time(
self, time: typing.Union[int, str, datetime.datetime]
self, time: typing.Union[float, str, datetime.datetime]
) -> None:
"""Clock.set_fixed_time

Expand All @@ -6784,14 +6787,14 @@ async def set_fixed_time(

Parameters
----------
time : Union[datetime.datetime, int, str]
time : Union[datetime.datetime, float, str]
Time to be set.
"""

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

async def set_system_time(
self, time: typing.Union[int, str, datetime.datetime]
self, time: typing.Union[float, str, datetime.datetime]
) -> None:
"""Clock.set_system_time

Expand All @@ -6807,7 +6810,8 @@ async def set_system_time(

Parameters
----------
time : Union[datetime.datetime, int, str]
time : Union[datetime.datetime, float, str]
Time to be set.
"""

return mapping.from_maybe_impl(await self._impl_obj.set_system_time(time=time))
Expand Down Expand Up @@ -8662,22 +8666,6 @@ async def main():
asyncio.run(main())
```

An example of passing an element handle:

```py
async def print(source, element):
print(await element.text_content())

await page.expose_binding(\"clicked\", print, handle=true)
await page.set_content(\"\"\"
<script>
document.addEventListener('click', event => window.clicked(event.target));
</script>
<div>Click me</div>
<div>Or click me</div>
\"\"\")
```

Parameters
----------
name : str
Expand All @@ -8687,6 +8675,7 @@ async def print(source, element):
handle : Union[bool, None]
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
supported. When passing by value, multiple arguments are supported.
Deprecated: This option will be removed in the future.
"""

return mapping.from_maybe_impl(
Expand Down Expand Up @@ -12849,22 +12838,6 @@ async def main():
asyncio.run(main())
```

An example of passing an element handle:

```py
async def print(source, element):
print(await element.text_content())

await context.expose_binding(\"clicked\", print, handle=true)
await page.set_content(\"\"\"
<script>
document.addEventListener('click', event => window.clicked(event.target));
</script>
<div>Click me</div>
<div>Or click me</div>
\"\"\")
```

Parameters
----------
name : str
Expand All @@ -12874,6 +12847,7 @@ async def print(source, element):
handle : Union[bool, None]
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
supported. When passing by value, multiple arguments are supported.
Deprecated: This option will be removed in the future.
"""

return mapping.from_maybe_impl(
Expand Down
56 changes: 16 additions & 40 deletions playwright/sync_api/_generated.py
Original file line number Diff line number Diff line change
Expand Up @@ -6774,7 +6774,9 @@ def set_test_id_attribute(self, attribute_name: str) -> None:

class Clock(SyncBase):
def install(
self, *, time: typing.Optional[typing.Union[int, str, datetime.datetime]] = None
self,
*,
time: typing.Optional[typing.Union[float, str, datetime.datetime]] = None
) -> None:
"""Clock.install

Expand All @@ -6796,7 +6798,7 @@ def install(

Parameters
----------
time : Union[datetime.datetime, int, str, None]
time : Union[datetime.datetime, float, str, None]
Time to initialize with, current system time by default.
"""

Expand Down Expand Up @@ -6826,7 +6828,7 @@ def fast_forward(self, ticks: typing.Union[int, str]) -> None:
self._sync(self._impl_obj.fast_forward(ticks=ticks))
)

def pause_at(self, time: typing.Union[int, str, datetime.datetime]) -> None:
def pause_at(self, time: typing.Union[float, str, datetime.datetime]) -> None:
"""Clock.pause_at

Advance the clock by jumping forward in time and pause the time. Once this method is called, no timers are fired
Expand All @@ -6845,7 +6847,8 @@ def pause_at(self, time: typing.Union[int, str, datetime.datetime]) -> None:

Parameters
----------
time : Union[datetime.datetime, int, str]
time : Union[datetime.datetime, float, str]
Time to pause at.
"""

return mapping.from_maybe_impl(self._sync(self._impl_obj.pause_at(time=time)))
Expand Down Expand Up @@ -6879,7 +6882,7 @@ def run_for(self, ticks: typing.Union[int, str]) -> None:

return mapping.from_maybe_impl(self._sync(self._impl_obj.run_for(ticks=ticks)))

def set_fixed_time(self, time: typing.Union[int, str, datetime.datetime]) -> None:
def set_fixed_time(self, time: typing.Union[float, str, datetime.datetime]) -> None:
"""Clock.set_fixed_time

Makes `Date.now` and `new Date()` return fixed fake time at all times, keeps all the timers running.
Expand All @@ -6894,15 +6897,17 @@ def set_fixed_time(self, time: typing.Union[int, str, datetime.datetime]) -> Non

Parameters
----------
time : Union[datetime.datetime, int, str]
time : Union[datetime.datetime, float, str]
Time to be set.
"""

return mapping.from_maybe_impl(
self._sync(self._impl_obj.set_fixed_time(time=time))
)

def set_system_time(self, time: typing.Union[int, str, datetime.datetime]) -> None:
def set_system_time(
self, time: typing.Union[float, str, datetime.datetime]
) -> None:
"""Clock.set_system_time

Sets current system time but does not trigger any timers.
Expand All @@ -6917,7 +6922,8 @@ def set_system_time(self, time: typing.Union[int, str, datetime.datetime]) -> No

Parameters
----------
time : Union[datetime.datetime, int, str]
time : Union[datetime.datetime, float, str]
Time to be set.
"""

return mapping.from_maybe_impl(
Expand Down Expand Up @@ -8689,22 +8695,6 @@ def run(playwright: Playwright):
run(playwright)
```

An example of passing an element handle:

```py
def print(source, element):
print(element.text_content())

page.expose_binding(\"clicked\", print, handle=true)
page.set_content(\"\"\"
<script>
document.addEventListener('click', event => window.clicked(event.target));
</script>
<div>Click me</div>
<div>Or click me</div>
\"\"\")
```

Parameters
----------
name : str
Expand All @@ -8714,6 +8704,7 @@ def print(source, element):
handle : Union[bool, None]
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
supported. When passing by value, multiple arguments are supported.
Deprecated: This option will be removed in the future.
"""

return mapping.from_maybe_impl(
Expand Down Expand Up @@ -12871,22 +12862,6 @@ def run(playwright: Playwright):
run(playwright)
```

An example of passing an element handle:

```py
def print(source, element):
print(element.text_content())

context.expose_binding(\"clicked\", print, handle=true)
page.set_content(\"\"\"
<script>
document.addEventListener('click', event => window.clicked(event.target));
</script>
<div>Click me</div>
<div>Or click me</div>
\"\"\")
```

Parameters
----------
name : str
Expand All @@ -12896,6 +12871,7 @@ def print(source, element):
handle : Union[bool, None]
Whether to pass the argument as a handle, instead of passing by value. When passing a handle, only one argument is
supported. When passing by value, multiple arguments are supported.
Deprecated: This option will be removed in the future.
"""

return mapping.from_maybe_impl(
Expand Down
2 changes: 2 additions & 0 deletions scripts/documentation_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ def inner_serialize_doc_type(self, type: Any, direction: str) -> str:
return f"{{{', '.join(items)}}}"
if type_name == "boolean":
return "bool"
if type_name == "long":
return "int"
if type_name.lower() == "string":
return "str"
if type_name == "any" or type_name == "Serializable":
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
InWheel = None
from wheel.bdist_wheel import bdist_wheel as BDistWheelCommand

driver_version = "1.45.0-alpha-2024-06-14"
driver_version = "1.45.1-beta-1719996498000"


def extractall(zip: zipfile.ZipFile, path: str) -> None:
Expand Down
Loading

0 comments on commit 8f9bcd1

Please sign in to comment.