新增发布 artifact URL browser gate
This commit is contained in:
@@ -338,7 +338,7 @@ TOOL_TABLE = browser-shell-tool.tbl
|
||||
"L4-PYTHON-REMAP",
|
||||
],
|
||||
promotedBlockedFamilies: [],
|
||||
gates: Array.from({ length: 9 }, (_, index) => ({ id: `gate-${index}`, passed: true })),
|
||||
gates: Array.from({ length: 10 }, (_, index) => ({ id: `gate-${index}`, passed: true })),
|
||||
rows: [
|
||||
{
|
||||
id: "project-release-gate",
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
"L4-PYTHON-REMAP",
|
||||
],
|
||||
promotedBlockedFamilies: [],
|
||||
gates: Array.from({ length: 9 }, (_, index) => ({ id: `gate-${index}`, passed: true })),
|
||||
gates: Array.from({ length: 10 }, (_, index) => ({ id: `gate-${index}`, passed: true })),
|
||||
rows: [
|
||||
{
|
||||
id: "project-release-gate",
|
||||
@@ -161,7 +161,7 @@
|
||||
"workflow overview release artifact validation API name",
|
||||
);
|
||||
assertEqual(releaseArtifactValidation.ready, true, "workflow overview release artifact validation readiness");
|
||||
assertEqual(releaseArtifactValidation.gateCount, 9, "workflow overview release artifact validation gates");
|
||||
assertEqual(releaseArtifactValidation.gateCount, 10, "workflow overview release artifact validation gates");
|
||||
assertEqual(releaseArtifactDisplay.statusText, "Ready", "workflow overview release artifact display status");
|
||||
assertEqual(releaseArtifactRenderState.statusLine, "Ready: No blocking reasons", "workflow overview release artifact render status");
|
||||
assertEqual(
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>LinuxCNC Release Artifact URL Workflow 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 loadWorkflowOverviewFrame() {
|
||||
const frame = document.createElement("iframe");
|
||||
frame.src = "../../runtime/ui/ini-panel/workflow-overview.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 workflowDoc = await loadWorkflowOverviewFrame();
|
||||
const workflowApi = workflowDoc.defaultView.linuxCncIniPanelWorkflowOverviewApi;
|
||||
if (!workflowApi?.loadWorkflowOverviewReleaseReadinessArtifactUrl) {
|
||||
throw new Error("workflow overview API did not expose release artifact URL workflow");
|
||||
}
|
||||
|
||||
const missingUrl = await workflowApi.loadWorkflowOverviewReleaseReadinessArtifactUrl();
|
||||
assertEqual(missingUrl.ready, false, "missing URL workflow readiness");
|
||||
assertEqual(missingUrl.statusLine, "Blocked: artifact-url", "missing URL status");
|
||||
|
||||
const missingDom = await workflowApi.loadWorkflowOverviewReleaseReadinessArtifactUrl({
|
||||
artifactUrl: "../../tests/fixtures/project-release-readiness-ready.json",
|
||||
mount: true,
|
||||
});
|
||||
assertEqual(missingDom.ready, false, "missing DOM workflow readiness");
|
||||
assertEqual(missingDom.validation.ready, true, "missing DOM validation readiness");
|
||||
assertEqual(missingDom.missing.join(","), "mount,status,rows", "missing DOM reasons");
|
||||
|
||||
const releaseArtifactNode = workflowDoc.createElement("section");
|
||||
releaseArtifactNode.dataset.workflowOverviewReleaseReadinessArtifact = "";
|
||||
const releaseArtifactStatus = workflowDoc.createElement("p");
|
||||
releaseArtifactStatus.dataset.workflowOverviewReleaseReadinessArtifactStatus = "";
|
||||
const releaseArtifactRows = workflowDoc.createElement("dl");
|
||||
releaseArtifactRows.dataset.workflowOverviewReleaseReadinessArtifactRows = "";
|
||||
releaseArtifactNode.append(releaseArtifactStatus, releaseArtifactRows);
|
||||
workflowDoc.body.append(releaseArtifactNode);
|
||||
|
||||
const readyWorkflow = await workflowApi.loadWorkflowOverviewReleaseReadinessArtifactUrl({
|
||||
artifactUrl: "../../tests/fixtures/project-release-readiness-ready.json",
|
||||
mount: true,
|
||||
});
|
||||
assertEqual(
|
||||
readyWorkflow.apiName,
|
||||
"ini-panel-shell-workflow-overview-release-readiness-artifact-url-workflow",
|
||||
"ready workflow API name",
|
||||
);
|
||||
assertEqual(readyWorkflow.ready, true, "ready workflow readiness");
|
||||
assertEqual(readyWorkflow.httpStatus, 200, "ready workflow HTTP status");
|
||||
assertEqual(readyWorkflow.validation.gateCount, 10, "ready workflow gate count");
|
||||
assertEqual(readyWorkflow.renderState.statusLine, "Ready: No blocking reasons", "ready workflow status");
|
||||
assertEqual(readyWorkflow.mountResult.ready, true, "ready workflow mount readiness");
|
||||
assertEqual(readyWorkflow.mountResult.renderResult.rowCount, 3, "ready workflow mount rows");
|
||||
assertEqual(
|
||||
releaseArtifactStatus.textContent,
|
||||
"Ready: No blocking reasons",
|
||||
"ready workflow rendered status",
|
||||
);
|
||||
|
||||
document.getElementById("status").textContent = "browser_release_artifact_url_workflow_smoke=ok";
|
||||
console.log("browser_release_artifact_url_workflow_smoke=ok");
|
||||
} catch (error) {
|
||||
document.getElementById("status").textContent =
|
||||
`browser_release_artifact_url_workflow_smoke=failed: ${error.message}`;
|
||||
console.error(error);
|
||||
throw error;
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
81
wasm-port/tests/browser/verify_release_artifact_url_workflow_browser.sh
Executable file
81
wasm-port/tests/browser/verify_release_artifact_url_workflow_browser.sh
Executable file
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "$0")/../.." && pwd)"
|
||||
CHROMIUM="${CHROMIUM:-$(command -v chromium || command -v chromium-browser || command -v google-chrome || command -v google-chrome-stable || true)}"
|
||||
|
||||
if [[ -z "$CHROMIUM" ]]; then
|
||||
echo "missing Chromium-compatible browser; set CHROMIUM=/path/to/browser" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "${SKIP_INI_BUILD:-0}" != "1" ]]; then
|
||||
"$ROOT_DIR/tools/build_ini_panel.sh"
|
||||
fi
|
||||
if [[ "${SKIP_INTERP_BUILD:-0}" != "1" ]]; then
|
||||
"$ROOT_DIR/tools/build_wasm_core.sh"
|
||||
fi
|
||||
|
||||
TMP_DIR="$(mktemp -d)"
|
||||
PORT_FILE="$TMP_DIR/port"
|
||||
SERVER_LOG="$TMP_DIR/server.log"
|
||||
CHROME_PROFILE="$TMP_DIR/chrome-profile"
|
||||
mkdir -p "$CHROME_PROFILE"
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "${SERVER_PID:-}" ]]; then
|
||||
kill "$SERVER_PID" 2>/dev/null || true
|
||||
wait "$SERVER_PID" 2>/dev/null || true
|
||||
fi
|
||||
rm -rf "$TMP_DIR"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
python3 - <<'PY' "$ROOT_DIR" "$PORT_FILE" >"$SERVER_LOG" 2>&1 &
|
||||
import functools
|
||||
import http.server
|
||||
import pathlib
|
||||
import socketserver
|
||||
import sys
|
||||
|
||||
root = pathlib.Path(sys.argv[1])
|
||||
port_file = pathlib.Path(sys.argv[2])
|
||||
|
||||
handler = functools.partial(http.server.SimpleHTTPRequestHandler, directory=str(root))
|
||||
with socketserver.TCPServer(("127.0.0.1", 0), handler) as httpd:
|
||||
port_file.write_text(str(httpd.server_address[1]), encoding="ascii")
|
||||
httpd.serve_forever()
|
||||
PY
|
||||
SERVER_PID=$!
|
||||
|
||||
for _ in $(seq 1 100); do
|
||||
[[ -s "$PORT_FILE" ]] && break
|
||||
sleep 0.05
|
||||
done
|
||||
|
||||
if [[ ! -s "$PORT_FILE" ]]; then
|
||||
echo "release artifact URL workflow browser smoke HTTP server did not start" >&2
|
||||
cat "$SERVER_LOG" >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
PORT="$(cat "$PORT_FILE")"
|
||||
URL="http://127.0.0.1:$PORT/tests/browser/release_artifact_url_workflow_smoke.html"
|
||||
OUT="$TMP_DIR/chromium.out"
|
||||
|
||||
"$CHROMIUM" \
|
||||
--headless=new \
|
||||
--disable-gpu \
|
||||
--no-sandbox \
|
||||
--user-data-dir="$CHROME_PROFILE" \
|
||||
--virtual-time-budget=10000 \
|
||||
--dump-dom \
|
||||
"$URL" >"$OUT" 2>&1
|
||||
|
||||
if ! grep -Fq "browser_release_artifact_url_workflow_smoke=ok" "$OUT"; then
|
||||
echo "release artifact URL workflow browser smoke failed" >&2
|
||||
sed -n '1,220p' "$OUT" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "browser_release_artifact_url_workflow_smoke=ok"
|
||||
Reference in New Issue
Block a user