S008: user scripts/styles and site-app smoke
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
parent
347d32b2fc
commit
f9d0f0d338
5 changed files with 59 additions and 1 deletions
|
|
@ -15,7 +15,7 @@ Verify passwords/vault and autofill, permissions prompts, history/bookmarks/down
|
|||
- [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
|
||||
- [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
|
||||
- [x] 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
|
||||
- [ ] Change a sample of settings via `set` and via clicks; check `settings.json` and the effect; mark FEATURES rows
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
//! 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>, pause_download|resume_download|cancel_download [id] (newest),
|
||||
//! install_script <url> (a .user.js / .user.css), open_app [id] (default: the first installed app),
|
||||
//! 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
|
||||
|
|
@ -401,6 +402,8 @@ impl App {
|
|||
"mute" => Command::MuteTab(tab),
|
||||
"pin" => Command::PinTab(tab),
|
||||
"reopen" => Command::ReopenClosed(None),
|
||||
"install_script" => Command::InstallScript(arg.to_owned()),
|
||||
"open_app" => Command::OpenApp(if arg.is_empty() { self.shared.apps.borrow().items.first().map(|a| a.id.clone()).unwrap_or_default() } else { arg.to_owned() }),
|
||||
"media" => Command::Media { tab, action: arg.to_owned(), value: 0.0 },
|
||||
_ => {
|
||||
self.selftest_log(&format!("unknown cmd {name}"));
|
||||
|
|
@ -763,6 +766,7 @@ impl App {
|
|||
"vault_locked": self.shared.vault.borrow().locked(),
|
||||
"vault_mode": format!("{:?}", self.shared.vault.borrow().mode()),
|
||||
"apps": self.shared.apps.borrow().items.len(),
|
||||
"scripts": self.shared.scripts.borrow().items.len(),
|
||||
"dlm": format!("{:?}", self.shared.dlm_status.borrow()),
|
||||
"discord": self.shared.presence_status.borrow().clone(),
|
||||
"spell": self.shared.spell_status.borrow().clone(),
|
||||
|
|
|
|||
5
tests/smoke/pages/probe.user.css
Normal file
5
tests/smoke/pages/probe.user.css
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* ==UserStyle==
|
||||
@name Smoke probe style
|
||||
@match http://127.0.0.1:8768/*
|
||||
==/UserStyle== */
|
||||
body { background-color: rgb(18, 52, 86) !important; }
|
||||
8
tests/smoke/pages/probe.user.js
Normal file
8
tests/smoke/pages/probe.user.js
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// ==UserScript==
|
||||
// @name Smoke probe script
|
||||
// @description tests/smoke/stores-apps.txt
|
||||
// @version 1
|
||||
// @match http://127.0.0.1:8768/*
|
||||
// @run-at document-end
|
||||
// ==/UserScript==
|
||||
window.userScriptRan = true;
|
||||
41
tests/smoke/stores-apps.txt
Normal file
41
tests/smoke/stores-apps.txt
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
# Stores pass (S008): user scripts and styles run on matching pages only; install a site as an app and open its window.
|
||||
# Offline. Start the servers first:
|
||||
# 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-apps.txt <outdir>
|
||||
wait 3
|
||||
cmd install_script http://127.0.0.1:8768/probe.user.js
|
||||
cmd install_script http://127.0.0.1:8768/probe.user.css
|
||||
wait 3
|
||||
status installed
|
||||
expect /scripts 2
|
||||
# Matching page: both run. Non-matching page (other port): neither does.
|
||||
open http://127.0.0.1:8768/hello.html
|
||||
waitload
|
||||
wait 2
|
||||
assert window.userScriptRan === true
|
||||
assert getComputedStyle(document.body).backgroundColor === 'rgb(18, 52, 86)'
|
||||
shot user-content-on
|
||||
open http://127.0.0.1:8766/
|
||||
waitload
|
||||
wait 2
|
||||
assert window.userScriptRan === undefined
|
||||
assert getComputedStyle(document.body).backgroundColor !== 'rgb(18, 52, 86)'
|
||||
# Install the page as an app, open its window.
|
||||
open http://127.0.0.1:8768/hello.html
|
||||
waitload
|
||||
wait 2
|
||||
cmd install_app
|
||||
wait 1
|
||||
status app
|
||||
expect /apps 1
|
||||
cmd open_app
|
||||
wait 4
|
||||
status app-window
|
||||
expect /windows 2
|
||||
shot app-window
|
||||
page nacre://apps
|
||||
wait 1
|
||||
shot apps-page
|
||||
status done
|
||||
quit
|
||||
Loading…
Reference in a new issue