Highlight the active chat in session lists
This commit is contained in:
@@ -11,6 +11,8 @@ import { axNodes, enableSemantics, waitFor, capture } from './pipelines_probe_cd
|
||||
|
||||
const width = Number(process.env.PROBE_WIDTH ?? 1280);
|
||||
const height = Number(process.env.PROBE_HEIGHT ?? 800);
|
||||
const platform = process.env.PROBE_PLATFORM ?? 'cupertino';
|
||||
const dark = process.env.PROBE_DARK === '1';
|
||||
const messages = Array.from({ length: 6 }, (_, i) => ({
|
||||
id: `m${i}`,
|
||||
role: i % 2 ? 'assistant' : 'user',
|
||||
@@ -21,18 +23,29 @@ await mkdir(output, { recursive: true });
|
||||
const fixture = await startFixture({ root: resolve(process.argv[2]), chatMessages: messages });
|
||||
const profile = await mkdtemp(join(tmpdir(), 'chat-list-detail-'));
|
||||
const chrome = launchChrome('/Applications/Google Chrome.app/Contents/MacOS/Google Chrome', profile, 'about:blank');
|
||||
const log = { width, height, checks: [], captures: [] };
|
||||
const log = { width, height, platform, dark, checks: [], captures: [] };
|
||||
let c;
|
||||
const named = async (pattern) => (await axNodes(c)).filter(n => pattern.test(n.name?.value ?? ''));
|
||||
const selectedChatRows = () => c.evaluate(`Array.from(document.querySelectorAll(
|
||||
'[aria-current="true"], [aria-selected="true"]'
|
||||
)).filter(e => (e.getAttribute('aria-label') || e.textContent || '').startsWith('Probe conversation')).length`);
|
||||
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.setEmulatedMedia', {
|
||||
features: [{ name: 'prefers-color-scheme', value: dark ? 'dark' : 'light' }],
|
||||
});
|
||||
await c.send('Emulation.setDeviceMetricsOverride', { width, height, deviceScaleFactor: 1, mobile: false });
|
||||
await c.send('Page.navigate', { url: fixture.url + '/chat' });
|
||||
assert.ok(await waitFor(() => c.evaluate("Boolean(document.querySelector('flt-semantics-placeholder'))"), 30000));
|
||||
await enableSemantics(c);
|
||||
assert.ok(await waitFor(async () => (await named(/Select a chat/)).length > 0, 30000), 'empty detail pane');
|
||||
log.checks.push('empty pane beside list');
|
||||
assert.equal(await selectedChatRows(), 0, 'no chat selected initially');
|
||||
await sleep(500);
|
||||
await capture(c, output, log, 'list-empty-pane');
|
||||
|
||||
@@ -42,6 +55,7 @@ try {
|
||||
const [x1, y1, , , x3, y3] = model.content;
|
||||
await c.send('Input.dispatchMouseEvent', { type: 'mousePressed', x: (x1 + x3) / 2, y: (y1 + y3) / 2, button: 'left', clickCount: 1 });
|
||||
await c.send('Input.dispatchMouseEvent', { type: 'mouseReleased', x: (x1 + x3) / 2, y: (y1 + y3) / 2, button: 'left', clickCount: 1 });
|
||||
await c.send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: width - 5, y: height - 5 });
|
||||
assert.ok(await waitFor(async () => (await named(/Recorded fixture message 5/)).length > 0, 30000), 'open chat transcript');
|
||||
await sleep(800);
|
||||
// The rail, the list and the open chat are all on screen; nothing offers Back.
|
||||
@@ -52,7 +66,15 @@ try {
|
||||
assert.equal((await named(/^Back(\s|$)/)).length, 0, 'no Back in the two-pane layout');
|
||||
log.path = await c.evaluate('location.pathname');
|
||||
log.checks.push('rail, list and open chat visible together; no Back');
|
||||
assert.equal(await selectedChatRows(), 1, 'open chat row stays selected after the pointer leaves');
|
||||
log.checks.push('active chat row exposes persistent selected semantics');
|
||||
await capture(c, output, log, 'list-open-chat');
|
||||
await c.send('Page.reload');
|
||||
assert.ok(await waitFor(() => c.evaluate("Boolean(document.querySelector('flt-semantics-placeholder'))"), 30000));
|
||||
await enableSemantics(c);
|
||||
assert.ok(await waitFor(async () => (await named(/Recorded fixture message 5/)).length > 0, 30000), 'deep-linked chat reloads');
|
||||
assert.ok(await waitFor(async () => await selectedChatRows() === 1, 30000), 'routed chat remains selected after reload');
|
||||
log.checks.push('deep-linked chat selection survives reload');
|
||||
console.log(JSON.stringify(log, null, 2));
|
||||
} catch (error) {
|
||||
if (c) {
|
||||
|
||||
Reference in New Issue
Block a user