Skip to content

Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins

test(composer): await native keyboard completion

yuxino69f1ca216d4c
diff --git a/scripts/e2e-composer-paste.mjs b/scripts/e2e-composer-paste.mjs
index 5bd8d3852..70e44a736 100644
--- a/scripts/e2e-composer-paste.mjs
+++ b/scripts/e2e-composer-paste.mjs
@@ -120,9 +120,8 @@ app.whenReady().then(async () => {
assert(["Escape", "Tab"].includes(key));
window.webContents.sendInputEvent({ type: "keyDown", keyCode: key });
window.webContents.sendInputEvent({ type: "keyUp", keyCode: key });
- await window.webContents.executeJavaScript("globalThis.composerPreviewKeyDone()");
});
- await window.webContents.executeJavaScript('globalThis.composerPreviewPressKey = key => new Promise(resolve => { globalThis.composerPreviewKeyDone = resolve; console.log("PI_PREVIEW_KEY:" + key); }); void 0');
+ await window.webContents.executeJavaScript('globalThis.composerPreviewPressKey = key => new Promise(resolve => { document.addEventListener("keyup", () => requestAnimationFrame(resolve), { once: true }); console.log("PI_PREVIEW_KEY:" + key); }); void 0');
if (process.env.PI_COMPOSER_PREVIEW_SCREENSHOT) {
window.webContents.on("console-message", async (event) => {
if (event.message !== "PI_PREVIEW_CAPTURE") return;