// Wait for loading to complete expect(screen.getByText(/loading/i)).toBeInTheDocument()
expect(handleSubmit).toHaveBeenCalledWith({ email: 'test@example.com', password: 'password123' }) }) import { renderHook, act } from '@testing-library/react' test('useCounter hook increments', () => { const { result } = renderHook(() => useCounter(0)) react testing library
act(() => { result.current.increment() }) // Wait for loading to complete expect(screen
// Verify dashboard expect(await screen.findByText(/welcome, user/i)).toBeInTheDocument() useCounter(0)) act(() =>
// Submit await userEvent.click(screen.getByRole('button', { name: /submit/i }))
// Wait for data to appear const userName = await screen.findByText(/John Doe/i) expect(userName).toBeInTheDocument() })
// Navigate to profile await userEvent.click(screen.getByRole('link', { name: /profile/i })) expect(screen.getByText(/user profile/i)).toBeInTheDocument()