Skip to content

feat(elector): Browser browser do more work in the plugin side - #2

Open
aaltat wants to merge 1 commit into
robotcodedev:mainfrom
aaltat:browser_lib_changes_reflection
Open

aaltat wants to merge 1 commit into
robotcodedev:mainfrom
aaltat:browser_lib_changes_reflection

Conversation

@aaltat

@aaltat aaltat commented Oct 21, 2026 •

Copy link
Copy Markdown

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 adoptContext resolves, Node reports the context on the stream of the
extension call, and call_js_keyword opens the keyword trace groups and embeds the video in the
log, as New Context does. register_adopted_context was 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 Application adapts to that:

  • electron.js passes the first window's own page as activePage, so Browser makes the window,
    not a WebContentsView or <webview> that Playwright saw first, the active page, and embeds
    the window's video. _activate_window_page, which switched pages afterwards, and
    robotframeworkElectronIsWindowPage are removed; isWindowPage still serves
    firstWindowPage.
  • electron.js no longer sets the default timeout and no longer reads the video path; it
    returns what adoptContext returns.
  • Start Electron Application no longer calls register_adopted_context; it returns the page
    id 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 that
page's, not the closed window's.

The tests follow: the call order no longer contains setDefaultTimeout, the window-first test
checks the activePage passed to adoptContext, and the tests of the removed page switching are
replaced 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 robot on macOS (no Xvfb): 151 of 154 passed, 1 skipped
    (No Window On Linux). Browser Keywords Act On The First Window With Views covers the
    window passed as activePage, and the Tracing and Video suites cover the registration by
    Browser. Two failures are not from this change: Arguments And Environment compares
    /var/... with macOS's /private/var/..., and Installed From The VSIX needed the .vsix
    built first (after uv build --package robotframework-vscode its 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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant