Open
Description
Possibly also the reason for this issue:
findByRole doesn't find the role
@testing-library/dom
version: 9.3.2
- Testing Framework and version:
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "^14.1.0",
"@types/jest": "^29.5.8",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
Relevant code or config:
test('FacetSize callback', async () => {
render(<div data-test-id="123">Test</div>);
const testTestId = screen.getByTestId('123');
await waitFor(() => expect(testTestId).toBeInTheDocument());
});
What you did:
Ran test according to above
What happened:
Getting this error:
TestingLibraryElementError: Unable to find an element by: [data-testid="123"]
Ignored nodes: comments, script, style
<body>
<div>
<div
data-test-id="123"
>
Test
</div>
</div>
</body>
Problem description:
Test fails when running with @testing-library/dom version higher than 9.3.1
Exact same code works with version 9.3.1 and below.
Suggested solution:
Metadata
Metadata
Assignees
Labels
No labels