Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .changeset/attempt-end-time-and-queued-scenario-feature.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
'@wdio/selenium-devtools': patch
'@wdio/devtools-core': patch
'@wdio/devtools-service': patch
---

Expand Down
2 changes: 2 additions & 0 deletions .changeset/filmstrip-poll-queue.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
---

Without a CDP screencast (Safari, Appium), the `filmstrip` recorder no longer queues its screenshots in front of the test. It skips a poll while a command or a per-action capture holds the driver (polling anyway once the newest frame is three intervals old, so the longest gap is about three intervals plus one screenshot, but never during a click, typing or a capture), keeps each per-action capture's screenshot as a filmstrip frame, and skips the poll that would only repeat it. The interval and the filmstrip default are unchanged, and Chrome's CDP push mode is untouched. With `DEVTOOLS_CAPTURE_TIMING=1`, the report adds a `filmstrip recorder` line: the screenshots the recorder took and their time, the polls it skipped and why, and the capture screenshots it kept as frames.

A Nightwatch driver window opens only for input commands, commands the trace maps to an action, and known driver reads, so a command that never calls back from the driver, such as `browser.element()`, `actions()` or a custom command that never calls its `done` callback, no longer holds the poll for its full bound. The service's own injection calls, made when a session is re-armed after `reloadSession` or a context change, open no driver window either, so they no longer replace the window of the user command that ran alongside them.
2 changes: 1 addition & 1 deletion .changeset/manifest-relative-artifact-paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
'@wdio/nightwatch-devtools': minor
---

The artifacts manifest format changed incompatibly. Artifact paths are relative to the manifest's directory, `tests[].attempts[]` carries a `final` flag on the attempt that decided the test, `tests[].specFile` is relative to the working directory when it lies under it, and the absolute `cwd` is gone. The manifest now carries `manifestVersion: 2`, so a reader can tell it from the older format. A script that read the absolute artifact path must resolve it against the manifest's directory, and one that read `cwd` must stop doing so. Without a `TRACEPARENT`, every attempt of one test now carries the same trace id, derived from the run id (`DEVTOOLS_RUN_ID`) and the test's uid, where each attempt had its own before; a run id reused across runs therefore puts the same test's attempts from those runs in one trace.
The artifacts manifest format changed incompatibly. Artifact paths are relative to the manifest's directory (a path on another Windows drive stays absolute), and `tests[].specFile` is relative to the working directory when it lies under it. The manifest now carries `manifestVersion: 2`, so a reader can tell it from the older format. A script that read the absolute artifact path must resolve it against the manifest's directory.
2 changes: 1 addition & 1 deletion .changeset/otel-attempt-trace-ids.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
'@wdio/nightwatch-devtools': minor
---

The artifacts manifest now carries the run's `runId`, the parent trace context from `TRACEPARENT` when set, the `cwd` and browser name, version and platform, and an `attempts[]` list per test. Each attempt entry holds a trace and span id minted when the attempt starts, and its own `error`. Attempt numbers no longer repeat within a worker, and a `specFileRetries` rerun starts at its real attempt, so `on-first-retry` now retains a rerun's trace and `retain-on-first-failure` does not.
The artifacts manifest now carries the run's `runId`, the parent trace context from `TRACEPARENT` when set, the browser name, version and platform, and an `attempts[]` list per test, with `final: true` on the attempt that decided the test. Each attempt entry holds a span id minted when the attempt starts, a trace id, and its own `error`. With a valid `TRACEPARENT`, every attempt carries the parent's trace id. Without one, every attempt of one test shares a trace id derived from the run id (`DEVTOOLS_RUN_ID`) and the test's uid, so a run id reused across runs puts the same test's attempts from those runs in one trace. Attempt numbers no longer repeat within a worker.
2 changes: 1 addition & 1 deletion .changeset/service-spec-file-retry-attempt.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
'@wdio/devtools-service': patch
---

A test run by a `specFileRetries` rerun records its real attempt number instead of 0.
A test run by a `specFileRetries` rerun records its real attempt number instead of 0, so `on-first-retry` now retains a rerun's trace and `retain-on-first-failure` does not.
2 changes: 2 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
- [ ] `app` (UI)
- [ ] `script` (page-injected runtime)
- [ ] `trace` (Trace mode)
- [ ] `otel` (`@wdio/opentelemetry`, the `wdio-otel` CLI)
- [ ] `conformance` (cross-adapter conformance suite)

## Capability matrix

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Manual PyPI Publish

# Mirrors release.yml's manual, button-triggered shape for the Python adapter.
# Unlike npm (NPM_TOKEN), PyPI uses trusted publishing (OIDC) — no secret.
# Bump `__version__` in src/selenium_devtools/__init__.py before running.
# The job bumps `__version__` in src/selenium_devtools/__init__.py itself (`changes.py apply`) before building.

on:
workflow_dispatch:
Expand Down
8 changes: 7 additions & 1 deletion ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ Imports from: `core` and `shared` (`deepCapString`, to read native-session capab

The DOM-walking scripts run in the page via `browser.execute`, so — like `script` — they avoid Node-only APIs.

### `packages/otel` — `@wdio/opentelemetry`

Published package with the `wdio-otel` CLI. It runs after a run, outside the test process: it reads the artifacts manifests a trace- or telemetry-mode run wrote (and, with `--trace-zips`, the trace zips a trace-mode manifest names; a telemetry run writes none) and pushes each test attempt as an OpenTelemetry span to an OTLP collector.

Imports from: `shared` and `@wdio/devtools-trace/trace-reader`. It is not an adapter and imports neither `core` nor an adapter; no ESLint rule enforces this.

### `packages/conformance`: cross-adapter conformance suite

Test-only and never published or bundled. Each adapter runs one scenario (open `/login`, type, submit to `/secure`, wait for a late element and assert on its text, wait on a condition reading two elements and on a helper repeating the test's own read, log out, then an assertion that fails, an element wait that times out and a navigation that fails) as its own process, against a fake W3C WebDriver server that models two pages and records what really happened in the browser: which documents were born and when, and which navigations failed. The adapter reports into a recording backend that stands in for the dashboard, reached through the same reuse handshake a rerun uses, so no adapter gains a code path for being tested. `src/checker.ts` then judges the recorded frame stream against behavioural rules, for example "a row replays the page the browser was on when its action completed" and "every document gets exactly one anchor at its birth time". Every adapter is checked by the same rules, so a capture fix that lands in one language and not another fails CI.
Expand All @@ -213,7 +219,7 @@ Per-adapter demo projects used for manual verification. One directory per adapte

- `examples/wdio/` — `mocha/` (including `native/`, an Appium app spec run by `pnpm demo:wdio:native`), `cucumber/`, `mobile/`, shared page objects in `pageobjects/`. Run via `pnpm demo:wdio` (Cucumber) or `pnpm demo:wdio:mocha`.
- `examples/nightwatch/` — `bdd/` (Nightwatch's `describe/it` interface), `cucumber/` and `mobile/`. Run via `pnpm demo:nightwatch`.
- `examples/selenium-js/` — `mocha/`, `jest/`, `cucumber/`, `mobile/`. `pnpm demo:selenium` runs Cucumber; `pnpm --filter @wdio/selenium-devtools example:<runner>` runs a specific one.
- `examples/selenium-js/` — `mocha/`, `jest/`, `cucumber/`, `mobile/`. `pnpm demo:selenium` runs Cucumber; `pnpm --filter @wdio/selenium-devtools example:mocha`, `example:mocha:allure`, `example:jest` or `example:cucumber` runs a specific one.
- `examples/selenium-py/` — the Python adapter: `scripts/` for the plain-script cases (no test runner) and `pytest/` for the pytest one. Run via `pnpm demo:python`, `:login` or `:pytest`.

Every adapter also has a `mobile/` example driving the same Appium capability bag. A runner directory holds its own config and specs. `features/` inside a Cucumber directory is Cucumber's own convention, not ours.
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ The Python adapter takes the same options as `enable(mask_inputs=..., mask_selec

**Passwords and credentials are redacted by default.** Before a test types into an `<input type="password">` (WebdriverIO `setValue` / `addValue`, Selenium `sendKeys`, Nightwatch `setValue` / `setPassword` / `sendKeys` / `updateValue`, Python `send_keys`), the adapter reads the field's type and, for a password field, adds the typed value to the run's redaction set, so the row that types it already carries `••••`, a fixed placeholder that hides its length. From then on the value is replaced in everything the adapter sends or writes: every row, result and error (the Actions list, step titles once re-sent, the Log and Errors sections), `transcript.md` and the trace's action events, console lines and captured stdout, network URLs, headers and bodies, the DOM anchor and every mutation, the element and accessibility captures, the test source, the suite tree and the run's metadata. Independently of any typing, the values of `Authorization`, `Proxy-Authorization`, `Cookie` and `Set-Cookie` are replaced in every network row's `headers`, `requestHeaders` and `responseHeaders` and so in the trace's HAR, keeping the header names; each cookie's value in a navigation row's `cookies` (`document.cookie`) is replaced, keeping its name, and so is the `value` of every cookie object a command returns (`getCookies`). All of this follows `maskInputs`: `maskInputs: false` turns it off with the page masking.

The field-type read is one driver round trip per typing command whose value is 4 characters or more and not already known, taken before the keys are sent. WebdriverIO starts it in `beforeCommand` of the `elementSendKeys` that `setValue` / `addValue` issue (reading the element's `type` property) without holding that hook, and waits for it only before the row is recorded; Selenium awaits `getProperty('type')` on the element before `sendKeys` reaches the driver; Nightwatch queues a `perform` ahead of the typing command that runs one script over the raw WebDriver transport, resolving the selector as a WebDriver find does: its first match, by the call's `using` argument or the definition's `locateStrategy`, else the client's strategy (`useXpath()` / `useCss()` as the test last called them, then the `use_xpath` setting), CSS or XPath only; Python reads `getElementProperty` before `sendKeysToElement` runs. Each read is capped at 2 s and never holds the command back. A read that fails or times out, or a field the adapter cannot locate to read (on Nightwatch, one located by a strategy other than CSS or XPath, or with no selector), counts as a password field: the typed value is redacted, since redacting a value that was not a password is the safer error, and the run logs one warning that names no value. Nightwatch's `setPassword` is taken as a password without a read. In Python a session whose read timed out reads no more, since the abandoned read is still on the session, and what it types afterwards is redacted the same way. A field that answers with no type at all (an element that is not a form control) is not a password field, except on a WebdriverIO Appium mobile-web session, whose direct read cannot tell that answer from a failed one and redacts. Native app sessions skip it on every adapter; on an Appium mobile-web session WebdriverIO reads straight from the driver rather than through `browser`, as its other in-hook probes do.
The field-type read is one driver round trip per typing command whose value is 4 characters or more and not already known, taken before the keys are sent. WebdriverIO starts it in `beforeCommand` of the `elementSendKeys` that `setValue` / `addValue` issue (reading the element's `type` property) without holding that hook, and waits for it only before the row is recorded; Selenium awaits `getProperty('type')` on the element before `sendKeys` reaches the driver; Nightwatch queues a `perform` ahead of the typing command that runs one script over the raw WebDriver transport, resolving the selector as a WebDriver find does: its first match, by the call's `using` argument or the definition's `locateStrategy`, else the client's strategy (`useXpath()` / `useCss()` as the test last called them, then the `use_xpath` setting), CSS or XPath only; Python reads `getElementProperty` before `sendKeysToElement` runs. Each read is capped at 2 s. Frames the JavaScript adapters send while a read is in flight are held until every read in flight has settled, so none can carry a password before it is learned. One read holds frames for at most 2 s; overlapping reads hold them until the last one settles. Past 1000 held frames, further frames are dropped rather than held. The hold lives in core's `SessionCapturerBase`, which all three extend, and it matters where the read runs alongside the typing (WebdriverIO). Selenium awaits its read before `sendKeys` reaches the driver. Python has no hold: its read runs synchronously before `sendKeysToElement` through the unpatched `execute`, and its capturer holds no frames. A read that fails or times out, or a field the adapter cannot locate to read (on Nightwatch, one located by a strategy other than CSS or XPath, or with no selector), counts as a password field: the typed value is redacted, since redacting a value that was not a password is the safer error, and the run logs one warning that names no value. Nightwatch's `setPassword` is taken as a password without a read. In Python a session whose read timed out reads no more, since the abandoned read is still on the session, and what it types afterwards is redacted the same way. A field that answers with no type at all (an element that is not a form control) is not a password field, except on a WebdriverIO Appium mobile-web session, whose direct read cannot tell that answer from a failed one and redacts. Native app sessions skip it on every adapter; on an Appium mobile-web session WebdriverIO reads straight from the driver rather than through `browser`, as its other in-hook probes do.

**`secrets` covers any other value**: an API token, a username, a session id, text typed into a field that is not a password field.

Expand Down Expand Up @@ -211,6 +211,8 @@ The dashboard runs in one of **three modes**, set per adapter via the shared `mo

To export telemetry, install [`@wdio/opentelemetry`](packages/otel/README.md) and push the manifests after the run, with `OTEL_EXPORTER_OTLP_ENDPOINT` set: `npx wdio-otel push test-results/devtools-artifacts-*.json`. Each test attempt becomes a span. Its attributes let you slice the spans by commit and branch, CI pipeline (detected on GitHub Actions and GitLab CI, or set in `OTEL_RESOURCE_ATTRIBUTES`), browser, spec and session.

The manifest is format version 2 (`manifestVersion: 2`). Artifact paths are relative to the manifest's directory, so the directory can move; a path on another Windows drive stays absolute. The attempt that decided a test carries `final: true`. There is no `cwd` field; a `specFile` under the run's working directory is stored relative to it, and one outside it stays as the adapter reported it, so it can still be absolute. Without a `TRACEPARENT`, every attempt of one test shares a trace id derived from `DEVTOOLS_RUN_ID` and the test's uid. Field-level reference: [packages/shared/src/artifacts-manifest.ts](packages/shared/src/artifacts-manifest.ts).

All three JavaScript adapters (`@wdio/devtools-service`, `@wdio/selenium-devtools`, `@wdio/nightwatch-devtools`) emit the **same normalized trace** through the shared `@wdio/devtools-core` capture library, so one archive format and one player serve every framework.

The Python adapter (`selenium-devtools-py`) writes the same archive through the backend, so the trace **format and the player are identical** across all four, but **capture completeness varies**: WebdriverIO is the most complete, and the others cover the core flow with the gaps the table below names. Each adapter's README lists its specifics.
Expand Down
Loading