Fix double node creation when picking a palette entry by click
- TextField: new onSubmit callback (Enter only, independent of value change) - NodePalette: use onSubmit instead of onChange, add per-open picked guard - e2e: new check 13a (type + click row -> exactly one node), wait for Chromium exit in finally with SIGKILL escalation after 5s Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
922774778b
commit
06b1007015
3 files changed
+48
-4
No files matched your search
+29
-2
@@ -362,8 +362,28 @@ try {
|
||||
const mulUndone = await nodeOf('n-mul');
|
||||
check('undo moves the node back', mulUndone.x === mulBefore.x && mulUndone.y === mulBefore.y, `${mulUndone.x},${mulUndone.y}`);
|
||||
|
||||
// 13b. Right-click the empty canvas → palette → search "log" → Enter adds a Log node.
|
||||
// 13a. Regression: typing a query and then *clicking* a row must add exactly one node.
|
||||
// (Previously the search field's blur-commit picked the first match and the row click
|
||||
// picked it again → two nodes.)
|
||||
const gcenter = JSON.parse(await evaluate(`JSON.stringify(__gm.graph.center())`));
|
||||
const beforeClickPick = await graphCounts();
|
||||
await click(gcenter.x + 250, gcenter.y + 250, 'right');
|
||||
await sleep(250);
|
||||
check('node palette opens (row-click case)', Boolean(await evaluate(`__gm.locate('Search nodes…')`)));
|
||||
await typeText('stop');
|
||||
await sleep(150);
|
||||
const stopRow = await locate('Stop game'); // unique on screen (nothing else on screen shows this label)
|
||||
await click(stopRow.x, stopRow.y);
|
||||
await sleep(250);
|
||||
const afterClickPick = await graphCounts();
|
||||
check('clicking a palette row adds exactly one node', afterClickPick.nodes === beforeClickPick.nodes + 1, JSON.stringify({ beforeClickPick, afterClickPick }));
|
||||
check('palette closed after row click', !(await evaluate(`__gm.locate('Search nodes…')`)));
|
||||
// Undo so 13b finds the same empty spot and the expected graph.
|
||||
await keyPress('z', 'KeyZ', { modifiers: 2, windowsVirtualKeyCode: 90 });
|
||||
await sleep(150);
|
||||
check('undo removes the clicked node again', (await graphCounts()).nodes === beforeClickPick.nodes);
|
||||
|
||||
// 13b. Right-click the empty canvas → palette → search "log" → Enter adds a Log node.
|
||||
const before13 = await graphCounts();
|
||||
await click(gcenter.x + 250, gcenter.y + 250, 'right');
|
||||
await sleep(250);
|
||||
@@ -433,7 +453,14 @@ try {
|
||||
console.error(error);
|
||||
failures++;
|
||||
} finally {
|
||||
chrome.kill('SIGTERM');
|
||||
// Wait for chromium to actually exit (a SwiftShader GPU process kept rendering at full CPU
|
||||
// once when only SIGTERM was sent); escalate to SIGKILL if it does not stop in time.
|
||||
await new Promise((resolve) => {
|
||||
if (chrome.exitCode !== null) return resolve();
|
||||
const timer = setTimeout(() => { chrome.kill('SIGKILL'); }, 5000);
|
||||
chrome.once('exit', () => { clearTimeout(timer); resolve(); });
|
||||
chrome.kill('SIGTERM');
|
||||
});
|
||||
}
|
||||
if (consoleLog.length) console.log('--- console ---\n' + consoleLog.slice(0, 20).join('\n'));
|
||||
process.exit(failures ? 1 : 0);
|
||||
Reference in new issue
Block a user