Skip to content

Commit 21f8bfe

Browse files
committed
chore(cy): defer resize observer callbacks
Cypress is currently complaining: > ResizeObserver loop completed with undelivered notifications. Taken from: nextcloud/server#60189 Signed-off-by: Max <max@nextcloud.com>
1 parent c9134bb commit 21f8bfe

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

‎cypress/support/e2e.js‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,17 @@ Cypress.on('window:before:load', (win) => {
2525
before(() => {
2626
chai.use(chaiExtension)
2727
})
28+
29+
// Defer ResizeObserver callbacks one frame to break floating UI sync loops
30+
// that otherwise tank the renderer and trigger Electron's unresponsive kill.
31+
// Taken from: https://github.com/nextcloud/server/pull/60189
32+
Cypress.on('window:before:load', (win) => {
33+
const Original = win.ResizeObserver
34+
win.ResizeObserver = class extends Original {
35+
constructor(callback) {
36+
super((entries, observer) => {
37+
win.requestAnimationFrame(() => callback(entries, observer))
38+
})
39+
}
40+
}
41+
})

0 commit comments

Comments
 (0)