fix(ci): log Electron setup and verify the product Edge runtime
This commit is contained in:
@@ -8,11 +8,12 @@ import { HostController } from '../src/core/desktop/host-controller.mjs';
|
||||
import { observeWindowsProcess } from '../src/core/desktop/process-identity.mjs';
|
||||
import { desktopExecutableIdentity } from '../src/core/desktop/app-installation.mjs';
|
||||
import { projectEnvironment } from '../src/core/process-environment.mjs';
|
||||
import { browserInstallation } from '../src/core/browser/browser-driver.mjs';
|
||||
import { openWorkbenchTool } from './ui-navigation.mjs';
|
||||
import { fileDigest, writeNewJson } from './ci-utils.mjs';
|
||||
|
||||
const args=process.argv.slice(2);
|
||||
if(args.includes('--help')) {console.log('node scripts/ci-desktop-smoke.mjs --evidence NEW_DIRECTORY — actual locked Chromium and hidden Electron against an owned new host/project. No model, external project, formal configuration or installation.');process.exit(0);}
|
||||
if(args.includes('--help')) {console.log('node scripts/ci-desktop-smoke.mjs --evidence NEW_DIRECTORY — actual product Microsoft Edge and hidden Electron through locked Playwright against an owned new host/project. No model, external project, formal configuration or installation.');process.exit(0);}
|
||||
if(args.length!==2 || args[0]!=='--evidence')throw new Error('Use --help');
|
||||
assert.equal(process.platform,'win32');
|
||||
const appRoot=process.cwd(),evidence=path.resolve(args[1]);fs.mkdirSync(evidence);
|
||||
@@ -21,7 +22,7 @@ const original=Buffer.from('# Owned CI project\n\nSource retained while actual w
|
||||
fs.writeFileSync(path.join(projectRoot,'README.md'),original,{flag:'wx'});
|
||||
const reservation=net.createServer();await new Promise(resolve=>reservation.listen(0,'127.0.0.1',resolve));const port=reservation.address().port;await new Promise(resolve=>reservation.close(resolve));
|
||||
const controller=new HostController({appRoot,dataRoot,port,nodePath:process.execPath,timeoutMs:60000});
|
||||
const report={schemaVersion:1,passed:false,startedAt:new Date().toISOString(),ownedRoot,port,groups:[],screenshots:[],pageErrors:[],externalRequests:[],scope:'Actual isolated Chromium/Electron and owned source/data only; no model or formal installation.'};
|
||||
const report={schemaVersion:1,passed:false,startedAt:new Date().toISOString(),ownedRoot,port,groups:[],screenshots:[],pageErrors:[],externalRequests:[],scope:'Actual isolated product Microsoft Edge/Electron through locked Playwright and owned source/data only; no model or formal installation.'};
|
||||
let browser,application,electronPid,hostIdentity,stage='host-start';
|
||||
const record=(name,detail={})=>report.groups.push({name,passed:true,...detail});
|
||||
const watch=(page)=>{page.on('pageerror',error=>report.pageErrors.push(error.message));page.on('request',request=>{const url=new URL(request.url());if(['http:','https:'].includes(url.protocol) && !(url.hostname==='127.0.0.1' && Number(url.port)===port))report.externalRequests.push(request.url());});};
|
||||
@@ -53,7 +54,7 @@ try{
|
||||
hostIdentity=(await controller.start()).identity;report.host={pid:hostIdentity.pid,createdAt:hostIdentity.createdAt};
|
||||
const project=await controller.api('/projects',{method:'POST',input:{root:projectRoot}}),session=await controller.api('/sessions',{method:'POST',input:{projectId:project.id}});
|
||||
record('owned new host/project/session',{projectId:project.id,sessionId:session.id});
|
||||
stage='chromium';browser=await chromium.launch({headless:true});report.chromiumVersion=browser.version();
|
||||
stage='product-edge';const edge=browserInstallation(appRoot);assert.equal(edge.status,'available','Product Microsoft Edge is required');report.edge=edge;browser=await chromium.launch({executablePath:edge.executable.path,headless:true});report.edgeVersion=browser.version();
|
||||
const page=await browser.newPage({viewport:{width:1280,height:900}});watch(page);await page.goto(controller.url);await userPath(page,'web',project.id);await browser.close();browser=null;
|
||||
stage='electron';const executable=desktopExecutableIdentity(appRoot).path;
|
||||
application=await _electron.launch({executablePath:executable,args:[path.join(appRoot,'dist-desktop/main.cjs'),'--app-root',appRoot,'--data-root',dataRoot,'--node',process.execPath,'--port',String(port),'--hidden-window'],cwd:appRoot,env:projectEnvironment(),timeout:60000});
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
"runnerLabel": "awb-windows-x64",
|
||||
"profiles": {
|
||||
"contract": "Pinned official sources, registry/version/deprecation regressions and full application build. No Windows/real-provider claim.",
|
||||
"windows": "Fresh locked dependencies, full source tests without skips, Microsoft Edge, actual Chromium/Electron smoke and owned installation regressions. No formal installation or model request."
|
||||
"windows": "Fresh locked dependencies, full source tests without skips, actual product Microsoft Edge/Electron through locked Playwright and owned installation regressions. No formal installation or model request."
|
||||
},
|
||||
"actions": {
|
||||
"checkout": "https://gitea.com/actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683",
|
||||
|
||||
+2
-2
@@ -85,13 +85,13 @@ try {
|
||||
const pythonInfo = JSON.parse(readOutput('python-packages')); assert.equal(pythonInfo.python,lock.python); assert.equal(pythonInfo.pytest,lock.pytest); assert.equal(pythonInfo.pip,lock.pip); assert.notEqual(pythonInfo.prefix,pythonInfo.basePrefix);
|
||||
report.environment.pythonQa = { ...pythonInfo, sha256: fileDigest(python), requirementsSha256: fileDigest(path.join(run.source,'scripts/ci-python-requirements.txt')) };
|
||||
await command('python-pip-check',python,['-I','-m','pip','--isolated','check'],run.tmp);
|
||||
stage = 'explicit-electron-install';
|
||||
await nodeCommand('electron-install',['node_modules/electron/install.js']);
|
||||
const require = createRequire(path.join(run.source,'package.json'));
|
||||
const electron = require('electron'); assert.ok(fs.statSync(electron).isFile(), 'Actual Electron binary missing');
|
||||
report.environment.electron = { executable: electron, sha256: fileDigest(electron) };
|
||||
const { browserInstallation } = await import(pathToFileURL(path.join(run.source,'src/core/browser/browser-driver.mjs')).href);
|
||||
const edge = browserInstallation(run.source); assert.equal(edge.status,'available','Actual Microsoft Edge is required; do not skip browser tests.'); report.environment.edge = edge;
|
||||
stage = 'chromium-install';
|
||||
await nodeCommand('chromium-install', ['node_modules/playwright/cli.js','install','chromium']);
|
||||
}
|
||||
stage = 'build'; await nodeCommand('build',[npmCli,'run','build']);
|
||||
report.build = builtFiles(run.source); writeNewJson(path.join(run.evidence,'build-inputs.json'),report.build);
|
||||
|
||||
@@ -21,7 +21,7 @@ export function verifyCiWorkflow(root) {
|
||||
const execution=job.steps.find(step=>step.run); assert.equal(execution.shell,'pwsh');
|
||||
assert.match(execution.run,/scripts\/ci\.mjs --profile windows --python \$qaPython --output-root \.qa\/ci/);
|
||||
assert.match(execution.run,/exit \$LASTEXITCODE/);
|
||||
const artifact=job.steps.at(-1); assert.equal(artifact.if,'always()'); assert.equal(artifact.with.path,'.qa/ci/**/evidence/**'); assert.equal(artifact.with['if-no-files-found'],'error');
|
||||
const artifact=job.steps.at(-1); assert.equal(artifact.if,'always()'); assert.equal(artifact.with.path,'.qa/ci/**/evidence/**'); assert.equal(artifact.with['if-no-files-found'],'error'); assert.equal(artifact.with['include-hidden-files'],true, 'The explicit .qa evidence directory must be uploaded');
|
||||
return {passed:true,workflow:'.gitea/workflows/ci.yml',sha256:fileDigest(file),runnerLabel:lock.runnerLabel,actions:uses,
|
||||
scope:'Actual YAML parse, pinned action/Node/Python refs, error propagation and evidence upload contract. Does not assert runner availability or remote execution.'};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user