Complete prompt presets, body-priority panes and clearer chat and stage layouts
This commit is contained in:
@@ -16,8 +16,8 @@ const output = resolve(process.argv[3] ?? `build/list-detail-${platform}`);
|
||||
await mkdir(output, { recursive: true });
|
||||
const root = resolve(process.argv[2]);
|
||||
const runs = await startFixture({ root, chatMessages: [], chatSessions: [
|
||||
{ id: 'ses_probechat', title: 'First fixture chat', backend: 'claude', model: 'claude-opus', mode: 'auto', mode_name: 'Auto' },
|
||||
{ id: 'ses_secondchat', title: 'Second fixture chat', backend: 'claude', model: 'claude-opus', mode: 'auto', mode_name: 'Auto' },
|
||||
{ id: 'ses_probechat', title: 'First fixture chat', backend: 'claude', model: 'claude-opus', directory:'/srv/probe', updated_at:Date.now()-180000, mode: 'auto', mode_name: 'Auto' },
|
||||
{ id: 'ses_secondchat', title: 'Second fixture chat', backend: 'claude', model: 'claude-opus', directory:'/srv/probe', updated_at:Date.now()-180000, mode: 'auto', mode_name: 'Auto' },
|
||||
] });
|
||||
const pipelines = await startWiringFixture({ root });
|
||||
const profile = await mkdtemp(join(tmpdir(), 'list-detail-consistency-'));
|
||||
@@ -59,23 +59,25 @@ try {
|
||||
await enableSemantics(c);
|
||||
assert.ok(await waitFor(async () => (await geometry()).list,30000));
|
||||
const before = await geometry();
|
||||
assert.ok(Math.abs(before.list.width-before.body.width)<1, 'equal panes before selection');
|
||||
assert.ok(before.body.width>=width*0.5-1 && before.body.width<=width*0.6+1, 'body gets at least half the full window, targeting sixty percent');
|
||||
assert.ok(before.body.width>before.list.width,'body takes priority over list');
|
||||
assert.deepEqual(await selected(titles), []);
|
||||
for (let i=0;i<titles.length;i++) {
|
||||
await open(titles[i]);
|
||||
assert.ok(await waitFor(async () => (await selected(titles)).some(name => name.includes(titles[i])),12000), `${destination} selected ${titles[i]}`);
|
||||
assert.equal((await selected(titles)).length,1,'only the active row is selected');
|
||||
const bounds = await geometry();
|
||||
assert.ok(Math.abs(bounds.list.width-bounds.body.width)<1,'equal flexible panes');
|
||||
assert.equal(bounds.body.width,before.body.width,'body width is stable during selection');
|
||||
assert.equal(bounds.list.width,before.list.width,'selection does not resize panes');
|
||||
log.panes.push({destination,title:titles[i],...bounds});
|
||||
await sleep(300);
|
||||
await capture(c,output,log,`${destination}-selected-${i+1}`);
|
||||
}
|
||||
log.checks.push(`${destination}: list remains visible, selection moves, panes remain equal`);
|
||||
log.checks.push(`${destination}: list remains visible, selection moves, body gets 50–60% of full window`);
|
||||
}
|
||||
assert.ok(log.panes.every(p => Math.abs(p.list.width-log.panes[0].list.width)<1),'identical pane widths across destinations');
|
||||
log.checks.push('all three destinations have identical pane widths');
|
||||
assert.ok(log.panes.every(p => Math.abs(p.body.width-log.panes[0].body.width)<1),'identical body widths across destinations');
|
||||
log.checks.push('all three destinations share the same body-priority pane widths');
|
||||
console.log(JSON.stringify(log,null,2));
|
||||
} catch (error) {
|
||||
if(c) {
|
||||
|
||||
@@ -327,6 +327,8 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
let chatSubscribed = 0;
|
||||
let chatHistory = 0;
|
||||
const chatPrompts = [];
|
||||
const chatCreateRequests = [];
|
||||
const createdChats = [];
|
||||
const shellOutputRequests = [];
|
||||
const fileReads = [];
|
||||
let chatRunning = false;
|
||||
@@ -421,6 +423,7 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
chatSubscribed,
|
||||
chatHistory,
|
||||
chatPrompts,
|
||||
chatCreateRequests,
|
||||
shellOutputRequests,
|
||||
chatRunning,
|
||||
chatInterrupts,
|
||||
@@ -552,7 +555,24 @@ export async function startFixture({ root, runs = RUNS, runDetail, files = {}, c
|
||||
}
|
||||
if (request.type === 'chat_sessions') {
|
||||
client.send({ id: request.id, type: 'chat_sessions',
|
||||
chat_sessions: chatSessions ?? [CHAT_SESSION] });
|
||||
chat_sessions: [...(chatSessions ?? [CHAT_SESSION]), ...createdChats] });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_directories') {
|
||||
client.send({ id: request.id, type: 'chat_directories', chat_directories: ['/home/fixture', '/srv/probe'] });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_backends') {
|
||||
client.send({ id: request.id, type: 'chat_backends', chat_backends: ['opencode', 'claude'] });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_create') {
|
||||
const body = request.chat_create ?? {};
|
||||
chatCreateRequests.push(body);
|
||||
const session = { id: 'fixture_created_' + chatCreateRequests.length,
|
||||
title: body.title, directory: body.directory, backend: body.backend };
|
||||
createdChats.push(session);
|
||||
client.send({ id: request.id, type: 'chat_create', chat_session: session });
|
||||
return;
|
||||
}
|
||||
if (request.type === 'chat_subscribe') {
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
// Production app UI, isolated create-prompt and recorded-stage fixtures only.
|
||||
import assert from 'node:assert/strict';
|
||||
import { mkdir, mkdtemp, writeFile } from 'node:fs/promises';
|
||||
import { once } from 'node:events';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { join, resolve } from 'node:path';
|
||||
import { startFixture } from './runs_probe_server.mjs';
|
||||
import { launchChrome, waitForPort, waitForPage, connect, sleep } from './pipelines_probe_cdp_lib.mjs';
|
||||
import { axNodes, enableSemantics, waitFor, capture, click, clickAt } from './pipelines_probe_cdp_input.mjs';
|
||||
|
||||
const platform = process.env.PROBE_PLATFORM ?? 'material';
|
||||
const output = resolve(process.argv[3] ?? `build/ui-followups-${platform}`);
|
||||
await mkdir(output,{recursive:true});
|
||||
const stage = 'verify_release';
|
||||
const runDetail = { id:1,title:'Recorded release',status:'failed',graph:{stages:[{key:stage,type:'model'}]},steps:[
|
||||
{stage,sequence:1,status:'completed',outcome:'success',provider:'openai',model:'fixture-model',
|
||||
started_at:'2026-10-25T12:00:00Z',finished_at:'2026-10-25T12:02:05Z',output:{result:'First visit'}},
|
||||
{stage,sequence:2,status:'failed',outcome:'error',diagnostic:'Recorded verification failure',
|
||||
started_at:'2026-10-25T12:03:00Z',finished_at:'2026-10-25T12:03:10Z',output:{result:'Second visit'}},
|
||||
]};
|
||||
const fixture=await startFixture({root:resolve(process.argv[2]),runDetail,chatMessages:[]});
|
||||
const profile=await mkdtemp(join(tmpdir(),'ui-followups-'));
|
||||
const chrome=launchChrome('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome',profile,'about:blank');
|
||||
const log={platform,checks:[],captures:[]};
|
||||
let c;
|
||||
const names=async()=>(await axNodes(c)).flatMap(n=>[n.name?.value??'',n.value?.value??'']);
|
||||
async function point(node) {
|
||||
assert.ok(node,'expected accessible control');
|
||||
const {model}=await c.send('DOM.getBoxModel',{backendNodeId:node.backendDOMNodeId});
|
||||
const [x1,y1,,,x3,y3]=model.content;await clickAt(c,(x1+x3)/2,(y1+y3)/2);
|
||||
}
|
||||
async function navigate(path) {
|
||||
await c.send('Page.navigate',{url:fixture.url+path});
|
||||
assert.ok(await waitFor(()=>c.evaluate("Boolean(document.querySelector('flt-semantics-placeholder'))"),30000));
|
||||
await enableSemantics(c);
|
||||
}
|
||||
async function createButton() {
|
||||
return waitFor(async () => {
|
||||
const button=(await axNodes(c)).filter(n=>n.role?.value==='button'&&n.name?.value==='New chat'&&n.backendDOMNodeId).at(-1);
|
||||
return button && !button.properties?.some(p=>p.name==='disabled'&&p.value?.value===true) ? button : null;
|
||||
},10000);
|
||||
}
|
||||
async function promptSwitch() {
|
||||
return (await axNodes(c)).find(n=>['switch','checkbox'].includes(n.role?.value)&&n.backendDOMNodeId);
|
||||
}
|
||||
try {
|
||||
c=await connect((await waitForPage(await waitForPort(join(profile,'DevToolsActivePort')))).webSocketDebuggerUrl);
|
||||
await c.send('Page.enable');
|
||||
if(platform==='material') await c.send('Emulation.setUserAgentOverride',{
|
||||
userAgent:'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/155.0.0.0 Safari/537.36',platform:'Win32',
|
||||
});
|
||||
await c.send('Emulation.setDeviceMetricsOverride',{width:1280,height:1000,deviceScaleFactor:1,mobile:false});
|
||||
await navigate('/chat');
|
||||
await click(c,'New chat');
|
||||
let toggle=await waitFor(promptSwitch,15000);assert.ok(toggle);
|
||||
assert.equal(String(toggle.properties.find(p=>p.name==='checked')?.value?.value),'false','prompt is off by default');
|
||||
await capture(c,output,log,'01-prompt-off');
|
||||
await point(await createButton());
|
||||
assert.ok(await waitFor(()=>c.evaluate("location.pathname.includes('fixture_created_1')"),10000));
|
||||
let state=await(await fetch(fixture.url+'/fixture/state')).json();
|
||||
assert.equal(state.chatCreateRequests.length,1);
|
||||
assert.equal(Object.hasOwn(state.chatCreateRequests[0],'instructions'),false);
|
||||
log.checks.push('default-off chat creation omits instructions');
|
||||
|
||||
await navigate('/chat');await click(c,'New chat');
|
||||
await point(await waitFor(promptSwitch,10000));
|
||||
await sleep(300);
|
||||
await click(c,'Custom');await click(c,'Careful coding');await sleep(300);
|
||||
await capture(c,output,log,'02-preset-editable');
|
||||
await click(c,'Careful coding');await click(c,'Custom');await sleep(200);
|
||||
const editor=(await axNodes(c)).filter(n=>n.role?.value==='textbox'&&n.backendDOMNodeId).at(-1);
|
||||
await point(editor);await c.send('Input.insertText',{text:'Custom prompt from the isolated fixture.'});
|
||||
await sleep(200);await point(await createButton());
|
||||
assert.ok(await waitFor(()=>c.evaluate("location.pathname.includes('fixture_created_2')"),10000));
|
||||
state=await(await fetch(fixture.url+'/fixture/state')).json();
|
||||
assert.equal(state.chatCreateRequests[1].instructions,'Custom prompt from the isolated fixture.');
|
||||
log.checks.push('real preset/custom picker and exact custom create payload');
|
||||
|
||||
for(const [index,sequence] of [[0,1],[1,2]]) {
|
||||
await navigate(`/runs/1/stage/${stage}?visit=${index}`);
|
||||
assert.ok(await waitFor(()=>c.evaluate("Boolean(document.querySelector('[flt-semantics-identifier=run-stage-heading]'))"),15000));
|
||||
assert.ok((await names()).includes(stage));
|
||||
assert.ok((await names()).includes('Visit '+sequence));
|
||||
if(index===1) assert.ok((await names()).some(name=>name.includes('Recorded verification failure')));
|
||||
await capture(c,output,log,`03-stage-visit-${sequence}`);
|
||||
}
|
||||
log.checks.push('prominent stage heading and correct separate coordinates for repeated deep-linked visits');
|
||||
console.log(JSON.stringify(log,null,2));
|
||||
} catch(error) {
|
||||
if(c){await capture(c,output,log,'failure');await writeFile(join(output,'failure-ax.json'),JSON.stringify(await axNodes(c),null,2));}
|
||||
throw error;
|
||||
} finally {
|
||||
await writeFile(join(output,'result.json'),JSON.stringify(log,null,2));
|
||||
c?.close();const exited=once(chrome,'exit');chrome.kill();await exited;await fixture.close();
|
||||
}
|
||||
Reference in New Issue
Block a user