Skip to content

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

test(e2e): make the second composer polish prove its rewrite

Tioit-Wang9203877fa027
diff --git a/apps/desktop/test/e2e/plugin-ui-slots/composer-draft.mjs b/apps/desktop/test/e2e/plugin-ui-slots/composer-draft.mjs
index 8e7dd43b3..bdadc1c6b 100644
--- a/apps/desktop/test/e2e/plugin-ui-slots/composer-draft.mjs
+++ b/apps/desktop/test/e2e/plugin-ui-slots/composer-draft.mjs
@@ -141,8 +141,20 @@ export async function driveComposerDraft({ renderer, check }) {
JSON.stringify({ polished, afterPolish }),
);
await renderer.click(button(DRAFT, "draft-polish"));
- const again = await outcome(DRAFT, "the second polish", (out) => out.status === "ok" && out.text !== polished.text);
- check("polishing again keeps a single stamp", stamps(await view()) === 1, JSON.stringify(again));
+ // The accept predicate runs in the page, so the first answer travels in as
+ // a literal: a Node-side binding would be undefined there and the check
+ // would pass on an error instead of on the second rewrite.
+ const firstPolish = JSON.stringify(polished.text);
+ const again = await outcome(
+ DRAFT,
+ "the second polish",
+ `(out) => out.status === "ok" && out.text !== ${firstPolish}`,
+ );
+ check(
+ "polishing again keeps a single stamp",
+ again.status === "ok" && stamps(await view()) === 1,
+ JSON.stringify(again),
+ );
const unchanged = (await view()).text;
await renderer.click(button(DRAFT, "draft-polish-late"));