-1

I'm facing an issue while using the "--video=retain-on-failure" option with pytest-playwright. My intention is to record videos only for failed test cases and do not store video recording for successful test cases. However, even when all tests pass successfully, the videos are still being stored in the video directory.

I've added the --video=retain-on-failure option to my pytest.ini configuration.

addopts = --video=retain-on-failure

@pytest.fixture(scope="module")

@pytest.fixture(scope="module")
def browser(request,headless):
    browser_name = request.param
    with sync_playwright() as playwright:
        browser = playwright[browser_name].launch(headless=headless)
        context = browser.new_context(record_video_dir="videos/")
        yield context
        context.close()
        browser.close()

I have a precondition step that opens a page (example1) and performs some actions inside it opens a seperate page. Then, the actual test case uses the opened page

Subasri sridhar
  • 809
  • 5
  • 13

0 Answers0