Reputation: 1
I am writing test cases using react testing library with jest. i want to check dropdown list of another Multiselect to be present when i select from first dropdown.
import user from '@testing-library/user-event'
TypeError: Cannot read property 'tagName' of null
101 | const { getByText, container } = render(<Product />)
102 | const actionDiv = container.querySelector('#option-0')
> 103 | user.click(actionDiv)
| ^
104 | await act(async () => {
105 | await waitFor(() => expect(getByText(/10.or/i)).toBeInTheDocument())
106 | })
Upvotes: 0
Views: 1812
Reputation: 129
You should avoid to use container
to query elements like it said here.
Use queries like you did in your expect
function.
You have alot of those to help you here.
Upvotes: -1