test(jetbrains): stop frontend tests opening a real browser - #13432
Merged
Conversation
ProvidersSettingsUiTest drove the real OAuth UI with a fixture URL of https://auth.openai.com/device, and ProvidersSettingsUi calls BrowserUtil.browse unstubbed. BrowserUtil is a static facade over the BrowserLauncher application service, so every run of the frontend suite launched an actual Chrome tab on the developer's machine. Replace BrowserLauncher with a recording fake via replaceService instead of adding a production seam, and assert the recorded URL so the browser handoff is verified rather than performed. Install the same fake in the GitHub/PR tests that reach other direct BrowserUtil call sites.
Contributor
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Files Reviewed (5 files)
Reviewed by grok-4.6 · Input: 225.4K · Output: 13.5K · Cached: 575.1K Review guidance: REVIEW.md from base branch |
johnnyeric
approved these changes
Aug 25, 2026
This was referenced Aug 25, 2026
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.
Issue
No existing issue. Found while diagnosing a recurring "Your session has ended" ChatGPT page that kept appearing on a developer machine; the cause turned out to be our own test suite.
Context
Running the JetBrains frontend test suite opens a real browser tab on the developer's machine.
ProvidersSettingsUiTestseeds a fixture OAuth URL ofhttps://auth.openai.com/deviceand then drives the real production UI.ProvidersSettingsUi.oauth()callsBrowserUtil.browse(ready.url), andBrowserUtilis only a static facade over theBrowserLauncherapplication service — nothing was stubbing it. So the test genuinely handed the URL to the default browser.Confirmed from the macOS unified log: on every occurrence a short-lived
javaprocess callsLaunchServices.launchViaCSUAand Chrome receives aGURLApple Event withtarget=GradleWorkerMain(the Gradle test worker), matching Chrome history visits toauth.openai.com/devicewith anAUTO_TOPLEVELtransition. Because the browser profile is not signed in to ChatGPT, OpenAI serves its logged-out "Your session has ended" page — which is what made this look like a broken Kilo auth flow rather than a test leak.Beyond the interruption, this is a correctness gap: the test asserted the URL rendered in the panel field but never asserted that the browser was actually asked to open it.
Implementation
Fixed entirely on the test side — no production change.
BrowserUtil.browseresolvesBrowserLauncherthroughApplicationManager.getApplication().getService(...), so a test can replace that service. This is preferable to threading a newbrowselambda throughProvidersSettingsUi:packages/kilo-jetbrains/AGENTS.mdexplicitly forbids adding production seams whose only purpose is test access, andreplaceService+testRootDisposableis already the established pattern in this test tree.FakeBrowserLauncher, a recordingBrowserLauncherimplementation, plus aninstallBrowser()extension onBasePlatformTestCasethat installs it for the lifetime of the test.ProvidersSettingsUiTestnow installs the fake for the device-auth test and asserts the recorded URL, turning a silent real side effect into a real assertion.AgentManagerPanelTest,GhBannerTest, andGhStatusCoordinatorTest, which reach other unguardedBrowserUtilcall sites (PR URLs, git-scm / cli.github.com links), so future click assertions there cannot escape to a browser either.Note that ~10 direct
BrowserUtilcall sites remain in the frontend (SessionUi,WorktreeStatsView,PrHeaderView,ModelDetailsPanel, and others). Their current tests do not trigger a browse, so they are left alone rather than churned;installBrowser()is the one-line guard to add if that changes.Screenshots / Video
N/A — test-only change, no user-visible UI difference.
How to Test
Manual/local verification
Executed by the agent, from
packages/kilo-jetbrains/:./gradlew :frontend:test --tests 'ai.kilocode.client.settings.providers.ProvidersSettingsUiTest'— passes, and the new assertion proves the browse call is intercepted../gradlew :frontend:testfor all four touched classes (ProvidersSettingsUiTest,AgentManagerPanelTest,GhBannerTest,GhStatusCoordinatorTest) — passes../gradlew typecheck— passes./usr/bin/log show --last 2m --info --debug --style compact | grep -E 'target=GradleWorkerMain|launchViaCSUA'returned nothing, where it previously logged aGURLevent to Chrome on every run.Reviewer test steps
packages/kilo-jetbrains/, run./gradlew :frontend:test --tests 'ai.kilocode.client.settings.providers.ProvidersSettingsUiTest'.auth.openai.com/device(showing OpenAI's logged-out page unless you are signed in)./usr/bin/log show --last 2m --info --debug --style compact | grep target=GradleWorkerMain. Notelogis shadowed by a zsh function in some shells, so use the absolute path.Blocked checks and substitute verification
./gradlew testsuite was not run; verification was scoped to./gradlew typecheckplus the four affected test classes, since the change only touches those test files and a new test-only helper.Checklist
Get in Touch
@kirillk