Repository navigation
fix(selenium-devtools): quiet teardown screenshots and keep the mobile demo open in live mode - #447
Merged
Merged
Conversation
…r quits Row screenshots and command captures run unawaited, so the last commands' captures were still in flight when quit stopped the session under them, and on Appium each one logged a [screenshot] Failed warning.
mocha --exit force-exits when the tests end, past the timer that keeps the process alive until the dashboard is closed.
Contributor
[Medium impact] The PR appears safe to merge; no actionable issues were found. SummaryThe PR waits for background command captures and row screenshots before Selenium quits, with a shared five-second limit.
No actionable issues were found. Tests were inspected, not run. DiagramsequenceDiagram
participant Test
participant Plugin
participant Capturer
participant Driver
Test->>Plugin: Command completes
Plugin->>Capturer: Track command capture
Capturer->>Driver: Take row screenshot
Test->>Plugin: Quit requested
Plugin->>Capturer: settleBeforeQuit()
Note over Capturer: Wait for tracked work, up to five seconds
Capturer->>Capturer: Mark driver as ending
Plugin->>Driver: Drain remaining page data
Plugin->>Driver: Quit session
Reviews (1) · Last reviewed commit: "fix(examples): keep the Selenium mobile ..." · Reviewed by Greptile |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Two problems found while checking the Selenium adapter against Appium on an Android emulator.
Screenshot warnings at quit. Each command row's screenshot is taken in the background, and the driver patcher does not await a command's capture. The last commands' screenshots were therefore still in flight when
driver.quit()stopped the session under them, and on Appium each one logged a warning:Now:
SessionCapturertracks each command's capture and its row screenshot, dropping each one as it settles.onDriverEndwaits for that work, including any screenshot a settling capture queues, under core's 5 sPENDING_SETTLE_TIMEOUT_MS.The Selenium mobile demo closed before you could use the dashboard.
example:mobilepassed mocha--exit, which force-exits when the tests end, past the timer that keeps the process alive until the dashboard is closed. Dropped; the desktop Selenium examples already run without it.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)Notes for reviewers
coreonly exports what it already had:settlePendingandPENDING_SETTLE_TIMEOUT_MSfromtrace-finalizer.ts, so the adapter reuses the same bounded wait and ceiling rather than a second copy. Its test now imports the constant instead of mirroring it.snapshotCaptureslist. That list lasts the whole run and is what per-test slices wait on, so putting row screenshots in it would make one test's late screenshot hold up the next test's slice, and one stuck capture would add 5 s to every later quit.pnpm test: 2822 passed.pnpm lint: 0 errors.pnpm typecheckandpnpm buildclean. The new tests inselenium-devtools/tests/teardown-settle.test.tsfail without the change.DEVTOOLS_MODE=live pnpm demo:selenium:mobilekeeps the dashboard open until it is closed,pnpm demo:selenium:mobile(trace mode) exits on its own, and neither logs a[screenshot] Failedline.Screenshots / recordings
n/a (no UI change)
🤖 Generated with Claude Code