From 1215126fb611524a89cd67c932ec7c2957632ccd Mon Sep 17 00:00:00 2001 From: Peter Ringelmann Date: Wed, 6 May 2026 17:06:13 +0200 Subject: [PATCH] test(cypress): defer ResizeObserver callbacks to next frame -e Signed-off-by: Peter Ringelmann --- cypress/support/e2e.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cypress/support/e2e.ts b/cypress/support/e2e.ts index 29845edc4f695..30c1f008550e1 100644 --- a/cypress/support/e2e.ts +++ b/cypress/support/e2e.ts @@ -13,3 +13,16 @@ import 'core-js/actual/promise/with-resolvers.js' // @see https://github.com/cypress-io/cypress/issues/20341 Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop limit exceeded')) Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop completed with undelivered notifications')) + +// Defer ResizeObserver callbacks one frame to break floating UI sync loops +// that otherwise tank the renderer and trigger Electron's unresponsive kill. +Cypress.on('window:before:load', (win) => { + const Original = win.ResizeObserver + win.ResizeObserver = class extends Original { + constructor(callback: ResizeObserverCallback) { + super((entries, observer) => { + win.requestAnimationFrame(() => callback(entries, observer)) + }) + } + } +})