React Testing Library May 2026

// Navigate to profile await userEvent.click(screen.getByRole('link', { name: /profile/i })) expect(screen.getByText(/user profile/i)).toBeInTheDocument()

// Find elements const button = screen.getByRole('button', { name: /increment/i }) const count = screen.getByText(/count: 0/i)

// Wait for data to appear const userName = await screen.findByText(/John Doe/i) expect(userName).toBeInTheDocument() })