Skip to content

feat(selenium-devtools-py): configure capture from pytest, not just the shell - #355

Open
vishnuv688 wants to merge 1 commit into
mainfrom
vv/339-pytest-config-surface
Open

feat(selenium-devtools-py): configure capture from pytest, not just the shell#355
vishnuv688 wants to merge 1 commit into
mainfrom
vv/339-pytest-config-surface

Conversation

@vishnuv688

@vishnuv688 vishnuv688 commented Sep 1, 2026

Copy link
Copy Markdown
Member

What & why

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Polish (an improvement to an existing feature)
  • Breaking change (existing behavior changes for users)
  • Documentation
  • Internal (build, CI, dependencies, tooling)

Packages touched

  • shared (types and contracts)
  • core (framework-agnostic capture/reporting)
  • elements (published element/snapshot API — @wdio/elements)
  • service (WebdriverIO adapter)
  • nightwatch-devtools (Nightwatch adapter)
  • selenium-devtools (Selenium adapter)
  • backend (server)
  • app (UI)
  • script (page-injected runtime)
  • selenium-devtools-py

Notes for reviewers

Screenshots / recordings

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds explicit pytest CLI and ini configuration for Python Selenium DevTools capture while retaining environment-variable fallback.

  • Adds --devtools and --devtools-trace flags with project-level boolean ini equivalents.
  • Resolves capture and trace settings using CLI, ini, then environment precedence.
  • Tears down dashboard capture when collection produces no tests.
  • Updates documentation, examples, demo commands, and configuration tests.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking issue established.

The new pytest configuration paths are covered across CLI, ini, environment, collect-only, and empty-run behavior, and no reachable regression was established from the changed lifecycle logic.

Important Files Changed

Filename Overview
packages/selenium-devtools-py/src/selenium_devtools/pytest_plugin.py Adds pytest option registration, precedence resolution, cached run enablement, trace-mode forwarding, and empty-collection teardown without an established defect.
packages/selenium-devtools-py/tests/test_pytest_config.py Adds unit and real-pytest subprocess coverage for CLI, ini, environment, collect-only, precedence, and teardown behavior.
packages/selenium-devtools-py/README.md Documents the new pytest flags, ini settings, precedence rules, environment fallback, and trace behavior.
package.json Updates the pytest demo command to opt in through the new CLI flag.
examples/selenium/python-test/test_login_pytest.py Updates the example invocation to demonstrate --devtools.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    Start[pytest starts] --> CollectOnly{collect-only?}
    CollectOnly -->|Yes| Disabled[Capture disabled]
    CollectOnly -->|No| CLI{CLI capture or trace flag?}
    CLI -->|Yes| Enabled[Enable capture]
    CLI -->|No| INI{Explicit ini setting?}
    INI -->|Enabled| Enabled
    INI -->|Disabled| Disabled
    INI -->|Unset| ENV{DEVTOOLS_ENABLE or DEVTOOLS_PORT?}
    ENV -->|Present| Enabled
    ENV -->|Absent| Disabled
    Enabled --> Collection{Tests collected?}
    Collection -->|No| Teardown[Disable unused run]
    Collection -->|Yes| Capture[Capture test lifecycle]
Loading

Reviews (1): Last reviewed commit: "feat(selenium-devtools-py): configure ca..." | Re-trigger Greptile

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable the pytest plugin from pytest's own config, not only an env var

1 participant