From dd890a93a3671694356b3099c2c61d58a58e4909 Mon Sep 17 00:00:00 2001 From: Alan Silva Date: Thu, 22 Oct 2026 11:48:04 +0100 Subject: [PATCH] test(app): find the composer field instead of a fixed point --- app/tool/runs_probe.mjs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/app/tool/runs_probe.mjs b/app/tool/runs_probe.mjs index 486c5558..37a9badb 100644 --- a/app/tool/runs_probe.mjs +++ b/app/tool/runs_probe.mjs @@ -532,12 +532,23 @@ try { await clickText('Chat'); await clickText('Probe conversation', { contains: true }); await assertBody('User message'); - // The empty composer exposes a hint, not an accessible label, so focus it by - // clicking its visible strip above the navigation bar; JS focus alone is not - // Flutter's editing connection and would swallow the text. + // The empty composer exposes a hint, not an accessible label. Locate the + // semantics text field and click its centre: a fixed point misses once an + // attachment strip grows the composer, and JS focus alone is not Flutter's + // editing connection. + const composerPoint = await evaluate(`(() => { + const fields = [...document.querySelectorAll('flt-semantics[role="textbox"], input, textarea')]; + const rects = fields + .map((el) => el.getBoundingClientRect()) + .filter((r) => r.width > 40 && r.height > 10); + if (!rects.length) return null; + const lowest = rects.sort((a, b) => b.bottom - a.bottom)[0]; + return { x: lowest.left + lowest.width / 2, y: lowest.top + lowest.height / 2 }; + })()`); + if (!composerPoint) throw new Error('The composer text field is not exposed'); for (const type of ['mousePressed', 'mouseReleased']) { await send('Input.dispatchMouseEvent', { - type, x: 150, y: 700, button: 'left', clickCount: 1, + type, x: composerPoint.x, y: composerPoint.y, button: 'left', clickCount: 1, }, session); } await delay(400);