Files
Agent-Workbench/docs/reproducible-env-release-evidence/verifiers/prepare-ui.mjs
T

16 lines
2.1 KiB
JavaScript

import fs from 'node:fs';
import assert from 'node:assert/strict';
const write=(file,content)=>fs.writeFileSync(file,content,{flag:'wx'});
let full=fs.readFileSync('.qa/verify-task-control-j-formal-ui.mjs','utf8').replaceAll('task-control-j','reproducible-env-b').replaceAll('1.20.1','1.21.0');
const anchor=" await page.getByRole('button', { name: '查看任务记录', exact: true }).click();";
assert.ok(full.includes(anchor));
full=full.replace(anchor,anchor+"\n await expect(page.getByRole('region',{name:'工程环境与依赖',exact:true})).toBeVisible();\n results.push({width,height,panel:'工程环境与依赖入口(未执行诊断)',readOnly:true,...await screenshot(page,'environment-entry-'+width+'.png')});");
write('.qa/verify-reproducible-env-c-formal-ui.mjs',full);
let native=fs.readFileSync('.qa/model-fidelity-formal-ui.mjs','utf8').replaceAll('model-fidelity','reproducible-env-b').replaceAll('1.20.3','1.21.0');
const nativeAnchor=" results.push({ label, width, height, originalStatus, originalSessionPreserved: true, nativeSettingsMatchPublicConnection: true, saveFullyReachable: true, submitted: false });";
assert.ok(native.includes(nativeAnchor));
native=native.replace(nativeAnchor," await page.getByRole('button',{name:'查看任务记录',exact:true}).click();\n const environment=page.getByRole('region',{name:'工程环境与依赖',exact:true});await environment.scrollIntoViewIfNeeded();await expect(environment).toBeVisible();\n await expect(environment.getByRole('button',{name:'诊断工程环境',exact:true})).toBeVisible();\n await capture(page,label+'-environment-entry');\n"+nativeAnchor);
native=native.replace("directory = path.resolve('.qa/reproducible-env-c-formal-ui')","directory = path.resolve('.qa/reproducible-env-c-native-ui')").replace("fs.writeFileSync('.qa/reproducible-env-c-formal-ui.json'","fs.writeFileSync('.qa/reproducible-env-c-native-ui.json'");
write('.qa/verify-reproducible-env-c-native-ui.mjs',native);
console.log('Prepared separate read-only formal screens and actual installed Electron checks for 1.21.');