Skip to content

Commit ece7531

Browse files
fix(video): return pathlib.Path from Video.path() (#3197)
1 parent 4e174ed commit ece7531

3 files changed

Lines changed: 3 additions & 1 deletion

File tree

‎playwright/_impl/_video.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def path(self) -> pathlib.Path:
4040
)
4141
if not self._artifact:
4242
raise Error("Video recording has not been started.")
43-
return self._artifact.absolute_path
43+
return pathlib.Path(self._artifact.absolute_path)
4444

4545
async def save_as(self, path: Union[str, pathlib.Path]) -> None:
4646
if self._page._connection._is_sync and not self._page._is_closed:

‎tests/async/test_video.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ async def test_should_expose_video_path(
2727
await page.goto(server.PREFIX + "/grid.html")
2828
assert page.video
2929
path = await page.video.path()
30+
assert isinstance(path, Path)
3031
assert str(tmp_path) in str(path)
3132
await page.context.close()
3233

‎tests/sync/test_video.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def test_should_expose_video_path(
3232
video = page.video
3333
assert video
3434
path = video.path()
35+
assert isinstance(path, Path)
3536
assert repr(page.video) == f"<Video page={page}>"
3637
assert str(tmp_path) in str(path)
3738
page.wait_for_timeout(1000)

0 commit comments

Comments
 (0)