Skip to content

fix(selenium-devtools): apply port, hostname and capture options in configure() - #430

Merged
vishnuv688 merged 2 commits into
mainfrom
fix/selenium-configure-options
Oct 13, 2026
Merged

vishnuv688 merged 2 commits into
mainfrom
fix/selenium-configure-options

Conversation

@vishnuv688

Copy link
Copy Markdown
Member

What & why

DevTools.configure() accepted only eleven keys. port, hostname, captureScreenshots, filmstrip and emitArtifactsManifest are declared on DevToolsOptions, read by the plugin's constructor and documented in the README and on the website, but configure() dropped them. The plugin is constructed with no options, so configure() is the only way to set anything: those five always ran at their defaults, and a TypeScript caller got a type error while a JavaScript caller got silence.

This makes configure() take DevToolsOptions and apply all of them:

  • Every option is applied. Option copying lives in helpers/configure-options.ts, keyed by a Record over DevToolsOptions, so an option added later fails to compile until it is handled instead of being silently dropped again.
  • A rerun keeps its parent's backend. A rerun loads the test file again, so a configure({ port }) there would otherwise point the child at a port no dashboard is listening on. Port and hostname are skipped silently in that case, because that is the rerun working.
  • Late port/hostname are refused with a warning. Once the backend start has begun they can no longer take effect, so the plugin logs a warning instead of doing nothing.
  • Bad values are refused. null and an invalid port (NaN, out of range) are not applied.

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)
  • selenium-devtools-py (Selenium Python adapter)
  • backend (server)
  • app (UI)
  • script (page-injected runtime)
  • trace (Trace mode)

Notes for reviewers

  • Why a helper. No test imports the plugin entry, because importing it patches selenium. The option-copying logic is extracted as a pure helper so it can be unit-tested. The lock decision (rerun vs. backend already starting) is a separate pure function with its own tests.
  • Verification. pnpm build, pnpm test (2518 passed) and pnpm lint are green. Lint shows no new warnings: the same 4 as on main in this package.
  • Not verified in a browser. This is option plumbing; no example run was done.
  • Docs. The README already documented these options. It gains one note on when port/hostname take effect. The matching website page is updated in the companion webdriverio docs PR, which should merge after this ships in a release.

🤖 Generated with Claude Code

…onfigure()

DevTools.configure() accepted only eleven keys, so port, hostname,
captureScreenshots, filmstrip and emitArtifactsManifest were declared on
DevToolsOptions and documented, yet silently ignored. The plugin is built
with no options, so configure() is the only way to set anything and the
defaults always applied.

configure() now takes DevToolsOptions and copies every option through a
Record keyed on that type, so an option added later fails to compile
until it is handled. A rerun keeps its parent's backend whatever port
the test file asks for, since a rerun loads the file again; port and
hostname passed after the backend start has begun are ignored with a
warning, and null values or an invalid port are refused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with one non-blocking correction to the release note.

Findings

  1. P2 Missing promised warning ▶

Summary

DevTools.configure() now applies the previously ignored server and capture options.

  • Selenium DevTools applies the options passed to configure().
  • Backend address settings stay with the backend that starts or is reused.

Reviews (2) · Last reviewed commit: "fix(selenium-devtools): refuse configure..." · Reviewed by Greptile

Comment thread packages/selenium-devtools/src/helpers/configure-options.ts Outdated
JS callers bypass the option types, and configure() copied any defined
value straight through. The string 'false' is truthy, so
DevTools.configure({ headless: process.env.HEADLESS }) with HEADLESS=false
turned headless on.

The old per-option boolean checks are restored as per-kind shape checks
covering every option (boolean, non-empty string choice, port, host). A
value of the wrong shape is refused with a warning naming the option, the
expected shape and the value, instead of being applied or silently dropped.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Comment thread .changeset/selenium-configure-options.md
@vishnuv688
vishnuv688 merged commit 7af1205 into main Oct 13, 2026
11 checks passed
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.

1 participant