Files
FreeCADWasmDev/tools/bim-site-gui-acceptance.mjs
wangdequan 39410dea36 Add the shared tool modules the new gates import
The previous commit landed the audit-coverage change together with the
scripts that enforce it, but several of those scripts import shared
modules that were never tracked: static-host.mjs (ephemeral isolated
static host used by every browser runner), wasm-probe-runtime.mjs,
official-fixture-resolver.mjs, artifact-assets.mjs and the four BIM GUI
acceptance modules. A checkout of that tree could not load the runners
that reference them.

Add the transitive closure of untracked local imports, computed by walking
the relative .mjs imports of the committed batch until no new files appear:
8 files, 27 KB, none of them covered by .gitignore.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 09:26:05 +08:00

12 lines
2.5 KiB
JavaScript

import assert from "node:assert/strict";
export const siteGuiMethods=["test_new_site_creation","test_new_site_save_and_reopen","test_legacy_site_migration"];
export async function verifySiteGui(page,native){
if(!native||native.ok!==true||native.preflight?.passed!==true||native.saveReopen?.roundTrip!==true||native.saveReopen?.legacyFound!==true) throw new Error("preflight_failed: Site native owner contract is incomplete");
const types=await page.evaluate(()=>({panel:document.querySelector("#bim-site-panel")?.constructor.name,type:document.querySelector("#bim-site-type")?.textContent,proxy:document.querySelector("#bim-site-proxy")?.textContent,status:document.querySelector("#bim-site-status")?.textContent,month:document.querySelector("#bim-site-month")?.value,day:document.querySelector("#bim-site-day")?.value,scale:document.querySelector("#bim-site-scale")?.textContent,saveDisabled:document.querySelector("#bim-site-save")?.disabled,overflow:document.documentElement.scrollWidth>innerWidth||document.documentElement.scrollHeight>innerHeight,bounds:(()=>{const b=document.querySelector("#app")?.getBoundingClientRect();return !!b&&b.left>=0&&b.top>=0&&b.right<=innerWidth&&b.bottom<=innerHeight})()}));
assert.equal(types.panel,"HTMLDivElement");assert.equal(types.type,native.preflight.nativeSite.typeId);assert.equal(types.proxy,native.preflight.nativeSite.proxyType);assert.equal(types.month,"6");assert.equal(types.day,"21");assert.equal(types.scale,"20000");assert.equal(types.saveDisabled,false);assert.equal(types.overflow,false);assert.equal(types.bounds,true);
const checks=[];const check=(name,actual,expected)=>{assert.deepEqual(actual,expected,name);checks.push({name,passed:true});};
check("Site object type is visible",types.type,native.preflight.nativeSite.typeId);check("Site proxy is visible",types.proxy,native.preflight.nativeSite.proxyType);check("default solar values are visible",[types.month,types.day,types.scale],["6","21","20000"]);
const month=page.locator("#bim-site-month");await month.fill("13");await month.dispatchEvent("change");check("SunDateMonth clamps at 12",await month.inputValue(),"12");await month.fill("0");await month.dispatchEvent("change");check("SunDateMonth clamps at 1",await month.inputValue(),"1");await month.fill("6");await page.screenshot({path:`${process.cwd()}/docs/current/business-evidence/desktop-test-bim-testarchsitegui-20261027/${types.bounds?'site':''}-${page.viewportSize()?.width===390?'mobile':'desktop'}-site-panel.png`});
return {passed:checks.length===5,checks,types};
}