microsoft / microsoft/playwright-pytest

Playwright starts browser in headed mode when called from VS Code Debugger - even on headless server

Open
#122 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

The current implementation starts the browser in headed mode automatically, if pytest is invoked from VS Code's debugger.

https://github.com/microsoft/playwright-pytest/blob/68bd92a133eeac597da61a0819768a589dafd6dd/pytest_playwright/pytest_playwright.py#L118-L120

While I get the idea behind this, it does not take remote development on a headless server into account. If $DISPLAY is not set, the test run naturally fails and leaves the user wondering why this happens because he did not provide --headed (e.g. in VS Code's python.testing.pytestArgs configuration). IMHO, the implementation should be changed to check for $DISPLAY at least.

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 reading pytest_playwright/pytest_playwright.py at lines 118-120, then reproduce pytest from the VS Code debugger on a headless server with DISPLAY unset. Done means the automatic headed-mode behavior no longer causes this run to fail when no DISPLAY is available.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.