Files
QuantEngineByItz/login-test.mjs
T
kjh2064 b580633eac fix: improve login flow with extended wait time
- Update login.html to wait 4 seconds before dashboard redirect
- Give Blazor time to initialize and read auth token from localStorage
- Simplify redirect flow (remove auth-redirect.html)
- Fix token storage in localStorage for auth state

Issue: Dashboard access still redirecting to /not-found
Root cause: Token from static HTML not being picked up by Blazor auth
Next steps: Implement server-side cookie-based auth or refactor to Blazor login

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

45 lines
1.3 KiB
JavaScript

import { chromium } from '@playwright/test';
(async () => {
const browser = await chromium.launch();
const page = await browser.newPage();
try {
await page.goto('http://localhost:5265/login');
await page.fill('input[name="username"]', 'admin');
await page.fill('input[name="password"]', 'admin');
await page.click('button[type="submit"]');
console.log('✓ Login form submitted');
console.log('✓ Waiting 3 seconds for dashboard redirect...');
await page.waitForNavigation({ waitUntil: 'load', timeout: 10000 });
const url = page.url();
const content = await page.content();
console.log(`✓ Navigation complete`);
console.log(` URL: ${url}`);
if (url.includes('/dashboard')) {
if (content.includes('Not Found')) {
console.log('✗ Dashboard URL but Not Found error');
} else if (content.includes('관리자 대시보드')) {
console.log('✓✓✓ SUCCESS: Dashboard fully loaded!');
} else {
console.log('✓ Dashboard page loaded (content check)');
}
} else {
console.log('⚠ Not on dashboard URL');
}
await page.screenshot({ path: './login-final-screenshot.png' });
} catch (e) {
console.error('Test error:', e.message.substring(0, 70));
}
await browser.close();
})();