mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 00:03:15 +00:00
test(browser): freeze recovery clock during artificial attach gate
This commit is contained in:
+1
-1
@@ -56,7 +56,7 @@ describe('BrowserPane webview preferences', () => {
|
||||
'persist:orca-browser-session-profile-1'
|
||||
)
|
||||
expect(ensuredWebview?.webview.getAttribute('webpreferences')).toBe(
|
||||
ORCA_BROWSER_GUEST_WEB_PREFERENCES_ATTRIBUTE
|
||||
`${ORCA_BROWSER_GUEST_WEB_PREFERENCES_ATTRIBUTE},transparent=false`
|
||||
)
|
||||
expect(registryMocks.registerPersistentWebview).toHaveBeenCalledWith(
|
||||
'browser-page-1',
|
||||
|
||||
@@ -44,6 +44,8 @@ export async function observeBrowserLoadingSurface(
|
||||
await new Promise<void>((resolve) => server.listen(0, '127.0.0.1', resolve))
|
||||
const url = `http://127.0.0.1:${(server.address() as AddressInfo).port}/held`
|
||||
const observations: Record<string, unknown>[] = []
|
||||
// Freezing attachment for a screenshot must also freeze the missing-guest watchdog.
|
||||
await page.clock.pauseAt(new Date())
|
||||
const attachGate = await page.evaluateHandle((heldUrl) => {
|
||||
const original = Element.prototype.setAttribute
|
||||
const pending: (() => void)[] = []
|
||||
@@ -138,6 +140,7 @@ export async function observeBrowserLoadingSurface(
|
||||
await page.mouse.move(0, 0)
|
||||
await capture('pre-attach', 'theme')
|
||||
await attachGate.evaluate((release) => release())
|
||||
await page.clock.resume()
|
||||
await expect.poll(() => requestCount).toBe(1)
|
||||
await capture('dark-held', 'theme', true)
|
||||
await page.evaluate(async () => {
|
||||
@@ -280,6 +283,7 @@ export async function observeBrowserLoadingSurface(
|
||||
return observations
|
||||
} finally {
|
||||
await attachGate.evaluate((release) => release()).catch(() => {})
|
||||
await page.clock.resume().catch(() => {})
|
||||
await attachGate.dispose()
|
||||
release?.()
|
||||
server.closeAllConnections()
|
||||
|
||||
Reference in New Issue
Block a user