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

fix: improve video naming #217

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Changes from all 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
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
Loading