--- /dev/null
+import { chromium } from "playwright";
+
+const BASE = process.env.BASE || "http://127.0.0.1:37821/t/stationbuilder/";
+
+const run = async (label) => {
+ const browser = await chromium.launch();
+ const ctx = await browser.newContext(); // fresh = incognito-equivalent
+ const page = await ctx.newPage();
+ const t0 = Date.now();
+ let domReady = 0, loadingGone = 0;
+ page.on("domcontentloaded", () => { domReady = Date.now() - t0; });
+ try {
+ await page.goto(BASE, { waitUntil: "commit", timeout: 60000 });
+ // wait until the loading empty-state disappears (content resolves)
+ await page.waitForFunction(() => {
+ const els = Array.from(document.querySelectorAll(".empty-state"));
+ const txt = els.map(e => e.textContent || "").join("");
+ return !/加载中/.test(txt);
+ }, { timeout: 90000 });
+ loadingGone = Date.now() - t0;
+ } catch (e) {
+ console.log(`[${label}] FAIL: ${e.message} (domReady=${domReady}ms, loadingGone=${loadingGone}ms)`);
+ await browser.close();
+ return;
+ }
+ console.log(`[${label}] domContentLoaded=${domReady}ms, loadingResolved=${loadingGone}ms`);
+ await browser.close();
+};
+
+console.log("=== run 1 (cold) ===");
+await run("cold");
+console.log("=== run 2 (warm, same dev server) ===");
+await run("warm");
+const PUB = process.env.PUB || "https://aidemo.istation.cloud/t/stationbuilder/";
+console.log(`=== run 3 (public nginx: ${PUB}) ===`);
+await run("public");
+process.exit(0);