Repository navigation
feat(elector): Browser browser do more work in the plugin side - #2
Merged
Merged
Conversation
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.
I did made changes how to register context inside of the Browser library.
What and why
Browser now registers an adopted context itself (MarketSquare/robotframework-browser#5372,
ADR 0010 there): when
adoptContextresolves, Node reports the context on the stream of theextension call, and
call_js_keywordopens the keyword trace groups and embeds the video in thelog, as
New Contextdoes.register_adopted_contextwas removed before it was ever released.Browser also gives an adopted context the library timeout itself (#5370), and
adoptContext(context, { activePage })makes the given page active and reports its video.Start Electron Applicationadapts to that:electron.jspasses the first window's own page asactivePage, so Browser makes the window,not a WebContentsView or
<webview>that Playwright saw first, the active page, and embedsthe window's video.
_activate_window_page, which switched pages afterwards, androbotframeworkElectronIsWindowPageare removed;isWindowPagestill servesfirstWindowPage.electron.jsno longer sets the default timeout and no longer reads the video path; itreturns what
adoptContextreturns.Start Electron Applicationno longer callsregister_adopted_context; it returns the pageid and video path that Browser reported.
One behaviour changes: when the first window closes during the start, there is no page to pass
as
activePage, so Browser keeps the page Playwright saw first, and the returned video is thatpage's, not the closed window's.
The tests follow: the call order no longer contains
setDefaultTimeout, the window-first testchecks the
activePagepassed toadoptContext, and the tests of the removed page switching arereplaced by one that the keyword returns what Browser reported. AGENTS.md describes the new
Browser API.
Depends on
This needs MarketSquare/robotframework-browser#5372, which CI checks out. Until they are merged, CI fails here.
Tested
Against a local Browser with both changes (the clone at
../robotframework-browser):uv run pytest: 171 passed.uv run pre-commit run --all-files: all hooks pass (ruff, mypy, RobotCode analysis).uv run robotcode -r . -p local roboton macOS (no Xvfb): 151 of 154 passed, 1 skipped(
No Window On Linux).Browser Keywords Act On The First Window With Viewscovers thewindow passed as
activePage, and the Tracing and Video suites cover the registration byBrowser. Two failures are not from this change:
Arguments And Environmentcompares/var/...with macOS's/private/var/..., andInstalled From The VSIXneeded the.vsixbuilt first (after
uv build --package robotframework-vscodeits suite passes).AI / tooling disclosure
This contribution was prepared with assistance from Claude Code (Claude Opus 5.5). I reviewed the
result manually, understand the changes, verified them locally, and confirm that I have the
right to submit this contribution under the project license.