Skip to content

[BUG] Can't run tests with multiple browsers when overriding page fixture  #172

Description

Context:

  • Playwright Version: 1.34.0 (pytest-playwright: 0.3.3)
  • Operating System: Linux
  • Python version: 3.11
  • Browser: All

Code Snippet

Just a simple test that overrides the page fixture.

import pytest


@pytest.fixture
def page(page):
    # do something with the page
    yield page


def test(page):
    assert True

Describe the bug

When running the above test file with pytest --browser firefox --browser chromium only one instance of the test is run and the following warning is given out instead:

pytest_playwright/pytest_playwright.py:326: UserWarning: When using unittest.TestCase specifying multiple browsers is not supported

When I include some other playwright fixture in either the page fixture or the test method, the test is run with the specified browsers as expected.

So for example, this works:

def test(page, browser_name):  # another playwright fixture
    assert True

But this does not:

def test(page, monkeypatch):  # a pytest fixture
    assert True

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions