test(remote): cover browser focus modes

This commit is contained in:
Jinwoo-H
2026-08-12 04:38:03 -04:00
parent 366d4ec01a
commit 3df3d1041d
2 changed files with 44 additions and 12 deletions
+28 -1
View File
@@ -1478,6 +1478,33 @@
"result": "passed",
"durationSeconds": 7.6,
"summary": "Final candidate d5767481b982b736e7cc5b4653b2a32a61280638 on merge-base 36d45af062ec4022265aabac8fc6a9d36eecedf1 passed the byte-identical 5806b23f oracle after final review and rebase: one host page, one client workspace, requested split, rendered DOM, stable focus, and browser-only close."
},
{
"date": "2026-08-12",
"runner": "local",
"platform": "macos",
"command": "ORCA_E2E_WEB_CLIENT=1 ORCA_E2E_FORCE_HEADFUL=1 pnpm exec playwright test tests/e2e/paired-remote-html-browser-focus.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1",
"result": "failed",
"durationSeconds": 11.8,
"summary": "Latest-main 346e59c879 failed the byte-identical 2ec1dcf1 oracle with two client HTML browser workspaces instead of one."
},
{
"date": "2026-08-12",
"runner": "local",
"platform": "macos",
"command": "ORCA_E2E_WEB_CLIENT=1 ORCA_E2E_FORCE_HEADFUL=1 pnpm exec playwright test tests/e2e/paired-remote-html-browser-focus.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1",
"result": "passed",
"durationSeconds": 8.4,
"summary": "Candidate d05217c40d passed the byte-identical 2ec1dcf1 oracle: one host page, one client workspace, stable split, rendered DOM, editor focus after creation, explicit-click browser focus, and browser-only close."
},
{
"date": "2026-08-12",
"runner": "local",
"platform": "macos",
"command": "ORCA_E2E_WEB_CLIENT=1 ORCA_E2E_FORCE_HEADFUL=1 pnpm exec playwright test tests/e2e/paired-remote-html-browser-focus.spec.ts --config tests/playwright.config.ts --project electron-headless --workers=1",
"result": "failed",
"durationSeconds": 12.3,
"summary": "Candidate d05217c40d with only the side-preview focusOnCreate:false call disabled failed the byte-identical 2ec1dcf1 oracle because preview creation activated the browser instead of preserving editor focus."
}
],
"runtimeBudget": {
@@ -1490,7 +1517,7 @@
},
"redGreenEvidence": {
"status": "complete",
"evidence": "The byte-identical 5806b23f Electron oracle is red on affected main a90a18d43da333e1cc327779a3f9912a78308848, green on final candidate d5767481b982b736e7cc5b4653b2a32a61280638 rebased onto 36d45af062ec4022265aabac8fc6a9d36eecedf1, and red when the candidate's side-preview owning-runtime routing seam is disabled. Affected main collapsed the preview into the editor group; the disabled candidate created two client browser workspaces."
"evidence": "The byte-identical 2ec1dcf1 Electron oracle is red on latest main 346e59c879, green on candidate d05217c40d, and red when only the candidate's side-preview focusOnCreate:false call is disabled. Latest main created two client browser workspaces; the disabled candidate focused the browser before an explicit click. Historical 5806b23f evidence separately proves the owning-runtime routing seam."
},
"performanceBudget": {
"required": true,
@@ -308,6 +308,10 @@ describe('createWebRuntimeSessionBrowserTab', () => {
it('applies an empty host snapshot without retaining delayed browser focus', async () => {
const snapshot = makeSnapshot()
let resolveList!: (response: unknown) => void
const listResponse = new Promise((resolve) => {
resolveList = resolve
})
const runtimeCall = vi
.fn()
.mockResolvedValueOnce({
@@ -315,11 +319,7 @@ describe('createWebRuntimeSessionBrowserTab', () => {
ok: true,
result: { browserPageId: 'remote-browser-page-1' }
})
.mockResolvedValueOnce({
id: 'list',
ok: true,
result: snapshot
})
.mockReturnValueOnce(listResponse)
vi.stubGlobal('window', {
api: {
@@ -329,14 +329,19 @@ describe('createWebRuntimeSessionBrowserTab', () => {
}
})
await expect(
createWebRuntimeSessionBrowserTab({
worktreeId: WORKTREE_ID,
url: 'https://example.com/'
})
).resolves.toBe(true)
const pendingCreate = createWebRuntimeSessionBrowserTab({
worktreeId: WORKTREE_ID,
url: 'https://example.com/'
})
await vi.waitFor(() => expect(runtimeCall).toHaveBeenCalledTimes(2))
expect(mocks.subscribe).toHaveBeenCalledOnce()
expect(peekWebSessionFocusIntent({ environmentId: ENVIRONMENT_ID }, WORKTREE_ID)).toEqual({
hostTabId: 'remote-browser-page-1',
expectedCurrentLocalTabId: 'local-editor-tab'
})
resolveList({ id: 'list', ok: true, result: snapshot })
await expect(pendingCreate).resolves.toBe(true)
await vi.waitFor(() => expect(mocks.applyFreshWebSessionTabsSnapshot).toHaveBeenCalledTimes(1))
expect(runtimeCall).toHaveBeenNthCalledWith(1, {