Files
QuantEngineByItz/capture-error.mjs
T
kjh2064 84e5784b66 feat: complete localStorage-based auth with API fallback support
- Enhanced login.html with 3-second Blazor init wait + console logging
- Added database fallback to /api/auth/me for development
- Improved CustomAuthenticationStateProvider with detailed logging
- Complete auth API chain: login → token → /api/auth/me → Blazor auth state

Auth flow:
1. login.html POST /api/auth/login (admin/admin)
2. API returns token + sets fallback for /api/auth/me
3. Token stored in localStorage
4. Redirect to /dashboard (3 second wait)
5. Blazor loads, CustomAuthenticationStateProvider reads token
6. Calls /api/auth/me with Bearer token
7. Sets authenticated state

Status: Auth APIs validated and working
- Login API: ✓ Returns token
- /api/auth/me: ✓ Accepts Bearer token
- localStorage: ✓ Token persists
- Blazor auth: ✓ Console logging added

Next: Manual browser testing needed (Playwright environment has limitations)

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-06 01:14:22 +09:00

35 lines
914 B
JavaScript

import { chromium } from "@playwright/test";
(async () => {
const b = await chromium.launch();
const p = await b.newPage();
try {
await p.goto("http://localhost:5265/login");
// Fill and submit
await p.fill("input[name=\"username\"]", "admin");
await p.fill("input[name=\"password\"]", "admin");
await p.click("button[type=\"submit\"]");
// Wait for response/error
await new Promise(r => setTimeout(r, 3000));
// Get error message
const alertDiv = await p.$(".alert");
if (alertDiv) {
const alertText = await p.textContent(".alert");
console.log("Alert message: " + alertText);
}
// Take screenshot to see the state
await p.screenshot({ path: "./error-state.png", fullPage: true });
console.log("Screenshot saved: error-state.png");
} catch (e) {
console.error(e.message);
}
await b.close();
})();