53ae2fcc51
Root cause: [Authorize] attribute was blocking /dashboard access before Blazor auth state could be established, causing redirect to /not-found. Solution: - Remove [Authorize] from Dashboard.razor - Add authentication check in OnInitializedAsync - If not authenticated, redirect to login internally - Reduced wait time from 6s to 3s in login.html This allows: 1. /dashboard to load immediately 2. Blazor auth state to initialize 3. Dashboard to verify user is authenticated 4. Redirect to login if not authenticated Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
59 lines
1.8 KiB
JavaScript
59 lines
1.8 KiB
JavaScript
import { chromium } from "@playwright/test";
|
|
|
|
(async () => {
|
|
console.log("=== TEST WITH CACHE BYPASS ===\n");
|
|
|
|
const b = await chromium.launch({ headless: false });
|
|
const ctx = await b.createIncognitoBrowserContext(); // Private mode = no cache
|
|
const p = await ctx.newPage();
|
|
|
|
p.on("console", msg => {
|
|
if (msg.text().includes("[Login]")) {
|
|
console.log(` ✓ ${msg.text()}`);
|
|
}
|
|
});
|
|
|
|
try {
|
|
// 캐시 무시하고 로드
|
|
console.log("1. Loading login page (no cache)...");
|
|
await p.goto("http://localhost:5265/login.html?nocache=" + Date.now(), {
|
|
waitUntil: "networkidle"
|
|
});
|
|
console.log(" ✓ Loaded\n");
|
|
|
|
console.log("2. Submitting login...");
|
|
await p.fill("input[name='username']", "admin");
|
|
await p.fill("input[name='password']", "admin");
|
|
await p.click("button[type='submit']");
|
|
console.log(" ✓ Submitted\n");
|
|
|
|
console.log("3. Waiting 8 seconds...");
|
|
for (let i = 1; i <= 8; i++) {
|
|
await new Promise(r => setTimeout(r, 1000));
|
|
const url = p.url();
|
|
process.stdout.write(` [${i}s] ${url}\r`);
|
|
}
|
|
|
|
console.log("\n\n4. FINAL CHECK:");
|
|
const finalUrl = p.url();
|
|
if (finalUrl.includes("/dashboard")) {
|
|
console.log(" ✓✓✓ SUCCESS: Dashboard loaded!");
|
|
const content = await p.content();
|
|
if (content.includes("관리자 대시보드")) {
|
|
console.log(" ✓ Dashboard content confirmed!");
|
|
}
|
|
} else if (finalUrl.includes("/not-found")) {
|
|
console.log(" ✗ /not-found (auth failed)");
|
|
} else {
|
|
console.log(" URL: " + finalUrl);
|
|
}
|
|
|
|
await p.screenshot({ path: "./final-test-no-cache.png", fullPage: true });
|
|
|
|
} catch (e) {
|
|
console.error("Error:", e.message);
|
|
} finally {
|
|
await b.close();
|
|
}
|
|
})();
|