feat(chat): rotate the Stop icon slowly while processing

This commit is contained in:
2026-10-24 13:09:53 +01:00
parent 701449b416
commit 7ad1afb09f
6 changed files with 305 additions and 5 deletions
+29
View File
@@ -46,6 +46,9 @@ try {
const port = await waitForPort(join(profile, 'DevToolsActivePort'));
connection = await connect((await waitForPage(port)).webSocketDebuggerUrl);
await connection.send('Page.enable');
if (process.env.CHECK_STOP_ROTATION === '1') {
await connection.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: 'no-preference' }] });
}
if (process.env.PROBE_PLATFORM === 'material') {
await connection.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',
@@ -109,6 +112,32 @@ try {
log.checks.push('per-message reasoning is immediately left of tools count');
await assertPainted('Checking the recorded evidence.', 'reasoning visible while text streams', 'chat-live-reasoning');
await assertPainted('The answer is arriving.', 'streamed answer visible', 'chat-live-answer');
if (process.env.CHECK_STOP_ROTATION === '1') {
const stop = (await axNodes(connection)).find(node => node.name?.value === 'Stop' && node.role?.value === 'button' && node.backendDOMNodeId);
assert.ok(stop, 'Stop target available');
const box = (await connection.send('DOM.getBoxModel', { backendNodeId: stop.backendDOMNodeId })).model.content;
const crop = [box[0], box[1], box[4], box[5]].map(Math.round);
const differs = async (a, b) => {
const code = 'import sys; from PIL import Image,ImageChops; box=tuple(map(int,sys.argv[3:])); a=Image.open(sys.argv[1]).convert("RGB").crop(box); b=Image.open(sys.argv[2]).convert("RGB").crop(box); print(int(ImageChops.difference(a,b).getbbox() is not None))';
const { stdout } = await promisify(execFile)('python3', ['-c', code, a, b, ...crop.map(String)]);
return stdout.trim() === '1';
};
await capture(connection, output, log, 'stop-rotation-a'); const normalA = log.captures.at(-1);
await sleep(1000);
await capture(connection, output, log, 'stop-rotation-b'); const normalB = log.captures.at(-1);
assert.ok(await differs(normalA, normalB), 'Stop glyph rotates continuously');
const after = (await connection.send('DOM.getBoxModel', { backendNodeId: stop.backendDOMNodeId })).model.content;
assert.deepEqual(after, box, 'Stop hit target stays fixed');
log.checks.push('Stop rotates while processing with an unchanged hit target');
await connection.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: 'reduce' }] });
await sleep(500);
await capture(connection, output, log, 'stop-reduced-motion-a'); const reducedA = log.captures.at(-1);
await sleep(1000);
await capture(connection, output, log, 'stop-reduced-motion-b'); const reducedB = log.captures.at(-1);
assert.ok(!await differs(reducedA, reducedB), 'Reduced motion keeps Stop static');
log.checks.push('system reduced motion stops the rotation');
await connection.send('Emulation.setEmulatedMedia', { features: [{ name: 'prefers-reduced-motion', value: 'no-preference' }] });
}
const field = (await axNodes(connection)).find(node => node.role?.value === 'textbox');
assert.ok(field, 'composer text field');
const { model } = await connection.send('DOM.getBoxModel', { backendNodeId: field.backendDOMNodeId });