def test_record_video_can_get_video_path_immediately(
        browser_type: BrowserType, tmpdir: Path,
        launch_arguments: Dict) -> None:
    context = browser_type.launch_persistent_context(tmpdir,
                                                     **launch_arguments,
                                                     record_video_dir=tmpdir)
    page = context.pages[0]
    video = page.video
    assert video
    path = video.path()
    assert str(tmpdir) in str(path)
    page.wait_for_timeout(1000)
    context.close()
    assert os.path.exists(path)
Exemple #2
0
def context(browser_type: BrowserType, browser_type_launch_args: Dict,
            browser_context_args: Dict):
    context = browser_type.launch_persistent_context(
        "", **{
            **browser_type_launch_args,
            **browser_context_args,
            "viewport": {
                'width': 1920,
                'height': 1080
            },
            "args": ['--window-position=-9,0'],
        })
    yield context
    context.close()
def test_record_video_to_path_persistent(browser_type: BrowserType,
                                         tmpdir: Path, server: Server,
                                         launch_arguments: Dict) -> None:
    context = browser_type.launch_persistent_context(tmpdir,
                                                     **launch_arguments,
                                                     record_video_dir=tmpdir)
    page = context.pages[0]
    page.goto(server.PREFIX + "/grid.html")
    video = page.video
    assert video
    path = video.path()
    assert str(tmpdir) in str(path)
    page.wait_for_timeout(1000)
    context.close()
    assert os.path.exists(path)