mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
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
This commit is contained in:
1 parent
7336b7fcc5
commit
e23ef8b3ec
2 files changed
+12
-4
No files matched your search
@@ -257,7 +257,7 @@ mod tests {
|
|||||||
let lines = std::sync::Mutex::new(Vec::<String>::new());
|
let lines = std::sync::Mutex::new(Vec::<String>::new());
|
||||||
let result =
|
let result =
|
||||||
with_fake_launcher("ok", "console.log('line1'); console.log('line2');", || {
|
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())
|
lines.lock().unwrap().push(line.to_string())
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
@@ -273,7 +273,7 @@ mod tests {
|
|||||||
let result = with_fake_launcher(
|
let result = with_fake_launcher(
|
||||||
"tag",
|
"tag",
|
||||||
"console.log(process.argv.slice(2).join(' '));",
|
"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()));
|
assert_eq!(result, Ok("update --tag v9.9.9".to_string()));
|
||||||
}
|
}
|
||||||
@@ -281,7 +281,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn run_update_fails_with_the_installer_s_own_last_line() {
|
fn run_update_fails_with_the_installer_s_own_last_line() {
|
||||||
let result = with_fake_launcher("fail", "console.log('oops'); process.exit(1);", || {
|
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()));
|
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() {
|
fn a_missing_launcher_is_an_error_not_a_panic() {
|
||||||
let result = with_fake_launcher("missing", "", || {
|
let result = with_fake_launcher("missing", "", || {
|
||||||
std::fs::remove_file(launcher_dir().unwrap().join("plan2code.js")).unwrap();
|
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"));
|
assert!(result.unwrap_err().contains("is missing"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,6 +186,14 @@ export async function fillBox(locator, text) {
|
|||||||
const box = locator.first();
|
const box = locator.first();
|
||||||
const isField = await box.evaluate((n) => Boolean(n.field)).catch(() => false);
|
const isField = await box.evaluate((n) => Boolean(n.field)).catch(() => false);
|
||||||
if (!isField) return box.fill(text);
|
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) => {
|
await box.evaluate((n, t) => {
|
||||||
n.field.value = t;
|
n.field.value = t;
|
||||||
n.field.emitInput();
|
n.field.emitInput();
|
||||||
|
|||||||
Reference in new issue
Block a user