In react testing library, we have two functions called toBeInTheDocument()
and toBeVisible()
.
1 expect(screen.getByText('hello')).toBeInTheDocument();
2 expect(screen.getByText('hello')).toBeVisible();
It seems both assertions behave the same. What is their difference, and what are the use cases for each?