Align GUI audit with workbench selection and sync dist manifest
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -35,6 +35,17 @@ const url = `${origin}/project.html?workbench=${encodeURIComponent(workbench)}`;
|
||||
const response = await page.goto(url, { waitUntil: "domcontentloaded", timeout: 120000 });
|
||||
await page.waitForSelector('select[aria-label="Workbench"]', { timeout: 120000 }).catch(() => {});
|
||||
await page.waitForTimeout(1500);
|
||||
if (workbench !== "Part") {
|
||||
await page.locator('nav[aria-label="Application menus"] details').filter({ hasText: "File" }).locator("summary").click();
|
||||
await page.getByRole("button", { name: "新建 Document", exact: true }).click();
|
||||
await page.waitForTimeout(1800);
|
||||
await page.evaluate(() => { for (const details of document.querySelectorAll('nav[aria-label="Application menus"] details[open]')) details.open = false; });
|
||||
const selector = page.locator('select[aria-label="Workbench"]');
|
||||
if (await selector.count() && !(await selector.isDisabled())) {
|
||||
await selector.selectOption(workbench).catch(() => {});
|
||||
await page.waitForTimeout(1600);
|
||||
}
|
||||
}
|
||||
const metrics = await page.evaluate(() => ({
|
||||
menus: [...document.querySelectorAll('nav[aria-label="Application menus"] details > summary')]
|
||||
.map(node => node.textContent.trim()),
|
||||
@@ -49,7 +60,20 @@ const metrics = await page.evaluate(() => ({
|
||||
overflow: document.documentElement.scrollWidth - document.documentElement.clientWidth,
|
||||
}));
|
||||
const expectedMenus = desktop.menus.map(menu => menu.label);
|
||||
const missingMenus = expectedMenus.filter(label => !metrics.menus.includes(label));
|
||||
let submenus = [];
|
||||
if (workbench !== "Part") {
|
||||
const toggle = page.locator(`summary[aria-label="${workbench} menu"]`).first();
|
||||
if (await toggle.count()) {
|
||||
await toggle.click();
|
||||
for (let attempt = 0; attempt < 12; attempt++) {
|
||||
await page.waitForTimeout(400);
|
||||
submenus = await page.locator(".parity-menu-items>details>summary").allTextContents();
|
||||
if (submenus.length) break;
|
||||
}
|
||||
await toggle.click().catch(() => {});
|
||||
}
|
||||
}
|
||||
const missingMenus = expectedMenus.filter(label => !metrics.menus.includes(label) && !submenus.includes(label));
|
||||
const shot = path.join(outDir, `${workbench}-web.png`);
|
||||
await page.screenshot({ path: shot, fullPage: false });
|
||||
const report = {
|
||||
@@ -57,7 +81,7 @@ const report = {
|
||||
generatedAt: new Date().toISOString(), workbench, url,
|
||||
desktop: { menus: expectedMenus, toolbars: desktop.toolbars.map(bar => bar.name),
|
||||
menuCommandCount: desktop.menus.reduce((sum, menu) => sum + menu.items.length, 0) },
|
||||
web: metrics, missingMenus,
|
||||
web: { ...metrics, submenus }, missingMenus,
|
||||
status: response?.status(), errors, failed,
|
||||
ok: response?.status() === 200 && errors.length === 0 && failed.length === 0 && metrics.overflow === 0,
|
||||
};
|
||||
|
||||
@@ -306,5 +306,10 @@ fs.mkdirSync(path.join(webRoot, "docs/current"), { recursive: true });
|
||||
fs.writeFileSync(path.join(webRoot, "public/api/desktop-gui-manifest.json"), `${JSON.stringify(manifest, null, 2)}\n`);
|
||||
fs.writeFileSync(path.join(webRoot, "docs/current/desktop-parity-matrix.json"), `${JSON.stringify(matrixOut, null, 2)}\n`);
|
||||
fs.writeFileSync(path.join(webRoot, "public/api/gui-command-gap-report.json"), `${JSON.stringify(gapReport, null, 2)}\n`);
|
||||
const distApi = path.join(webRoot, "dist", "api");
|
||||
if (fs.existsSync(distApi)) {
|
||||
fs.copyFileSync(path.join(webRoot, "public/api/desktop-gui-manifest.json"), path.join(distApi, "desktop-gui-manifest.json"));
|
||||
fs.copyFileSync(path.join(webRoot, "public/api/gui-command-gap-report.json"), path.join(distApi, "gui-command-gap-report.json"));
|
||||
}
|
||||
console.log(JSON.stringify({ ok: true, workbenches: workbenches.length, commands: records.length,
|
||||
menuCommands: menuCommandIds.size, stats: matrixOut.stats }));
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema": "freecad-web-desktop-parity-matrix/v1",
|
||||
"generatedAt": "2026-11-13T15:23:28.947Z",
|
||||
"generatedAt": "2026-11-13T15:26:40.898Z",
|
||||
"stats": {
|
||||
"workbenches": 29,
|
||||
"commands": 1492,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema": "freecad-web-desktop-gui-manifest/v1",
|
||||
"generatedAt": "2026-11-13T15:23:28.947Z",
|
||||
"generatedAt": "2026-11-13T15:26:40.898Z",
|
||||
"sourceRevision": {
|
||||
"matrix": "0f467b45c2ed0105bc3f9d58a6149f18a6dc65dd86a93fc6b4f53cd1a39cfe5c",
|
||||
"routes": "6b21e4b2a7b06f5516433771bba06d61d1e7f3daa0e9a68c83aad6e000b4a25a"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"schema": "freecad-web-desktop-gui-gap-report/v1",
|
||||
"generatedAt": "2026-11-13T15:23:28.947Z",
|
||||
"generatedAt": "2026-11-13T15:26:40.898Z",
|
||||
"byStatus": {
|
||||
"workbenches": 29,
|
||||
"commands": 1492,
|
||||
|
||||
Reference in New Issue
Block a user