mirror of
https://github.com/Tencent/BrowserSkill.git
synced 2026-09-10 13:01:23 +08:00
feat(record): add popup quick-actions launcher and make record --url optional
Add a popup launcher + action-recording panel that builds a copyable `bsk record start` prompt, add `--browser` targeting, and default `--url` to https://example.com/ when omitted. Drop the popup browser-alias field.
This commit is contained in:
@@ -4,6 +4,7 @@ use std::time::Duration;
|
||||
|
||||
use bsk::cli::daemon::{DaemonCmd, parse_duration};
|
||||
use bsk::cli::navigate::NavigateCmd;
|
||||
use bsk::cli::record::{RecordCmd, RecordSub};
|
||||
use bsk::{Cli, Command};
|
||||
use clap::Parser;
|
||||
|
||||
@@ -192,3 +193,37 @@ fn rejects_zero_click_count() {
|
||||
Cli::try_parse_from(["bsk", "click", "@e1", "--session", "s1", "--count", "0"]).is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_record_start_with_browser_and_url() {
|
||||
let cli = parse(&[
|
||||
"bsk",
|
||||
"record",
|
||||
"start",
|
||||
"--browser",
|
||||
"022ca8ac",
|
||||
"--url",
|
||||
"https://x",
|
||||
]);
|
||||
let Command::Record(RecordCmd {
|
||||
sub: RecordSub::Start(args),
|
||||
}) = cli.command
|
||||
else {
|
||||
panic!("expected record start subcommand");
|
||||
};
|
||||
assert_eq!(args.browser.as_deref(), Some("022ca8ac"));
|
||||
assert_eq!(args.url.as_deref(), Some("https://x"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parses_record_start_without_url() {
|
||||
let cli = parse(&["bsk", "record", "start", "--browser", "022ca8ac"]);
|
||||
let Command::Record(RecordCmd {
|
||||
sub: RecordSub::Start(args),
|
||||
}) = cli.command
|
||||
else {
|
||||
panic!("expected record start subcommand");
|
||||
};
|
||||
assert_eq!(args.browser.as_deref(), Some("022ca8ac"));
|
||||
assert!(args.url.is_none());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user