S008: history, bookmarks, downloads smoke with restart
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
b54d1a828e
commit
8cd424f8df
5 changed files with 103 additions and 1 deletions
|
|
@ -14,7 +14,7 @@ Verify passwords/vault and autofill, permissions prompts, history/bookmarks/down
|
|||
- [x] Script: open every nacre:// page and take a shot; check none panics or renders empty
|
||||
- [x] Vault: create, lock/unlock, save a login from a local form page, autofill it, export/import; check the vault file is encrypted
|
||||
- [x] Permissions: a local page asking for notifications/geolocation/camera; allow/deny/remember; check `permissions` store
|
||||
- [ ] History, bookmarks (add, folder, bookmarks bar, import/export HTML), downloads page lists entries
|
||||
- [x] History, bookmarks (add, folder, bookmarks bar, import/export HTML), downloads page lists entries
|
||||
- [ ] User scripts/styles apply on matching pages; install a site as an app and launch it
|
||||
- [ ] Importer: build a fake old-Nacre profile from `~/Documents/Apps/Nacre` config format in a temp dir (never the user's real profile) and import it
|
||||
- [x] R1-20 per-site memory and enforcement: set per-site zoom, ad blocker on/off, privacy-mode flag (flag persistence only; internals are D-011) and other per-site choices; set per-site permissions (camera, mic, location, notifications, pop-ups, autoplay, …); quit, relaunch with `SMOKE_HOME=<first outdir>/home`, check values are in the stores and apply again on reopening the site; check each permission is enforced (blocked/allowed/asked per its stored value), not only stored; fix what is not
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
//! perm <host> <kind> allow|block|default store a site's answer for a permission (kinds: store::permissions::Kind keys)
|
||||
//! prompt allow|deny [remember] answer the active tab's first permission prompt
|
||||
//! vault master <pw> | lock | unlock <pw> | remove_master | export <file> | import <file> the password vault
|
||||
//! bookmarks folder <name> | export <file> | import <file> a folder on the bar; the Netscape HTML file (what the page's buttons do)
|
||||
//! flyout <name> main, downloads, shield, vpn, media, siteinfo, profiles, apps, qr, tabmenu, back,
|
||||
//! bookmark (edit the current page's bookmark), none
|
||||
//! type <text> put text in the address bar with its suggestions open
|
||||
|
|
@ -315,6 +316,26 @@ impl App {
|
|||
Err(error) => self.selftest_log(&format!("vault {what}: {error}")),
|
||||
}
|
||||
},
|
||||
"bookmarks" => {
|
||||
let (what, arg) = rest.split_once(char::is_whitespace).map(|(w, a)| (w, a.trim())).unwrap_or((rest, ""));
|
||||
let mut bookmarks = self.shared.bookmarks.borrow_mut();
|
||||
let note = match what {
|
||||
"folder" => {
|
||||
bookmarks.add_folder(crate::store::bookmarks::BAR, arg);
|
||||
String::new()
|
||||
},
|
||||
"export" => std::fs::write(arg, bookmarks.export_html()).map(|_| String::new()).unwrap_or_else(|e| format!("bookmarks export: {e}")),
|
||||
"import" => match std::fs::read_to_string(arg) {
|
||||
Ok(text) => format!("imported {} bookmarks", bookmarks.import_html(&text, "file")),
|
||||
Err(error) => format!("bookmarks import: {error}"),
|
||||
},
|
||||
_ => format!("unknown bookmarks command {what}"),
|
||||
};
|
||||
drop(bookmarks);
|
||||
if !note.is_empty() {
|
||||
self.selftest_log(¬e);
|
||||
}
|
||||
},
|
||||
"prompt" => {
|
||||
let remember = rest.contains("remember");
|
||||
let answer = if rest.starts_with("allow") { crate::actions::PromptAnswer::Allow { remember } } else { crate::actions::PromptAnswer::Deny { remember } };
|
||||
|
|
@ -712,6 +733,10 @@ impl App {
|
|||
times.sort_by(f32::total_cmp);
|
||||
serde_json::json!({"count": times.len(), "median_ms": times.get(times.len() / 2), "max_ms": times.last(), "drawn": w.frames_drawn})
|
||||
});
|
||||
let bookmark_folders = {
|
||||
let b = self.shared.bookmarks.borrow();
|
||||
[crate::store::bookmarks::BAR, crate::store::bookmarks::OTHER].iter().filter_map(|id| b.get(*id)).map(|n| n.children.iter().filter(|c| c.is_folder()).count()).sum::<usize>()
|
||||
};
|
||||
serde_json::json!({
|
||||
"windows": self.windows.len(),
|
||||
"tab_count": tabs.len(),
|
||||
|
|
@ -733,6 +758,7 @@ impl App {
|
|||
"site_state": {"zoom_sites": settings.web.zoom_sites, "adblock_allow": settings.adblock.allow, "keep_active": settings.perf.keep_active, "muted_sites": settings.media.muted_sites, "https_exceptions": settings.privacy.https_exceptions},
|
||||
"history": self.shared.history.borrow().len(),
|
||||
"bookmarks": self.shared.bookmarks.borrow().all().len(),
|
||||
"bookmark_folders": bookmark_folders,
|
||||
"logins": self.shared.vault.borrow().contents.logins.len(),
|
||||
"vault_locked": self.shared.vault.borrow().locked(),
|
||||
"vault_mode": format!("{:?}", self.shared.vault.borrow().mode()),
|
||||
|
|
|
|||
15
tests/smoke/pages/chrome-bookmarks.html
Normal file
15
tests/smoke/pages/chrome-bookmarks.html
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<!DOCTYPE NETSCAPE-Bookmark-file-1>
|
||||
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
|
||||
<TITLE>Bookmarks</TITLE>
|
||||
<H1>Bookmarks</H1>
|
||||
<DL><p>
|
||||
<DT><H3 ADD_DATE="1700000000" PERSONAL_TOOLBAR_FOLDER="true">Bookmarks bar</H3>
|
||||
<DL><p>
|
||||
<DT><A HREF="https://bar.example/" ADD_DATE="1700000000">On the bar</A>
|
||||
</DL><p>
|
||||
<DT><H3 ADD_DATE="1700000000">Reading</H3>
|
||||
<DL><p>
|
||||
<DT><A HREF="https://read.example/a" ADD_DATE="1700000000">Article A</A>
|
||||
<DT><A HREF="https://read.example/b" ADD_DATE="1700000000">Article B & more</A>
|
||||
</DL><p>
|
||||
</DL><p>
|
||||
12
tests/smoke/stores-lists-restart.txt
Normal file
12
tests/smoke/stores-lists-restart.txt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
# Stores pass (S008), part 2: history, bookmarks and the finished download are still there after a restart.
|
||||
wait 3
|
||||
status back
|
||||
expect /history > 1
|
||||
expect /bookmarks 4
|
||||
expect /bookmark_folders 2
|
||||
expect /downloads/0/state "Done"
|
||||
page nacre://bookmarks
|
||||
wait 1
|
||||
shot bookmarks-restored
|
||||
status done
|
||||
quit
|
||||
49
tests/smoke/stores-lists.txt
Normal file
49
tests/smoke/stores-lists.txt
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# Stores pass (S008): history, bookmarks (add, folder, bar, Netscape HTML export/import), downloads page, and that all
|
||||
# of it is still there after a restart. Offline. Part 1 (hidden):
|
||||
# python3 -m http.server 8768 --bind 127.0.0.1 --directory tests/smoke/pages &
|
||||
# python3 tests/smoke/net/server.py &
|
||||
# tools/smoke.sh tests/smoke/stores-lists.txt <outdir>
|
||||
# Part 2: SMOKE_HOME=<outdir>/home tools/smoke.sh tests/smoke/stores-lists-restart.txt <outdir2>
|
||||
wait 3
|
||||
resize 1280 900
|
||||
open http://127.0.0.1:8768/hello.html
|
||||
waitload
|
||||
open http://127.0.0.1:8768/site.html
|
||||
waitload
|
||||
status visits
|
||||
expect /history > 1
|
||||
page nacre://history
|
||||
wait 1
|
||||
shot history
|
||||
# Bookmark the page, make a folder, show the bar.
|
||||
open http://127.0.0.1:8768/site.html
|
||||
waitload
|
||||
cmd bookmark
|
||||
wait 1
|
||||
flyout none
|
||||
bookmarks folder Work
|
||||
set /ui/bookmarks_bar "always"
|
||||
wait 1
|
||||
status marked
|
||||
expect /bookmarks 1
|
||||
expect /bookmark_folders 1
|
||||
shot bar
|
||||
# Export, then import a file in another browser's layout: 1 on the bar + 2 in a folder, then again adds nothing.
|
||||
bookmarks export @HOME@/bookmarks-export.html
|
||||
bookmarks import @PAGESDIR@/chrome-bookmarks.html
|
||||
bookmarks import @PAGESDIR@/chrome-bookmarks.html
|
||||
status imported
|
||||
expect /bookmarks 4
|
||||
page nacre://bookmarks
|
||||
wait 1
|
||||
shot bookmarks
|
||||
# Downloads: one finished file listed on the page.
|
||||
cmd download http://127.0.0.1:8766/file.zip
|
||||
wait 4
|
||||
status download
|
||||
expect /downloads/0/state "Done"
|
||||
page nacre://downloads
|
||||
wait 1
|
||||
shot downloads
|
||||
status done
|
||||
quit
|
||||
Loading…
Reference in a new issue