import { test } from 'magnitude-test'; test('Login page renders correctly', async (agent) => { await agent.act('Navigate to /login'); await agent.check('The text "Log in to Ponderants" is visible on the screen'); await agent.check('A text input field labeled "Your Handle" is visible'); await agent.check('A button labeled "Log in with Bluesky" is visible'); }); test('[Unhappy Path] Login page shows error message from query param', async (agent) => { await agent.act('Navigate to /login?error=Invalid%20handle%20or%20PDS'); await agent.check('The text "Login Failed: Invalid handle or PDS" is visible on the screen'); }); test('[Happy Path] Entering handle starts OAuth flow', async (agent) => { await agent.act('Navigate to /login'); await agent.act('Type "testuser.bsky.social" into the "Your Handle" input field'); await agent.act('Click the "Log in with Bluesky" button'); // The user will be redirected to /api/auth/login which will then redirect to the OAuth provider // We can't test the full OAuth flow in magnitude without mocking, but we can verify // that the form submission triggers navigation await agent.check('The page has navigated away from /login'); });