Skip to content

Commit 1215126

Browse files
committed
test(cypress): defer ResizeObserver callbacks to next frame
-e Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
1 parent d56ad83 commit 1215126

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

cypress/support/e2e.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,16 @@ import 'core-js/actual/promise/with-resolvers.js'
1313
// @see https://github.com/cypress-io/cypress/issues/20341
1414
Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop limit exceeded'))
1515
Cypress.on('uncaught:exception', (err) => !err.message.includes('ResizeObserver loop completed with undelivered notifications'))
16+
17+
// Defer ResizeObserver callbacks one frame to break floating UI sync loops
18+
// that otherwise tank the renderer and trigger Electron's unresponsive kill.
19+
Cypress.on('window:before:load', (win) => {
20+
const Original = win.ResizeObserver
21+
win.ResizeObserver = class extends Original {
22+
constructor(callback: ResizeObserverCallback) {
23+
super((entries, observer) => {
24+
win.requestAnimationFrame(() => callback(entries, observer))
25+
})
26+
}
27+
}
28+
})

0 commit comments

Comments
 (0)