fix(ui): repair settings editing and workflow diagnostics

This commit is contained in:
sam committed 2026-10-16 23:55:58 +11:00
1 parent 3229de9b3b
commit 41cd938748
46 files changed
+708 -240

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
const assert=require('node:assert/strict');
module.exports=async({page,go})=>{
await page.route('**/api/access/policies',async route=>{await new Promise(r=>setTimeout(r,2200));await route.continue()});
await go('/access/policies');
assert.equal(await page.getByText('No policies yet.',{exact:true}).count(),0);
await page.getByText('Loading policies…',{exact:true}).waitFor({state:'hidden'});
await page.route('**/api/tasks?**',async route=>{
if(new URL(route.request().url()).searchParams.has('workflow')) await route.fulfill({status:200,contentType:'application/json',body:'unreadable response'});
else await route.continue();
});
await go('/workflows');
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor();
await page.getByRole('tab',{name:/^Runs/}).click();
assert.equal(await page.getByText('No runs yet',{exact:true}).count(),0);
await page.unroute('**/api/tasks?**');
await page.getByRole('button',{name:'Retry runs',exact:true}).click();
await page.getByRole('alert').filter({hasText:'Could not load recent runs'}).waitFor({state:'hidden'});
};
+17
View File
@@ -0,0 +1,17 @@
// The save response is mocked; this checks the page's save path without changing models.
const assert=require('node:assert/strict');
module.exports=async({page,go})=>{
let submitted;
await page.route('**/api/control-plane/resources/model-aliases/commands/replace',async route=>{
submitted=route.request().postDataJSON();
await route.fulfill({json:{resource:{kind:'model-aliases',version:submitted.expected_version+1,value:submitted.value}}});
});
await go('/access/models');
await page.getByLabel('New alias',{exact:true}).fill('e2e-test');
await page.getByRole('button',{name:'Add alias',exact:true}).click();
await page.getByLabel('e2e-test',{exact:true}).fill('test/model');
await page.getByRole('button',{name:'Review and save',exact:true}).click();
await page.getByRole('button',{name:'Save',exact:true}).click();
await page.getByRole('heading',{name:/^Review \d/}).waitFor({state:'hidden'});
assert.equal(submitted?.value['e2e-test'],'test/model');
};
+34
View File
@@ -0,0 +1,34 @@
// Draft edits only: no saved configuration is changed.
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await go('/settings/schedules');
await page.getByRole('button', { name: 'Add schedule', exact: true }).click();
await page.getByLabel('Schedule name', { exact: true }).fill('Daily repository check');
await page.getByLabel('Instructions', { exact: true }).fill('Check the repository and report actionable failures.\n'.repeat(20));
assert.equal(await page.getByLabel('ID', { exact: true }).count(), 0);
await page.getByRole('link', { name: 'Dashboard', exact: true }).click();
await page.getByRole('link', { name: 'Settings', exact: true }).click();
await page.getByRole('link', { name: 'Channels', exact: true }).click();
await page.getByText('Chat session defaults', { exact: true }).waitFor();
const form = await page.getByText('Chat session defaults', { exact: true }).evaluate(el => el.closest('section').getBoundingClientRect().width);
assert.ok(form <= 850, `settings form stretched to ${form}px`);
const review = page.getByRole('button', { name: 'Review and save', exact: true });
await review.scrollIntoViewIfNeeded();
const unobscured = await review.evaluate(el => { const r=el.getBoundingClientRect(); const hit=document.elementFromPoint(r.x+r.width/2,r.y+r.height/2); return hit && el.contains(hit); });
assert.ok(unobscured, 'Review and save is covered');
await review.click();
await page.getByRole('heading', { name: /^Review \d/ }).waitFor();
await page.getByText('Daily repository check', { exact: false }).last().waitFor();
assert.equal(await page.locator('li p').filter({ hasText: /^After:.*\{"id":/ }).count(), 0, 'review contains a raw schedule object');
await shot('review');
await page.getByRole('button', { name: 'Discard all', exact: true }).click();
assert.equal(await page.getByRole('region', { name: 'Unsaved changes' }).count(), 0);
await page.setViewportSize({width:390,height:844});
await page.getByRole('link',{name:'Schedules',exact:true}).click();
await page.getByRole('button',{name:'Add schedule',exact:true}).click();
const mobileReview=page.getByRole('button',{name:'Review and save',exact:true});
await mobileReview.scrollIntoViewIfNeeded();
assert.ok(await mobileReview.evaluate(el=>{const r=el.getBoundingClientRect();return el.contains(document.elementFromPoint(r.x+r.width/2,r.y+r.height/2))}), 'mobile save action covered');
await shot('mobile');
await page.getByRole('button',{name:'Discard',exact:true}).click();
};
+21
View File
@@ -0,0 +1,21 @@
const assert=require('node:assert/strict');
module.exports=async({page,go,shot})=>{
await go('/tasks');
const base=new URL(page.url()).origin;
const tasks=await (await page.request.get(base+'/api/tasks')).json();
const task=tasks.find(t=>t.status==='parked' && t.attempt>0);
assert.ok(task,'seeded stack has no parked attempt to inspect');
const state=await (await page.request.get(`${base}/api/tasks/${task.id}/attempts`)).json();
assert.ok(state.attempts.some(a=>a.attempt===state.current_attempt),'claimed current attempt missing');
await go(`/tasks/${task.id}`);
assert.equal(await page.getByText(`Attempt ${state.current_attempt} is not recorded`,{exact:true}).count(),0);
const logs=await (await page.request.get(`${base}/api/tasks/${task.id}/logs?attempt=${state.current_attempt}&level=ERROR&limit=1`)).json();
await page.getByRole('button',{name:'Jump to log line',exact:true}).click();
if(logs.entries?.[0]?.id){
await page.locator(`[data-log-id="${logs.entries[0].id}"]`).waitFor();
await page.waitForFunction(id=>document.activeElement?.getAttribute('data-log-id')===String(id),logs.entries[0].id);
}else{
await page.getByText('No error log line was recorded for this attempt.',{exact:true}).waitFor();
}
await shot('attempt');
};
+14
View File
@@ -0,0 +1,14 @@
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await page.route('**/api/control-plane/resources/workflow-definitions', async route => {
await new Promise(resolve => setTimeout(resolve, 2200));
await route.continue();
});
await go('/workflows');
assert.equal(await page.getByText('No workflows', { exact: true }).count(), 0, 'loading presented as empty');
await page.getByText('Loading workflows…', { exact: true }).waitFor({ state: 'hidden' });
await page.getByRole('button', { name: /^implement/ }).click();
assert.equal(await page.getByText(/workflow implement has no steps/).count(), 0, 'late definition left an empty canvas');
await page.locator('.vue-flow__node').filter({ hasText: 'Repository gate' }).first().waitFor();
await shot('loaded');
};
+23
View File
@@ -0,0 +1,23 @@
const assert = require('node:assert/strict');
module.exports = async ({ page, go, shot }) => {
await go('/workflows');
await page.getByRole('button', {name:/^implement/}).click();
await page.locator('.vue-flow__node').filter({hasText:'Prepare worktree'}).first().click();
const condition=page.getByLabel('Run only when', {exact:true});
await condition.fill('what');
await page.getByRole('alert').filter({hasText:'when must name'}).first().waitFor();
assert.equal(await page.getByRole('button',{name:'Save',exact:true}).isDisabled(),true);
await condition.fill('task.title');
const backoff=page.getByLabel('Retry backoff',{exact:true});
await backoff.fill('yes');
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor();
assert.equal(await page.getByRole('button',{name:'Save',exact:true}).isDisabled(),true);
await backoff.fill('0.5');
await page.getByLabel('Run only when',{exact:true}).focus();
await page.getByText('Enter a number zero or greater.',{exact:true}).waitFor({state:'hidden'});
assert.equal(await page.getByRole('button',{name:'Save',exact:true}).isEnabled(),true);
await page.getByRole('combobox',{name:'Unit',exact:true}).selectOption('m');
await page.getByRole('tab',{name:'YAML',exact:true}).click();
assert.match(await page.getByLabel('Workflow YAML',{exact:true}).inputValue(), /backoff: 30s/);
await shot('validated');
};