Skip to content

Commit

Permalink
Update playwright_browser fixture for pytest-playwright 0.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
nsoranzo committed May 15, 2024
1 parent b0032af commit f000065
Showing 1 changed file with 3 additions and 20 deletions.
23 changes: 3 additions & 20 deletions lib/tool_shed/test/functional/conftest.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import os
from typing import (
Any,
Callable,
Dict,
Generator,
)

import pytest
from playwright.sync_api import (
Browser,
BrowserContext,
)
from playwright.sync_api import Browser

from ..base.browser import ShedBrowser
from ..base.playwrightbrowser import PlaywrightShedBrowser
Expand All @@ -23,8 +18,8 @@ def twill_browser() -> Generator[ShedBrowser, None, None]:
yield TwillShedBrowser()


def playwright_browser(class_context: BrowserContext) -> Generator[ShedBrowser, None, None]:
page = class_context.new_page()
def playwright_browser(browser: Browser) -> Generator[ShedBrowser, None, None]:
page = browser.new_page()
yield PlaywrightShedBrowser(page)


Expand All @@ -35,15 +30,3 @@ def playwright_browser(class_context: BrowserContext) -> Generator[ShedBrowser,
shed_browser = pytest.fixture(scope="class")(playwright_browser)
else:
raise ValueError(f"Unrecognized value for TOOL_SHED_TEST_BROWSER: {test_browser}")


@pytest.fixture(scope="class")
def class_context(
browser: Browser,
browser_context_args: Dict,
pytestconfig: Any,
request: pytest.FixtureRequest,
) -> Generator[BrowserContext, None, None]:
from pytest_playwright.pytest_playwright import context

yield from context.__pytest_wrapped__.obj(browser, browser_context_args, pytestconfig, request)

0 comments on commit f000065

Please sign in to comment.