fix: complete unrestricted waits catalog and network flows

This commit is contained in:
Agent Workbench Dev
2026-11-06 06:21:59 +08:00
parent c93c434808
commit c9c77c7ee6
32 changed files with 295 additions and 84 deletions
+6 -1
View File
@@ -15,6 +15,7 @@ async function until(predicate, timeout = 20000) {
}
export async function verifyBrowserApi({ api, url, token, directory, appRoot, contained = false }) {
const open = (await api('/bootstrap')).config.executionMode === 'unrestricted';
const projectRoot = path.join(directory, 'browser-project'); fs.mkdirSync(path.join(projectRoot, 'dist'), { recursive: true });
fs.writeFileSync(path.join(projectRoot, 'README.md'), '# Owned portable browser acceptance\n');
fs.writeFileSync(path.join(projectRoot, 'dist', 'index.html'), '<!doctype html><html lang="zh-CN"><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>随包页面验收</title>'
@@ -27,8 +28,12 @@ export async function verifyBrowserApi({ api, url, token, directory, appRoot, co
await until(async () => { current = await api(route); return current.status === 'awaiting_approval'; });
const approval = current.approvals.find(value => value.status === 'pending'); assert.equal(approval.command, 'node --version');
await api(route + '/approvals/' + approval.id, { allow: true });
await until(async () => { current = await api(route); return current.status === 'needs_review'; });
await until(async () => { current = await api(route); return current.status === (open ? 'completed' : 'needs_review'); });
for (const change of current.changes.filter(value => value.status === 'pending')) await api(route + '/changes/' + change.id + '/reject', {});
if (open) {
assert.ok(current.changes.some(value => value.status === 'applied'));
for (const change of current.changes.filter(value => value.status === 'applied')) await api(route + '/changes/' + change.id + '/rollback', {});
}
const taskId = (await api(route)).execution.task.id, availability = (await api(route + '/browser')).availability;
assert.equal(availability.status, 'available', availability.message); assert.equal(availability.playwrightVersion, '1.64.1');
const steps = [{ action: 'fill', selector: '#query', value: '本地页面验收' }, { action: 'select', selector: '#filter', value: 'pending' },