Repository navigation
fix(nightwatch-devtools): give captured command rows a stable id for replaceCommand - #470
hoanle0126 wants to merge 1 commit into
Conversation
[Medium impact] The changes affect command-row updates and screenshots in Nightwatch captures. Fix public ID reuse across Nightwatch reruns before merging. Findings
SummaryAdds public IDs to captured Nightwatch commands, preserves them across retries, and drops screenshots for superseded rows.
Reviews (1) · Last reviewed commit: "fix(nightwatch-devtools): give captured ..." · Reviewed by Greptile |
| const commandId = this.commandCounter++ | ||
| const commandLogEntry: CommandLog & { _id?: number } = { | ||
| _id: commandId, | ||
| id: commandId, |
There was a problem hiding this comment.
Reruns overwrite earlier commands
id: commandId repeats when the UI starts a Nightwatch rerun in a new process. The backend keeps earlier commands, but the new capturer starts its counter at zero. When the rerun sends a screenshot or retry update, replaceCommandIndex picks the first earlier command with that id, even when its timestamp differs. This overwrites the earlier command and leaves the new command unchanged.
Give public IDs a unique range across capturers, or limit replacement matching to the originating capturer.
|
Thanks for this! I had been working on #458 locally too, and I've raised the fix as #473. Your diagnosis and the core of the fix match what I ended up with: a public #473 goes one step further on the concern Greptile raised here, which turned out to be real. When a test is rerun from the dashboard, the backend keeps the parent run's rows (so Preserve & Rerun still has data), and Nightwatch I'll close this one in favour of #473. Thanks again, it made the bug quick to pin down. |
|
Closing as fixed by #473, which is now merged. Thanks again for pinning this down, @hoanle0126! |
What & why
Fixes #458.
In
@wdio/nightwatch-devtools,SessionCapturer.captureCommandstamped only the internal_idfield (whichsendCommandandsendReplaceCommandstrip before sending upstream) and left the publicidfield undefined. When a command likegetTextcompleted in the same millisecond as a followingnode:assertrow,getText's asynchronous screenshot update (sendReplaceCommand(ts, entry)) fell back tolastIndexOf(oldTimestamp)in@wdio/devtools-shared'sreplaceCommandIndexand overwrote thenode:assertrow instead of updatinggetTextin place.id: commandIdon rows inSessionCapturer.captureCommand(matchingcaptureAssertCommandand@wdio/selenium-devtools) and preserve the superseded row'sidacrossSessionCapturer.replaceCommand.BrowserProxy.attachScreenshotwiththis.sessionCapturer.commandsLog.includes(entry)so an in-flight screenshot from a retried attempt does not overwrite a replacement row.Type of change
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)Capability matrix
packages/conformance/src/features.tsupdated, and tables regenerated withpnpm docs:capabilities, if this adds or changes user-facing behaviour