diff --git a/cli/src/commands.rs b/cli/src/commands.rs index dd99781..00baeb0 100644 --- a/cli/src/commands.rs +++ b/cli/src/commands.rs @@ -1141,14 +1141,10 @@ pub fn parse_command(args: &[String], flags: &Flags) -> Result", })?; let text = rest[1..].join(" "); - Ok( - json!({ "id": id, "action": "clipboard", "operation": "write", "text": text }), - ) + Ok(json!({ "id": id, "action": "clipboard", "operation": "write", "text": text })) } Some("copy") => Ok(json!({ "id": id, "action": "clipboard", "operation": "copy" })), - Some("paste") => { - Ok(json!({ "id": id, "action": "clipboard", "operation": "paste" })) - } + Some("paste") => Ok(json!({ "id": id, "action": "clipboard", "operation": "paste" })), Some(sub) => Err(ParseError::UnknownSubcommand { subcommand: sub.to_string(), valid_options: &["read", "write", "copy", "paste"], @@ -2804,8 +2800,11 @@ mod tests { #[test] fn test_wait_text_with_timeout() { - let cmd = - parse_command(&args("wait --text Welcome --timeout 5000"), &default_flags()).unwrap(); + let cmd = parse_command( + &args("wait --text Welcome --timeout 5000"), + &default_flags(), + ) + .unwrap(); assert_eq!(cmd["action"], "wait"); assert_eq!(cmd["text"], "Welcome"); assert_eq!(cmd["timeout"], 5000); diff --git a/src/actions.ts b/src/actions.ts index 9e07de5..e1b1c3e 100644 --- a/src/actions.ts +++ b/src/actions.ts @@ -956,8 +956,7 @@ async function handleWait(command: WaitCommand, browser: BrowserManager): Promis if (command.text) { await page.waitForFunction( - (t: string) => (document.body.innerText || '').includes(t), - command.text, + `(document.body.innerText || '').includes(${JSON.stringify(command.text)})`, { timeout: command.timeout } ); } else if (command.selector) {