From e23ef8b3ec0dd3f66d430d323c7580fed2e7d294 Mon Sep 17 00:00:00 2001 From: Justin Parker Date: Thu, 5 Nov 2026 17:55:13 -0800 Subject: [PATCH] Fix two Windows flakes: wait for a disabled Markdown field to open before filling it, and give the installer tests 60s for a slow runner AI Assisted --- plan2code-app/src-tauri/src/versions.rs | 8 ++++---- scripts/page-test-helpers.mjs | 8 ++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/plan2code-app/src-tauri/src/versions.rs b/plan2code-app/src-tauri/src/versions.rs index bb3d623..e660552 100644 --- a/plan2code-app/src-tauri/src/versions.rs +++ b/plan2code-app/src-tauri/src/versions.rs @@ -257,7 +257,7 @@ mod tests { let lines = std::sync::Mutex::new(Vec::::new()); let result = with_fake_launcher("ok", "console.log('line1'); console.log('line2');", || { - run_update_within("9.9.9", Duration::from_secs(10), |line| { + run_update_within("9.9.9", Duration::from_secs(60), |line| { lines.lock().unwrap().push(line.to_string()) }) }); @@ -273,7 +273,7 @@ mod tests { let result = with_fake_launcher( "tag", "console.log(process.argv.slice(2).join(' '));", - || run_update_within("9.9.9", Duration::from_secs(10), |_| {}), + || run_update_within("9.9.9", Duration::from_secs(60), |_| {}), ); assert_eq!(result, Ok("update --tag v9.9.9".to_string())); } @@ -281,7 +281,7 @@ mod tests { #[test] fn run_update_fails_with_the_installer_s_own_last_line() { let result = with_fake_launcher("fail", "console.log('oops'); process.exit(1);", || { - run_update_within("9.9.9", Duration::from_secs(10), |_| {}) + run_update_within("9.9.9", Duration::from_secs(60), |_| {}) }); assert_eq!(result, Err("the update did not finish: oops".to_string())); } @@ -298,7 +298,7 @@ mod tests { fn a_missing_launcher_is_an_error_not_a_panic() { let result = with_fake_launcher("missing", "", || { std::fs::remove_file(launcher_dir().unwrap().join("plan2code.js")).unwrap(); - run_update_within("9.9.9", Duration::from_secs(10), |_| {}) + run_update_within("9.9.9", Duration::from_secs(60), |_| {}) }); assert!(result.unwrap_err().contains("is missing")); } diff --git a/scripts/page-test-helpers.mjs b/scripts/page-test-helpers.mjs index 09d17f0..d95042e 100644 --- a/scripts/page-test-helpers.mjs +++ b/scripts/page-test-helpers.mjs @@ -186,6 +186,14 @@ export async function fillBox(locator, text) { const box = locator.first(); const isField = await box.evaluate((n) => Boolean(n.field)).catch(() => false); if (!isField) return box.fill(text); + // A field is drawn disabled until the page knows the agent's state (the Ask box, for one), + // and a disabled field drops what is typed into it, leaving Send off for good: give it a + // moment to open, on whichever element the box is by then. + for (let i = 0; i < 200; i++) { + const open = await box.evaluate((n) => n.isConnected && !n.classList.contains("is-disabled")).catch(() => false); + if (open) break; + await new Promise((r) => setTimeout(r, 50)); + } await box.evaluate((n, t) => { n.field.value = t; n.field.emitInput();