Closed slafs closed 1 week ago
From looking at pytest_playwright
sources it seems they're using BrowserContext
:
@pytest.fixture
def page(context: BrowserContext) -> Generator[Page, None, None]:
page = context.new_page()
yield page
Maybe this will help?
context
fixture is fine. It's the new_context
fixture that doesn't "work" for us.
Sorry, I somehow managed to ignore the fact, that I have outdated pytest-playwright
in my setup :(
This should be fixed as part of 0.5.2.
We have a Python project based on pytest and playwright. We wanted to leverage type hints from the beginning and we're using
mypy
for type checking. When we write a test (or a fixture) that uses one of the playwrights pytest fixtures (likecontext
orpage
) we can easily type hint that e.g.:However, we ran into a problem where we can't really type hint the usage of
new_context
fixture. While trying this:Mypy screams:
Used versions: