Skip to content

Commit a77f47e

Browse files
authored
Merge pull request #247 from webdriverio/vv/trace-mode-parity
Vv/trace mode parity
2 parents 16316d2 + acce14d commit a77f47e

229 files changed

Lines changed: 21586 additions & 2373 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.changeset/trace-mode-parity.md‎

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
"@wdio/devtools-service": minor
3+
"@wdio/selenium-devtools": minor
4+
"@wdio/nightwatch-devtools": minor
5+
"@wdio/devtools-backend": minor
6+
"@wdio/devtools-app": minor
7+
"@wdio/devtools-script": minor
8+
---
9+
10+
Trace mode: a portable `trace.zip` artifact and first-party `show-trace` player, at parity across WebdriverIO, Selenium, and Nightwatch.
11+
12+
- **Trace mode** (`mode: 'trace'`) writes a portable artifact under `test-results/` with no dashboard window — `traceFormat` (`zip` | `ndjson-directory`), `traceGranularity` (`session` | `spec` | `test`), and retry-aware `tracePolicy` retention.
13+
- **Trace player** (`show-trace`): DOM time-travel replayed from the mutation stream, an A11y tab and pick-locator element overlay, a Transcript tab with Copy-for-LLM, Errors/Console/Network/Source panels, and a scrubbable filmstrip timeline.
14+
- **Per-test artifacts**: `screenshot` and `video` at `traceGranularity: 'test'`, a dense `filmstrip` into the trace, an `emitArtifactsManifest` index for CI, and inline Allure attachment (WebdriverIO + Selenium).
15+
- **Assertion capture** (`captureAssertions`, on by default): `node:assert` and framework matchers render as trace action rows.
16+
17+
The trace format and player are identical across all three adapters; capture completeness varies per adapter (see the cross-framework support docs).

‎.gitignore‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,22 @@ packages/nightwatch-devtools/nightwatch-video-*.webm
3939
trace-*.zip
4040
examples/**/trace-*/
4141

42+
# test results
43+
examples/**/test-results*/
44+
4245
# vitest --coverage output
4346
coverage/
4447

4548
# pnpm state, cache, logs, and debug files
4649
/packages/**/*.mjs
50+
51+
.claude
52+
53+
# Local Allure exploration / trace-parity comparison (throwaway — not committed)
54+
examples/**/allure-results*/
55+
examples/**/allure-report*/
56+
packages/**/allure-results*/
57+
packages/**/allure-report*/
58+
examples/playwright-allure/
59+
examples/wdio/cucumber/wdio.allure.conf.ts
60+

‎ARCHITECTURE.md‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,17 @@ Contains: DOM mutation observers, page-side trace collection, a small logger. It
140140

141141
The execution environment is the browser, not Node, so this package cannot import from `core` (Node-only) or from non-browser-safe parts of `shared`.
142142

143+
### `packages/elements`
144+
145+
Element-detection scripts (`@wdio/elements`). Produces the per-action data that feeds the snapshot pipeline: `getSnapshot`, the depth-indented accessibility-tree serializer, and the interactable-element list, plus locator generation.
146+
147+
Consumed by `core` (the element-snapshot builder) and by the adapters' per-action capture (`captureActionSnapshot`). The DOM-walking scripts run in the page via `browser.execute`, so — like `script` — they avoid Node-only APIs.
148+
143149
### `examples/`
144150

145151
Per-framework demo projects used for manual verification.
146152

147-
- `examples/wdio/` — WebdriverIO with Mocha (default). Run via `pnpm demo:wdio`.
153+
- `examples/wdio/` — WebdriverIO, split into `cucumber/` and `mocha/` (shared page objects in `pageobjects/`). Run via `pnpm demo:wdio` (Cucumber) or `pnpm demo:wdio:mocha`.
148154
- `examples/nightwatch/` — Nightwatch (both vanilla and Cucumber). Run via `pnpm demo:nightwatch`.
149155
- `examples/selenium/` — Selenium with subdirs for `mocha-test/`, `jest-test/`, `cucumber-test/`, `jasmine-test/`, `vitest-test/`. `pnpm demo:selenium` runs mocha; `pnpm --filter @wdio/selenium-devtools example:<runner>` runs the others.
150156

@@ -227,7 +233,7 @@ The architecture above is the actual state of the repo. Where it diverges from t
227233
Notable in-place pieces worth knowing about:
228234

229235
- `replaceCommand` has two semantics across adapters — Selenium mutates the existing entry in place (preserves `_id`/`id` continuity for chained calls); Nightwatch splices and reissues with a new `_id`. Both call the same `core/suite-helpers` factories; the storage strategy stays adapter-specific because the runner integrations differ.
230-
- `patchNodeAssert` is wired only in `selenium-devtools` (Selenium's primary assertion style is `node:assert`). The shared helper lives in `core/assert-patcher`; Service and Nightwatch can opt in via a one-line call when they need to, but it's not auto-enabled because both communities lean on chai/expect.
236+
- `patchNodeAssert` (via `core/assert-patcher`) is wired in all three adapters, default-on behind each adapter's `captureAssertions` option (opt out with `captureAssertions: false`), so `node:assert` — and, where the framework exposes assertion hooks, `expect` matchers — surface as trace action rows. Framework matcher libraries differ (Service taps expect-webdriverio's hooks; Nightwatch native `assert`/`verify` and Selenium's `node:assert` surface via their reconcile/patch paths), so the remaining gap is Selenium's jest-style `expect()`.
231237
- BiDi is auto-attached in Service and Selenium. Nightwatch is opt-in via `bidi: true` and requires `webSocketUrl: true` in capabilities — historically Nightwatch users haven't all enabled BiDi by default.
232238
- Performance API capture (`CAPTURE_PERFORMANCE_SCRIPT`) is identical across all three adapters; each wires it into its own afterCommand-equivalent path.
233239
- Output directory for screencast videos and trace files is resolved through `core/resolveAdapterOutputDir` — adapters feed `userConfiguredDir` (WDIO honors `wdio.conf.ts`'s `outputDir`/`rootDir`), `testFilePath` (Selenium/Nightwatch), and `configPath` (Nightwatch), and the helper picks the first writable, non-`node_modules/` candidate.

0 commit comments

Comments
 (0)