// Actual Chrome, real ERP template/CSS/JS, synthetic assets and controlled APIs. const assert = require("node:assert/strict"); const fs = require("node:fs"); const http = require("node:http"); const path = require("node:path"); const { chromium } = require("playwright"); const ROOT = path.resolve(__dirname, "../.."), OUT = path.join(__dirname, ".out"), STATIC = path.join(ROOT, "app/static"); const parsed = JSON.parse( fs.readFileSync(path.join(OUT, "asset_report.json"), "utf8"), ); let conflict = false, slow = false, mutations = [], counter = 30; const timestamp = "2026-10-06T01:00:00+09:00"; const records = Array.from({ length: 30 }, (_, i) => ({ id: "asset" + i, tag: "AST-" + String(i + 1).padStart(6, "0"), name: i === 0 ? "KING-DESKTOP" : `테스트 자산 ${i}`, category: i % 3 === 0 ? "computer" : i % 3 === 1 ? "chair" : "mouse", status: "available", manufacturer: "", model: i === 0 ? parsed.summary.motherboard : "", serial: "", location: "본사 3층", department: "디자인팀", assignee_email: "", purchased_on: "2026-01-01", purchase_cost: "1250000", vendor: "", warranty_until: "2026-10-20", notes: "", latest_report_id: i === 0 ? "report1" : null, version: 1, created_at: timestamp, updated_at: timestamp, specs: i === 0 ? parsed.summary : null, })); const users = [ { email: "reader@test.local", name: "담당자" }, { email: "staff@test.local", name: "직원" }, ]; Object.assign(records[2], { name: "Registered Monitor", category: "monitor", model: "Test Display 24", serial: "synthetic-monitor-1", }); const photoRecords = new Map(), monitorLinks = new Map(); const photoPNG = Buffer.from( "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+jR1kAAAAASUVORK5CYII=", "base64", ); function monitorItems(a) { return [0, 1, 2].map((i) => ({ index: i, name: "Test Display " + (i + 1), model: "Test Display 24", serial: i < 2 ? "synthetic-monitor-" + (i + 1) : "", manufacturer: "Test", asset: records.find((r) => r.id === monitorLinks.get(a.id + ":" + i)) || (i === 0 ? records.find((r) => r.id === "asset2") : null), candidates: i === 2 ? [records.find((r) => r.id === "asset2")].filter(Boolean) : [], })); } const events = [ { id: 1, asset_id: "asset0", actor: "reader@test.local", kind: "create", note: "자산 등록", changes: {}, created_at: timestamp, }, ]; const reports = [ { id: "report1", asset_id: "asset0", filename: "KING-DESKTOP.XML", uploaded_at: timestamp, actor: "reader@test.local", summary: parsed.summary, scan_time: parsed.scan_time, }, ]; function json(res, value, code = 200) { res.writeHead(code, { "Content-Type": "application/json" }); res.end(JSON.stringify(value)); } function filter(p) { let rows = records.filter( (a) => !p.get("category") || a.category === p.get("category"), ); for (const key of ["status", "location"]) rows = rows.filter((a) => !p.get(key) || a[key] === p.get(key)); if (p.get("assignee")) rows = rows.filter((a) => a.assignee_email === p.get("assignee")); if (p.get("group")) rows = rows.filter( (a) => (p.get("group") === "furniture") === ["chair", "desk", "furniture"].includes(a.category), ); if (p.get("q")) rows = rows.filter((a) => (a.name + a.tag + a.notes).includes(p.get("q"))); return rows; } const server = http.createServer(async (req, res) => { const url = new URL(req.url, "http://localhost"); if (url.pathname === "/asset/") { res.setHeader("Content-Type", "text/html; charset=utf-8"); res.end( fs.readFileSync( path.join( OUT, url.searchParams.has("super") ? "asset_super.html" : url.searchParams.has("unconfigured") ? "asset_unconfigured.html" : "asset_render.html", ), ), ); return; } if (url.pathname.startsWith("/static/")) { const file = path.resolve( STATIC, "." + decodeURIComponent(url.pathname.slice(7)), ); if ( !file.startsWith(STATIC + path.sep) || !fs.existsSync(file) || !fs.statSync(file).isFile() ) { res.writeHead(404); res.end(); return; } const types = { ".css": "text/css", ".js": "text/javascript", ".woff2": "font/woff2", ".png": "image/png", }; res.setHeader( "Content-Type", types[path.extname(file)] || "application/octet-stream", ); fs.createReadStream(file).pipe(res); return; } const route = url.pathname.slice("/asset/api/".length), parts = route.split("/"); const chunks = []; for await (const chunk of req) chunks.push(chunk); const raw = Buffer.concat(chunks), body = req.headers["content-type"]?.includes("application/json") ? JSON.parse(raw.toString()) : null; if (req.method !== "GET") { assert.equal(req.headers["x-asset-csrf"], "browser-test"); mutations.push({ route, body }); } if (route === "bootstrap") { const totals = { total: records.length, available: 0, in_use: 0, maintenance: 0, lost: 0, retired: 0, warranty_soon: records.length, purchase_total: "37500000", }; records.forEach((a) => totals[a.status]++); json(res, { totals, users, locations: ["本社", "본사 3층"], categories: ["computer", "chair", "mouse"].map((category) => ({ category, count: records.filter((a) => a.category === category).length, })), activity: events .slice(-12) .reverse() .map((e) => ({ ...e, tag: "AST-000001", name: records.find((a) => a.id === e.asset_id)?.name || "Asset", })), }); return; } if (route === "assets" && req.method === "GET") { const rows = filter(url.searchParams), page = Number(url.searchParams.get("page") || 1), result = { items: rows.slice((page - 1) * 25, page * 25), total: rows.length, page, page_size: 25, }; if (slow && url.searchParams.get("q") === "테스트") { setTimeout(() => json(res, result), 500); return; } json(res, result); return; } if (route === "assets" && req.method === "POST") { const a = { ...records[1], ...body, id: "asset" + counter++, tag: body.tag || "AST-TEST", specs: null, latest_report_id: null, }; records.push(a); json(res, { id: a.id }); return; } if (route === "reports/preview") { if (raw.toString().includes("invalid.xml")) { json(res, { detail: "올바르지 않은 보고서입니다." }, 422); return; } json(res, { filename: "test.xml", summary: parsed.summary, property_count: parsed.property_count, scan_time: parsed.scan_time, warnings: [], }); return; } if (route === "reports/import") { const match = raw .toString() .match(/name="payload"\r\n\r\n([\s\S]*?)\r\n--/); assert.ok(match, "multipart import must carry the asset payload"); const data = JSON.parse(match[1]); const a = { ...records[0], ...data, id: "asset" + counter++, tag: "AST-IMPORT", }; records.push(a); json(res, { id: a.id }); return; } if (parts[0] === "assets" && parts[1]) { const a = records.find((a) => a.id === parts[1]); if (!a) { json(res, { detail: "없음" }, 404); return; } if (parts.length === 2 && req.method === "GET") { json(res, { asset: a, report: a.latest_report_id ? { ...reports[0], parsed } : null, reports: a.latest_report_id ? reports : [], events: events.filter((e) => e.asset_id === a.id), photos: photoRecords.get(a.id) || [], monitors: a.latest_report_id ? monitorItems(a) : [], }); return; } if (parts.length === 2 && req.method === "DELETE") { assert.equal(body.version, a.version); records.splice(records.indexOf(a), 1); json(res, { ok: true }); return; } if (parts[2] === "photos" && parts.length === 3 && req.method === "POST") { const match = raw.toString().match(/name="version"\r\n\r\n(\d+)/); assert.equal(Number(match[1]), a.version); const photos = photoRecords.get(a.id) || []; photos.push({ id: "photo" + photos.length, filename: "test.png" }); photoRecords.set(a.id, photos); a.version++; json(res, { id: photos.at(-1).id }); return; } if (parts[2] === "photos" && parts.length === 4) { res.setHeader("Content-Type", "image/png"); res.end(photoPNG); return; } if (parts[2] === "monitors" && req.method === "POST") { assert.equal(body.version, a.version); let target; if (body.asset) { target = { ...records[1], ...body.asset, id: "asset" + counter++, tag: "AST-MONITOR", version: 1, latest_report_id: null, specs: null, }; records.push(target); } else target = records.find((r) => r.id === body.asset_id); monitorLinks.set(a.id + ":" + parts[3], target.id); a.version++; json(res, { id: target.id }); return; } if (parts[2] === "reports" && parts[4] === "monitors") { json(res, { items: monitorItems(a) }); return; } if (parts.length === 2 && req.method === "PUT") { if (conflict) { conflict = false; json( res, { detail: "다른 사용자가 수정했습니다. 다시 확인하세요." }, 409, ); return; } assert.equal(body.version, a.version); Object.assign(a, body, { version: a.version + 1 }); json(res, { ok: true }); return; } if (parts[2] === "actions") { assert.equal(body.version, a.version); a.version++; a.status = { checkout: "in_use", checkin: "available", maintenance: "maintenance", available: "available", lost: "lost", retired: "retired", }[body.action]; a.assignee_email = body.action === "checkout" ? body.assignee_email : ""; events.push({ id: events.length + 1, asset_id: a.id, kind: body.action, note: body.note, actor: users[0].email, changes: {}, created_at: timestamp, }); json(res, { ok: true }); return; } if (parts[2] === "reports" && parts.length === 3) { a.latest_report_id = "report1"; a.specs = parsed.summary; a.version++; json(res, { id: "report1" }); return; } if (parts[2] === "reports" && parts.length === 4) { json(res, { ...reports[0], parsed }); return; } } res.writeHead(404); res.end(); }); (async () => { let browser; try { await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve)); browser = await chromium.launch({ headless: true, executablePath: process.env.PJ_TEST_BROWSER || "C:/Program Files/Google/Chrome/Application/chrome.exe", }); const page = await browser.newPage({ viewport: { width: 1600, height: 1050 }, }); const errors = []; page.on("pageerror", (e) => errors.push(e.message)); const origin = `http://127.0.0.1:${server.address().port}`; await page.goto(origin + "/asset/"); await page.locator("#am-total").filter({ hasText: "30" }).waitFor(); assert.equal(await page.locator("#am-rows tr").count(), 25); // 실제 브라우저의 애니메이션 시각을 고정해 중간 위치와 닫기 완료 시점을 확인합니다. await page.evaluate(() => { const drawer = document.querySelector("#am-detail"), animate = drawer.animate.bind(drawer); drawer.animate = (frames, options) => { const motion = animate(frames, options); motion.pause(); return motion; }; }); const finishDrawer = () => page.evaluate(async () => { const motion = document .querySelector("#am-detail") .getAnimations() .find((a) => a.id === "asset-drawer"); if (motion) { motion.finish(); await motion.finished; } }); const drawerPosition = (time) => page.evaluate((time) => { const drawer = document.querySelector("#am-detail"), motion = drawer .getAnimations() .find((a) => a.id === "asset-drawer"); if (time !== null) motion.currentTime = time; const rect = drawer.getBoundingClientRect(); return { left: rect.left, width: rect.width, viewport: innerWidth, open: drawer.open, closing: drawer.classList.contains("am-closing"), }; }, time); await page.locator('[data-open="asset0"]').first().click(); await page.waitForFunction( () => document.querySelector("#am-detail-title").textContent === "KING-DESKTOP", ); const entryStart = await drawerPosition(0), entryMiddle = await drawerPosition(140); assert.ok( Math.abs(entryStart.left - entryStart.viewport) < 2, "entry starts beyond the right screen edge", ); assert.ok( entryMiddle.left < entryStart.left && entryMiddle.left > entryStart.viewport - entryStart.width, "entry moves from right to left", ); await finishDrawer(); const atRest = await drawerPosition(null); assert.ok(Math.abs(atRest.left - (atRest.viewport - atRest.width)) < 2); await page.locator('[data-close="am-detail"]').click(); const exitStart = await drawerPosition(0), exitMiddle = await drawerPosition(110); assert.ok( exitStart.open && exitStart.closing, "X retains the drawer until animation completion", ); assert.ok(exitMiddle.left > exitStart.left, "exit moves back to the right"); await finishDrawer(); assert.equal( await page.locator("#am-detail").evaluate((el) => el.open), false, ); assert.equal(new URL(page.url()).searchParams.has("asset"), false); assert.equal( await page.evaluate(() => document.activeElement.dataset.open), "asset0", "focus returns to the selected asset", ); await page.locator('[data-open="asset0"]').first().click(); await finishDrawer(); const rect = await page.locator("#am-detail").boundingBox(); await page.mouse.move(rect.x + 100, 300); await page.mouse.down(); await page.mouse.move(10, 300); await page.mouse.up(); assert.equal( (await drawerPosition(null)).closing, false, "inside-to-outside drag must not dismiss", ); await page.mouse.click(10, 400); assert.equal( (await drawerPosition(80)).closing, true, "backdrop click starts animated dismissal", ); // 닫기 도중 다시 열면 취소한 닫기의 완료 콜백이 새 패널을 닫지 않습니다. const interrupted = await drawerPosition(null); await page.evaluate(() => document.querySelector('#am-rows [data-open="asset0"]').click(), ); assert.ok( Math.abs((await drawerPosition(0)).left - interrupted.left) < 2, "reopen continues from the current position", ); await finishDrawer(); await page.waitForFunction( () => document.querySelector("#am-detail-title").textContent === "KING-DESKTOP", ); assert.equal((await drawerPosition(null)).closing, false); await page.keyboard.press("Escape"); assert.equal( (await drawerPosition(110)).closing, true, "Escape uses the same exit animation", ); await finishDrawer(); // 닫힌 뒤 도착하는 응답이 패널을 다시 열거나 선택 URL을 복구하지 않습니다. await page.route("**/asset/api/assets/asset0", async (route) => { await new Promise((resolve) => setTimeout(resolve, 200)); await route.continue(); }); const delayedResponse = page.waitForResponse((response) => response.url().endsWith("/asset/api/assets/asset0"), ); await page.locator('[data-open="asset0"]').first().click(); await drawerPosition(100); await page.evaluate(() => document.querySelector('[data-close="am-detail"]').click(), ); await finishDrawer(); await delayedResponse; await page.evaluate( () => new Promise((resolve) => requestAnimationFrame(resolve)), ); assert.equal( await page.locator("#am-detail").evaluate((el) => el.open), false, ); assert.equal(new URL(page.url()).searchParams.has("asset"), false); await page.unroute("**/asset/api/assets/asset0"); await page.emulateMedia({ reducedMotion: "reduce" }); await page.locator('[data-open="asset0"]').first().click(); assert.equal( await page .locator("#am-detail") .evaluate((el) => el.getAnimations().length), 0, ); await page.locator('[data-close="am-detail"]').click(); assert.equal( await page.locator("#am-detail").evaluate((el) => el.open), false, ); await page.emulateMedia({ reducedMotion: "no-preference" }); await page.evaluate(() => { delete document.querySelector("#am-detail").animate; }); await page.screenshot({ path: path.join(OUT, "asset-desktop.png"), fullPage: true, }); await page.locator("#am-next").click(); await page.waitForFunction( () => document.querySelector("#am-page-number").textContent === "2 / 2", ); assert.equal(await page.locator("#am-rows tr").count(), 5); await page.locator('[data-view="furniture"]').click(); await page.waitForFunction( () => document.querySelector("#am-result-count").textContent === "10개 자산", ); assert.equal(await page.locator("#am-page-number").textContent(), "1 / 1"); await page.locator("#am-reset").click(); await page.waitForFunction( () => document.querySelector("#am-result-count").textContent === "30개 자산", ); slow = true; await page.locator("#am-query").fill("테스트"); await page.waitForTimeout(300); await page.locator("#am-query").fill("KING"); await page.waitForTimeout(800); assert.equal( await page.locator("#am-result-count").textContent(), "1개 자산", "late search response must not replace the newest result", ); await page.locator('[data-open="asset0"][data-tab="specs"]').click(); await page.locator("#am-spec-query").waitFor(); assert.equal( await page.locator("[data-delete]").count(), 0, "ordinary users must not see deletion", ); assert.equal(await page.locator(".am-monitor-card").count(), 3); await page.locator('[data-monitor-open="asset2"]').click(); await page .locator("#am-detail-title") .filter({ hasText: "Registered Monitor" }) .waitFor(); await page.locator("[data-return-computer]").click(); await page.locator("#am-spec-query").waitFor(); assert.ok( (await page.locator(".am-spec-card").first().textContent()).includes( parsed.summary.cpu, ), ); await page.locator("#am-spec-section").selectOption("MEMORY"); await page.locator("#am-detail").evaluate((el) => { el.scrollTop = 0; }); await page.screenshot({ path: path.join(OUT, "asset-specs.png") }); await page.locator("#am-spec-query").fill("M378A2K43EB1"); if (parsed.summary.computer_name === "KING-DESKTOP") assert.equal(await page.locator(".am-node").count(), 2); await page.locator('[data-detail-tab="overview"]').click(); await page.locator("[data-edit]").click(); await page .locator('#am-editor-form [name="notes"]') .fill("저장 전 초안 "); conflict = true; await page.locator('#am-editor-form [type="submit"]').click(); await page .locator("#am-editor-form .am-form-error") .filter({ hasText: "다른 사용자" }) .waitFor(); assert.ok( ( await page.locator('#am-editor-form [name="notes"]').inputValue() ).includes("초안"), ); await page.locator('#am-editor-form [type="submit"]').click(); await page.waitForFunction( () => !document.querySelector("#am-editor").open, ); await page.locator('[data-action="checkout"]').waitFor(); assert.equal(await page.evaluate(() => window.assetInjected), undefined); await page.locator('[data-action="checkout"]').click(); await page.locator("#am-action-user").selectOption("staff@test.local"); await page.locator("#am-action-save").click(); await page.waitForFunction( () => !document.querySelector("#am-action").open, ); await page.locator('[data-action="checkin"]').waitFor(); assert.equal( await page.locator('[data-action="retired"]').count(), 0, "assigned assets cannot be retired directly", ); await page.locator('[data-action="checkin"]').click(); await page.locator("#am-action-save").click(); await page.waitForFunction( () => !document.querySelector("#am-action").open, ); await page.locator('[data-action="checkout"]').waitFor(); await page.locator('[data-detail-tab="reports"]').click(); await page.locator("[data-report]").click(); await page.locator("#am-spec-query").waitFor(); assert.ok( (await page.locator("#am-detail-content").textContent()).includes( "선택한 보고서", ), ); await page.locator('[data-close="am-detail"]').click(); await page.locator("#am-import").click(); await page.locator("#am-report-file").setInputFiles({ name: "invalid.xml", mimeType: "text/xml", buffer: Buffer.from(""), }); await page .locator("#am-upload-form .am-form-error") .filter({ hasText: "올바르지" }) .waitFor(); assert.equal(await page.locator("#am-import-save").isDisabled(), true); await page .locator("#am-report-file") .setInputFiles(path.join(OUT, "asset_upload.xml")); await page.locator("#am-report-preview").waitFor({ state: "visible" }); assert.equal( await page.locator("#am-import-name").inputValue(), parsed.summary.computer_name, ); await page.screenshot({ path: path.join(OUT, "asset-import.png") }); await page.locator("#am-import-name").fill("Uploaded workstation"); await page.locator("#am-import-save").click(); await page.waitForFunction( () => !document.querySelector("#am-upload").open, ); await page .locator("#am-detail-title") .filter({ hasText: "Uploaded workstation" }) .waitFor(); await page.locator("#am-spec-query").waitFor(); await page.locator("[data-attach]").click(); await page .locator("#am-report-file") .setInputFiles(path.join(OUT, "asset_upload.xml")); await page.locator("#am-report-preview").waitFor({ state: "visible" }); assert.equal(await page.locator("#am-import-fields").isVisible(), false); await page.locator("#am-import-save").click(); await page.waitForFunction( () => !document.querySelector("#am-upload").open, ); await page .locator("#am-detail-title") .filter({ hasText: "Uploaded workstation" }) .waitFor(); await page.keyboard.press("Escape"); await page.locator("#am-create").click(); await page.locator('#am-editor-form [name="name"]').fill("테스트 의자"); await page .locator('#am-editor-form [name="category"]') .selectOption("chair"); await page.locator('#am-editor-form [type="submit"]').click(); await page.waitForFunction( () => !document.querySelector("#am-editor").open, ); await page .locator("#am-detail-title") .filter({ hasText: "테스트 의자" }) .waitFor(); assert.equal(await page.locator('[data-detail-tab="specs"]').count(), 0); await page.keyboard.press("Escape"); // 모니터 등록과 연결이 끝나면 같은 화면에서 자산 개요를 확인할 수 있습니다. await page.goto(origin + "/asset/?asset=asset0&tab=specs"); await page.locator('[data-monitor-create="1"]').waitFor(); await page.locator('[data-monitor-create="1"]').click(); assert.equal( await page.locator('#am-editor-form [name="category"]').inputValue(), "monitor", ); assert.equal( await page.locator('#am-editor-form [name="category"]').isDisabled(), true, ); await page.locator('#am-editor-form [name="name"]').fill("New Monitor"); await page.locator('#am-editor-form [type="submit"]').click(); await page.waitForFunction( () => !document.querySelector("#am-editor").open, ); await page .locator(".am-linked-overview h4") .filter({ hasText: "New Monitor" }) .waitFor(); assert.equal(await page.locator('[data-monitor-create="1"]').count(), 0); await page.locator('[data-monitor-link="2"]').click(); await page.waitForFunction( () => document.querySelectorAll(".am-linked-overview").length === 3, ); await page.screenshot({ path: path.join(OUT, "asset-monitor-links.png") }); await page.locator('[data-detail-tab="overview"]').click(); await page.locator("[data-photo]").click(); await page.locator("#am-photo-file").setInputFiles({ name: "test.png", mimeType: "image/png", buffer: photoPNG, }); await page.locator('#am-photo-form [type="submit"]').click(); await page.waitForFunction(() => !document.querySelector("#am-photo").open); await page.locator('.am-photo-grid img[alt="test.png"]').waitFor(); await page.waitForFunction( () => document.querySelector(".am-photo-grid img")?.naturalWidth > 0, ); await page.screenshot({ path: path.join(OUT, "asset-photos.png") }); await page.keyboard.press("Escape"); await page.setViewportSize({ width: 390, height: 844 }); await page.locator("#am-reset").click(); await page.waitForTimeout(100); assert.ok( await page.evaluate( () => document.documentElement.scrollWidth <= innerWidth + 1, ), "mobile document should not overflow horizontally", ); await page.screenshot({ path: path.join(OUT, "asset-mobile.png"), fullPage: true, }); await page.locator('[data-open="asset0"]').first().click(); await page .locator("#am-detail-title") .filter({ hasText: "KING-DESKTOP" }) .waitFor(); assert.ok( await page.evaluate( () => document.querySelector("#am-detail").scrollWidth <= innerWidth + 1, ), ); await page.locator('.am-tabs [data-detail-tab="specs"]').click(); await page.locator("#am-spec-query").waitFor(); await page.locator("#am-spec-section").selectOption("MEMORY"); await page.screenshot({ path: path.join(OUT, "asset-mobile-specs.png") }); await page.keyboard.press("Escape"); await page.goto(origin + "/asset/?category=chair&q=테스트"); await page.waitForFunction( () => document.querySelector("#am-result-count").textContent === "11개 자산", ); assert.equal(await page.locator("#am-category").inputValue(), "chair"); await page.goto(origin + "/asset/?unconfigured=1"); assert.equal(await page.locator("#am-create").isDisabled(), true); await page.locator("#am-import").click(); await page .locator("#am-report-file") .setInputFiles(path.join(OUT, "asset_upload.xml")); await page.locator("#am-report-preview").waitFor({ state: "visible" }); assert.equal(await page.locator("#am-import-save").isDisabled(), true); // 수퍼 관리자는 자산번호·사유 확인 후 삭제하고, 취소와 잘못된 입력은 요청하지 않습니다. await page.goto(origin + "/asset/?super=1&asset=asset5"); await page.locator("[data-delete]").waitFor(); await page.locator("[data-delete]").click(); await page.locator("#am-delete-confirm").fill("WRONG"); await page.locator("#am-delete-note").fill("Duplicate test asset"); await page.locator('#am-delete-form [type="submit"]').click(); await page .locator("#am-delete-form .am-form-error") .filter({ hasText: "자산번호" }) .waitFor(); const before = records.length; await page.locator("#am-delete-confirm").fill("AST-000006"); await page.locator('#am-delete-form [type="submit"]').click(); await page.waitForFunction( () => !document.querySelector("#am-detail").open, ); assert.equal(records.length, before - 1); assert.equal( records.some((a) => a.id === "asset5"), false, ); await page.waitForFunction( (n) => document.querySelector("#am-total").textContent === String(n), records.length, ); assert.deepEqual(errors, []); console.log( "ALL PASS: Chrome desktop/mobile, drawer entry/exit/backdrop/X/Escape, interrupt/reopen, late responses, reduced motion, search races, paging, specs, XSS escaping, conflict draft, create, checkout/checkin, reports, setup mode, photos, monitor registration/link/overview, super-admin deletion", ); } finally { await browser?.close(); await new Promise((resolve) => server.close(resolve)); } })().catch((error) => { console.error(error); process.exitCode = 1; });