mirror of
https://github.com/stablyai/orca.git
synced 2026-09-30 08:03:12 +00:00
test: trace hidden-window throttle changes during dialog cleanup
This commit is contained in:
@@ -4,6 +4,11 @@ export async function enableHiddenElectronCompositor(app: ElectronApplication):
|
||||
await app.evaluate(({ BrowserWindow }) => {
|
||||
if (process.env.ORCA_E2E_HEADLESS === '1' && process.env.ORCA_E2E_HEADFUL !== '1') {
|
||||
for (const window of BrowserWindow.getAllWindows()) {
|
||||
const original = window.webContents.setBackgroundThrottling.bind(window.webContents)
|
||||
window.webContents.setBackgroundThrottling = (allowed) => {
|
||||
console.info('[hidden-throttle-change] ' + JSON.stringify({ allowed, stack: new Error().stack }))
|
||||
original(allowed)
|
||||
}
|
||||
window.webContents.setBackgroundThrottling(false)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,18 @@ export async function closeOpenDialogs(page: Page): Promise<void> {
|
||||
}
|
||||
const cancel = dialog.getByRole('button', { name: 'Cancel', exact: true })
|
||||
await ((await cancel.isVisible()) ? cancel.click() : page.keyboard.press('Escape'))
|
||||
await expect(dialog).toBeHidden({ timeout: 3_000 })
|
||||
try {
|
||||
await expect(dialog).toBeHidden({ timeout: 3_000 })
|
||||
} catch (error) {
|
||||
console.info('[dialog-exit-diagnostic] ' + JSON.stringify(await dialog.evaluate((element) => ({
|
||||
state: element.getAttribute('data-state'),
|
||||
visibility: document.visibilityState,
|
||||
animations: element.getAnimations().map((animation) => ({
|
||||
playState: animation.playState, currentTime: animation.currentTime, pending: animation.pending
|
||||
}))
|
||||
}))))
|
||||
throw error
|
||||
}
|
||||
}
|
||||
await expect(page.getByRole('dialog')).toHaveCount(0, { timeout: 3_000 })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user