Verify that typed text actually arrived
typeText fired Input.insertText per character and never looked back, so a partially typed value was indistinguishable from a wrong one: a run committed x=3 for "300" and the failing check blamed the value rather than the three lost characters. Trying to reproduce that failed over 21 rounds across four variants (no pause, 400ms between characters, with the preceding scrub, and both commit paths), and the code rules out the obvious suspects: typing lands in a hidden input, each character is only a preview, objectSignature omits position so no rebuild is triggered, and NumberField.setNumber guards write-back with isEditing. Cause unknown, so this makes the symptom name itself instead of hardening against a mechanism that may not exist. Typing stays per character - that exercises the live-preview and search-filter paths - but now asserts the text is in the focused input, reporting focus and actual contents when it is not. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
c256859854
commit
3d038e11cb
1 file changed
+12
@@ -192,8 +192,20 @@ function makeTools({ cdp, projectId, baseUrl, consoleLog, check, shotPrefix }) {
|
||||
await sleep(ms);
|
||||
await keyEvent('keyUp', name);
|
||||
};
|
||||
/**
|
||||
* Typed per character to exercise the per-keystroke paths (live preview, search filters), then
|
||||
* verified: a partial type is otherwise indistinguishable from a wrong value – a run once
|
||||
* committed x=3 for "300" and the check blamed the value, not the lost characters.
|
||||
*/
|
||||
const typeText = async (text) => {
|
||||
for (const ch of text) await cdp.send('Input.insertText', { text: ch });
|
||||
const typed = await json(
|
||||
'({ tag: document.activeElement?.tagName, value: document.activeElement?.value })',
|
||||
);
|
||||
if (typed.tag !== 'INPUT' || !String(typed.value ?? '').includes(text))
|
||||
throw new Error(
|
||||
`typing "${text}" did not arrive: focus is ${typed.tag}, it holds ${JSON.stringify(typed.value)}`,
|
||||
);
|
||||
};
|
||||
const undo = async () => {
|
||||
await press('z', { ctrl: true });
|
||||
|
||||
Reference in new issue
Block a user