推进 INI 面板 launch entry
This commit is contained in:
48
wasm-port/tests/browser/ini_panel_launch_smoke.html
Normal file
48
wasm-port/tests/browser/ini_panel_launch_smoke.html
Normal file
@@ -0,0 +1,48 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>LinuxCNC INI Launch Smoke</title>
|
||||
</head>
|
||||
<body>
|
||||
<pre id="status">running</pre>
|
||||
<script type="module">
|
||||
function assertEqual(actual, expected, label) {
|
||||
if (actual !== expected) {
|
||||
throw new Error(`${label}: expected ${expected}, got ${actual}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function loadLaunchFrame() {
|
||||
const frame = document.createElement("iframe");
|
||||
frame.src = "../../runtime/ui/ini-panel/launch.html";
|
||||
document.body.appendChild(frame);
|
||||
await new Promise((resolve, reject) => {
|
||||
frame.addEventListener("load", resolve, { once: true });
|
||||
frame.addEventListener("error", reject, { once: true });
|
||||
});
|
||||
return frame.contentDocument;
|
||||
}
|
||||
|
||||
try {
|
||||
const launchDoc = await loadLaunchFrame();
|
||||
assertEqual(
|
||||
launchDoc.querySelector('a[href="./index.html"]').textContent,
|
||||
"Open edit and run panel",
|
||||
"launch panel edit link",
|
||||
);
|
||||
assertEqual(
|
||||
launchDoc.querySelector('a[href="./control-page.html"]').textContent,
|
||||
"Open read-only control view",
|
||||
"launch panel control link",
|
||||
);
|
||||
status.textContent = "browser_ini_launch_smoke=ok";
|
||||
console.log("browser_ini_launch_smoke=ok");
|
||||
} catch (error) {
|
||||
status.textContent = `browser_ini_launch_smoke=failed: ${error.message}`;
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@@ -62,8 +62,10 @@ fi
|
||||
PORT="$(cat "$PORT_FILE")"
|
||||
URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_smoke.html"
|
||||
CONTROL_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_control_page_smoke.html"
|
||||
LAUNCH_URL="http://127.0.0.1:$PORT/tests/browser/ini_panel_launch_smoke.html"
|
||||
OUT="$TMP_DIR/chromium.out"
|
||||
CONTROL_OUT="$TMP_DIR/chromium-control.out"
|
||||
LAUNCH_OUT="$TMP_DIR/chromium-launch.out"
|
||||
|
||||
"$CHROMIUM" \
|
||||
--headless=new \
|
||||
@@ -98,3 +100,20 @@ if ! grep -Fq "browser_ini_control_page_smoke=ok" "$CONTROL_OUT"; then
|
||||
fi
|
||||
|
||||
echo "browser_ini_control_page_smoke=ok"
|
||||
|
||||
"$CHROMIUM" \
|
||||
--headless=new \
|
||||
--disable-gpu \
|
||||
--no-sandbox \
|
||||
--user-data-dir="$CHROME_PROFILE" \
|
||||
--virtual-time-budget=10000 \
|
||||
--dump-dom \
|
||||
"$LAUNCH_URL" >"$LAUNCH_OUT" 2>&1
|
||||
|
||||
if ! grep -Fq "browser_ini_launch_smoke=ok" "$LAUNCH_OUT"; then
|
||||
echo "browser INI launch smoke failed" >&2
|
||||
sed -n '1,220p' "$LAUNCH_OUT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "browser_ini_launch_smoke=ok"
|
||||
|
||||
Reference in New Issue
Block a user