You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TestingLibraryElementError: Unable to find role="heading" and name `XYZ`
Ignored nodes: comments, script, style
<body>
<div>
<div
style="padding: .5rem; max-width: 100%;"
>
<div
style="display: flex; align-items: center; gap: .5rem;"
>
<strong
style="font-size: 1rem;"
>
Something went wrong!
</strong>
<button
style="appearance: none; font-size: .6em; border: 1px solid currentcolor; padding: .1rem .2rem; font-weight: bold; border-radius: .25rem;"
>
Hide Error
</button>
</div>
<div
style="height: .25rem;"
/>
<div>
<pre
style="font-size: .7em; border: 1px solid red; border-radius: .25rem; padding: .3rem; color: red; overflow: auto;"
>
<code>
Invariant failed: Could not find an active match from "/patients/$patientId"
</code>
</pre>
</div>
</div>
</div>
</body>
import{describe,it,expect}from"vitest";import{renderWithContext}from"src/utils/test-utils.tsx";import{waitFor,screen}from"@testing-library/react";import{PatientDetail}from"./PatientDetail";describe("Test",()=>{it("renders the main page title",async()=>{constComponent=()=><PatientDetail/>;
renderWithContext(Component);awaitwaitFor(()=>expect(screen.getByRole("heading",{level: 1,name: /XYZ/i,})).toBeInTheDocument());});});
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm having this kind of test. gives me this error. How it's possible it didn't found match when I'm defining it ?
if fails on this code inside component:
That uses this utils:
Beta Was this translation helpful? Give feedback.
All reactions