Skip to content

Commit

Permalink
feat: improve video naming
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Apr 15, 2024
1 parent 1a54e22 commit 026faf2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pytest_playwright/pytest_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,14 @@ def context(
failed and video_option == "retain-on-failure"
)
if preserve_video:
for page in pages:
for i, page in enumerate(pages):
video = page.video
if not video:
continue
try:
video_path = video.path()
file_name = os.path.basename(video_path)
video_name = "video.webm" if len(pages) == 1 else f"video-{i+1}.webm"
video.save_as(
path=_build_artifact_test_folder(pytestconfig, request, file_name)
path=_build_artifact_test_folder(pytestconfig, request, video_name)
)
except Error:
# Silent catch empty videos.
Expand Down

0 comments on commit 026faf2

Please sign in to comment.