Skip to content

Commit

Permalink
fix: clean up videos after each test
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Apr 16, 2024
1 parent 2d5a080 commit cc8b7d1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pytest_playwright/pytest_playwright.py
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,11 @@ def did_finish_test(self, failed: bool) -> None:
except Error:
# Silent catch empty videos.
pass
else:
for page in self._all_pages:
# Can be changed to "if page.video" once https://github.com/microsoft/playwright-python/pull/2410 is released and used.
if video_option in ["on", "retain-on-failure"]:
page.video.delete()

def on_did_create_browser_context(self, context: BrowserContext) -> None:
context.on("page", lambda page: self._all_pages.append(page))
Expand Down

0 comments on commit cc8b7d1

Please sign in to comment.