// 관리 화면의 모든 탭이 오류 없이 열리는지 확인 (브라우저 필요: npm i playwright-core, Chrome 설치) // node tests/e2e/admin-tabs.mjs http://127.0.0.1:8000 <교수자 비밀번호> import { chromium } from "playwright-core"; const B = process.argv[2] || "http://127.0.0.1:8000", PW = process.argv[3] || "ownerpass"; const browser = await chromium.launch({ channel: "chrome", headless: true }); const p = await (await browser.newContext({ viewport: { width: 1440, height: 900 } })).newPage(); const errs = []; p.on("pageerror", e => errs.push(e.message)); await p.goto(B + "/login?next=/admin", { waitUntil: "networkidle" }); await p.fill("[name=username]", "professor"); await p.fill("[name=password]", PW); await p.click("button[type=submit]"); await p.waitForTimeout(1500); const tabs = await p.$$eval("#tabs a", (as) => as.map((a) => a.getAttribute("href"))); const extra = ["#members/list", "#members/codes", "#members/classes", "#members/stats", "#term/t_20cb03023b", "#questions/t_20cb03023b"]; let bad = 0; for (const h of [...tabs, ...extra]) { await p.evaluate((x) => (location.hash = x), h); await p.waitForTimeout(900); const t = await p.locator("#view").innerText(); const fail = /불러오지 못했습니다|Can't find|is not defined|undefined/.test(t); if (fail) bad++; console.log((fail ? "FAIL " : "PASS ") + h + (fail ? " → " + t.slice(0, 120) : "")); } console.log(errs.join("\n") || "no JS errors", "| 실패", bad); await browser.close();