From 7905be93461914c97ce00b45146933db47340036 Mon Sep 17 00:00:00 2001 From: Nicola Soranzo Date: Wed, 15 May 2024 11:36:21 +0100 Subject: [PATCH] Update ``playwright_browser`` fixture for pytest-playwright 0.5.0 --- lib/tool_shed/test/functional/conftest.py | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/lib/tool_shed/test/functional/conftest.py b/lib/tool_shed/test/functional/conftest.py index 37bcabc6d661..21172f8ff72e 100644 --- a/lib/tool_shed/test/functional/conftest.py +++ b/lib/tool_shed/test/functional/conftest.py @@ -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 @@ -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) @@ -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)