Skip to content

Commit

Permalink
feat: pytest-playwright==0.5.0
Browse files Browse the repository at this point in the history
fix #7
  • Loading branch information
m9810223 committed May 24, 2024
1 parent 931cad8 commit d4e5ced
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 4 additions & 4 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ version = "0.14.0"
requires-python = ">=3.8"
dependencies = [
# https://pypi.org/project/pytest-playwright/
"pytest-playwright==0.4.4",
# https://github.com/microsoft/playwright-pytest/blob/v0.5.0/pytest_playwright/pytest_playwright.py
"pytest-playwright==0.5.0",
# https://github.com/microsoft/playwright-python/blob/main/local-requirements.txt
"pytest-asyncio",
]
Expand Down
7 changes: 4 additions & 3 deletions src/pytest_playwright_async/pytest_playwright_async.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
import tempfile
import typing as t

from playwright.async_api import Browser
Expand All @@ -14,7 +15,6 @@
from pytest_playwright.pytest_playwright import VSCODE_PYTHON_EXTENSION_ID
from pytest_playwright.pytest_playwright import _build_artifact_test_folder
from pytest_playwright.pytest_playwright import _is_debugger_attached
from pytest_playwright.pytest_playwright import artifacts_folder
from pytest_playwright.pytest_playwright import slugify


Expand Down Expand Up @@ -42,6 +42,7 @@ def browser_context_args_async(
playwright_async: Playwright,
device: t.Optional[str],
base_url: t.Optional[str],
_pw_artifacts_folder: tempfile.TemporaryDirectory,
) -> t.Dict:
context_args = {}
if device:
Expand All @@ -52,7 +53,7 @@ def browser_context_args_async(
video_option = pytestconfig.getoption('--video')
capture_video = video_option in ['on', 'retain-on-failure']
if capture_video:
context_args['record_video_dir'] = artifacts_folder.name
context_args['record_video_dir'] = _pw_artifacts_folder.name

return context_args

Expand Down Expand Up @@ -84,7 +85,7 @@ async def launch(**kwargs: dict) -> Browser:

@pytest_asyncio.fixture(scope='session')
async def browser_async(
launch_browser_async: t.Callable[..., t.Awaitable[Browser]]
launch_browser_async: t.Callable[..., t.Awaitable[Browser]],
) -> t.AsyncGenerator[Browser, None]:
browser = await launch_browser_async()
yield browser
Expand Down

0 comments on commit d4e5ced

Please sign in to comment.