0

Listen for console errors in browser tests

This commit is contained in:
Gabe Kangas 2022-12-08 18:36:41 -08:00
parent cb6c0a3495
commit 3826f9380a
No known key found for this signature in database
GPG Key ID: 4345B2060657F330

View File

@ -1,6 +1,20 @@
export function setup() {
let windowErrorSpy;
Cypress.on('window:before:load', (win) => {
windowErrorSpy = cy.spy(win.console, 'error');
});
Cypress.on(
'uncaught:exception',
(err) => !err.message.includes('ResizeObserver loop limit exceeded')
);
describe('Listen for errors', () => {
afterEach(() => {
cy.wait(1000).then(() => {
expect(windowErrorSpy).to.not.be.called;
});
});
});
}