microsoft / microsoft/playwright-pytest

Request: extending `browser_type_launch_args` to work with `request`

Open
#205 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
563
Forks
90
Avg merge
11m
Merged PRs (30d)
1

Description

It would be cool if one can parameterize browser_type_launch_args using pytest.mark.parameterize's indirect=True flag with the request parameter like so:

import pytest


@pytest.fixture(scope="session")
def browser_type_launch_args(pytestconfig, request) -> dict:
    launch_options = {}
    if pytestconfig.getoption("--headed") or request.param.get("headed"):
        launch_options["headless"] = False
    ...
    return launch_options


@pytest.mark.parametrize(
    "browser_type_launch_args", [{"headed": True}], indirect=True
)
def test_browser_type_launch_args(browser_type_launch_args: dict) -> None:
    pass

This would enable in-source configuration (more readable), without having to pass args externally or via config file.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the browser_type_launch_args fixture and its interaction with pytestconfig, then trace how pytest.mark.parametrize with indirect=True supplies request.param. Confirm completion by covering the headed option shown in the example while preserving existing external or config-file behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
playwright, python
Domain
testing-qa
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.