S007: network smoke tests, local test server, selftest cancel_download, @HOME@ in smoke scripts

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
astar76 2026-11-12 10:26:07 -06:00
commit 5389719c98

View file

@ -19,7 +19,8 @@
//! do <action> a shortcut action by its settings key, e.g. `do new_tab`
//! cmd <name> [arg] back, forward, reload, bookmark, install_app, pip, exitpip, free_memory,
//! update_lists, check_updates, close_tab, select <n>, zoom <step>,
//! find <text>, download <url>, navigate <typed text>, mute, pin
//! find <text>, download <url>, pause_download|resume_download|cancel_download [id] (newest),
//! navigate <typed text>, mute, pin
//! js <script> run JavaScript in the current tab; the result goes to the log
//! assert <js expression> the expression must give true, else `ASSERT FAILED` in the log fails the smoke run
//! expect <pointer> <json> a value of the `status` JSON must equal json (e.g. `expect /tabs/1/pinned true`;
@ -305,6 +306,7 @@ impl App {
let (name, arg) = rest.split_once(char::is_whitespace).map(|(n, a)| (n, a.trim())).unwrap_or((rest, ""));
let tab = self.windows.get(&window).and_then(|w| w.tab()).map(|t| t.id).unwrap_or(0);
let page = self.windows.get(&window).and_then(|w| w.tab()).map(|t| t.url.clone()).unwrap_or_default();
let newest = self.shared.downloads.borrow().items.first().map(|d| d.id).unwrap_or(1);
let command = match name {
"back" => Command::Back,
"forward" => Command::Forward,
@ -321,8 +323,9 @@ impl App {
"zoom" => Command::Zoom(arg.parse().unwrap_or(1)),
"find" => Command::Find { text: arg.to_owned(), forward: true, case: false },
"download" => Command::DownloadUrl { url: arg.to_owned(), page, name: String::new() },
"pause_download" => Command::Download(DownloadOp::Pause(arg.parse().unwrap_or(1))),
"resume_download" => Command::Download(DownloadOp::Resume(arg.parse().unwrap_or(1))),
"pause_download" => Command::Download(DownloadOp::Pause(arg.parse().unwrap_or(newest))),
"resume_download" => Command::Download(DownloadOp::Resume(arg.parse().unwrap_or(newest))),
"cancel_download" => Command::Download(DownloadOp::Cancel(arg.parse().unwrap_or(newest))),
"navigate" => Command::Navigate(arg.to_owned()),
"mute" => Command::MuteTab(tab),
"pin" => Command::PinTab(tab),