Files
Community_Nursing_Atlas/tests/e2e/admin-tabs.mjs
T
jsahn 4e943700fc feat: add common utilities and feedback handling scripts
- Introduced common.js for shared functions including API calls, error reporting, and UI helpers.
- Implemented feedback.js for the feedback reporting page, including form handling and displaying feedback status.
- Added layout.js for managing galaxy and section layouts in the visualization.
- Created login.js for user authentication with session management.
- Developed search.js for term searching based on user input and synonyms.
- Implemented signup.js for user registration with validation and immediate login.
2026-10-06 23:14:45 +09:00

22 lines
1.5 KiB
JavaScript

// 관리 화면의 모든 탭이 오류 없이 열리는지 확인 (브라우저 필요: 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();