Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(roll): roll to Playwright v1.45.0-beta-1719505820000 #2474

Merged
merged 5 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
mxschmitt marked this conversation as resolved.
Show resolved Hide resolved
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, int, str, datetime.datetime]
mxschmitt marked this conversation as resolved.
Show resolved Hide resolved
) -> Dict[str, Union[int, str]]:
if isinstance(time, (float, int)):
return {"timeNumber": int(time)}
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
56 changes: 12 additions & 44 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 All @@ -6708,13 +6710,11 @@ async def fast_forward(self, ticks: typing.Union[int, str]) -> None:
Parameters
----------
ticks : Union[int, str]
Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are
"08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
"""

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 +6733,7 @@ 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]
"""

return mapping.from_maybe_impl(await self._impl_obj.pause_at(time=time))
Expand Down Expand Up @@ -6761,14 +6761,12 @@ async def run_for(self, ticks: typing.Union[int, str]) -> None:
Parameters
----------
ticks : Union[int, str]
Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are
"08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
"""

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 +6782,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 +6805,7 @@ async def set_system_time(

Parameters
----------
time : Union[datetime.datetime, int, str]
time : Union[datetime.datetime, float, str]
"""

return mapping.from_maybe_impl(await self._impl_obj.set_system_time(time=time))
Expand Down Expand Up @@ -8662,22 +8660,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 +8669,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 +12832,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 +12841,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
58 changes: 14 additions & 44 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 All @@ -6818,15 +6820,13 @@ def fast_forward(self, ticks: typing.Union[int, str]) -> None:
Parameters
----------
ticks : Union[int, str]
Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are
mxschmitt marked this conversation as resolved.
Show resolved Hide resolved
"08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
"""

return mapping.from_maybe_impl(
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 +6845,7 @@ 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]
"""

return mapping.from_maybe_impl(self._sync(self._impl_obj.pause_at(time=time)))
Expand Down Expand Up @@ -6873,13 +6873,11 @@ def run_for(self, ticks: typing.Union[int, str]) -> None:
Parameters
----------
ticks : Union[int, str]
Time may be the number of milliseconds to advance the clock by or a human-readable string. Valid string formats are
"08" for eight seconds, "01:00" for one minute and "02:34:10" for two hours, 34 minutes and ten seconds.
"""

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 +6892,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 +6917,7 @@ 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]
"""

return mapping.from_maybe_impl(
Expand Down Expand Up @@ -8689,22 +8689,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 +8698,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 +12856,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 +12865,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 @@ -483,6 +483,8 @@ def inner_serialize_doc_type(self, type: Any, direction: str) -> str:
return "bool"
if type_name.lower() == "string":
return "str"
if type_name.lower() == "long":
mxschmitt marked this conversation as resolved.
Show resolved Hide resolved
return "float"
if type_name == "any" or type_name == "Serializable":
return "Any"
if type_name == "Object":
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.0-beta-1719505820000"


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