React Testing Library isn't automatically cleaning up after itself, so multiple elements with the same properties are found in the DOM, causing tests to fail.
To fix: Add this to each test file (including this in setup.js file doesn't seem to work):
import { render, cleanup } from '@testing-library/react';
beforeEach(cleanup);
React Testing Library isn't automatically cleaning up after itself, so multiple elements with the same properties are found in the DOM, causing tests to fail.
To fix: Add this to each test file (including this in
setup.js
file doesn't seem to work):