web: keep empty composer on one line and verify touch sizing

This commit is contained in:
2026-10-20 18:54:45 +01:00
parent 7e9b6771ef
commit 9f5437b5b0
4 changed files with 30 additions and 5 deletions
+4
View File
@@ -186,6 +186,10 @@ export async function launchChrome({ width = 1440, height = 900, chromePath } =
const api = {
targetId,
/** Emulate pointer capability only; this is not an OS keyboard test. */
async emulateTouch(enabled = true) {
await session("Emulation.setTouchEmulationEnabled", { enabled, maxTouchPoints: 1 });
},
/** Resize the emulated viewport at the driver's fixed device scale. */
async resize(width, height) {
await session("Emulation.setDeviceMetricsOverride", {
+14 -1
View File
@@ -70,7 +70,8 @@ try {
await page.resize(width,900);
await page.goto(`http://127.0.0.1:${server.address().port}/`);
await page.waitForSelector('#chatInput');
await capture(`empty-${width}`);
const empty=await capture(`empty-${width}`);
if(!before) assert.equal(empty.input.height,empty.send.height,'empty placeholder must fit one aligned line');
await page.fill('#chatInput','Review this draft');
await capture(`single-${width}`);
await page.fill('#chatInput','First draft line\nSecond draft line\nThird draft line');
@@ -107,6 +108,18 @@ try {
await page.evaluate('setAttachment()');
await capture(`attachment-${width}`);
}
if(!before) {
await page.emulateTouch(true);
for(const width of [390,420]) {
await page.resize(width,900);await page.goto(`http://127.0.0.1:${server.address().port}/`);await page.waitForSelector('#chatInput');
assert.equal(await page.evaluate("matchMedia('(any-pointer: coarse)').matches"),true);
const touch=await capture(`touch-empty-${width}`);
assert.equal(touch.send.width,48);assert.equal(touch.input.height,48);
await page.evaluate('setRunning(true)');
const running=await capture(`touch-running-${width}`);
assert.equal(running.stop.width,48);assert.deepEqual(running.input,touch.input);
}
}
await writeFile(resolve(out,'geometry.json'),JSON.stringify(measurements,null,2));
console.log(`${measurements.length} scratch captures and geometry: ${out}`);
} finally {