Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch DOM errors before merging PRs #3524

Open
lorenzo-cavazzi opened this issue Feb 4, 2025 · 0 comments
Open

Catch DOM errors before merging PRs #3524

lorenzo-cavazzi opened this issue Feb 4, 2025 · 0 comments
Labels

Comments

@lorenzo-cavazzi
Copy link
Member

We show DOM errors in the console while developing, but we don't enforce any test to fail on those occurrences.
Since we have already merged PRs with DOM errors in our codebase (E.G. clickable elements like anchors rendered inside other clickable elements), we should find a way to prevent that.

The most straightforward approach will be re-using tests to render elements (i.e. the Cypress tests) to catch those occurrences.
There are libraries that do that (E.G. https://www.npmjs.com/package/cypress-fail-on-console-error). If those work, it should require only minimal setup.
Otherwise, we might need to catch the console errors manually (E.G: Cypress.on('window:before:load', (win) => { cy.spy(win.console, 'error').as('consoleError'); }); ) and fail the test (cy.get('@consoleError').should('not.have.been.called');).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant