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 of the above two assertions behave in the same way. What is different of these two functions and whats are the use cases of them?