DeepSeek Harness Tauri 桌面版 | Only 8mb installer, zero environment setup, preset plugins, Windows / macOS / Linux.
feat(desktop): E2E 独占 WebView2 profile
hairyfd526dd6635bc
diff --git a/src-tauri/src/config/constants.rs b/src-tauri/src/config/constants.rsindex 64b36721..64a5c165 100644--- a/src-tauri/src/config/constants.rs+++ b/src-tauri/src/config/constants.rs@@ -121,6 +121,14 @@ pub const E2E_DISABLE_DOWNLOAD_ENV_VAR: &str = "DSH_E2E_DISABLE_DOWNLOAD";/// 环境(Node/pnpm/Git)与核心都装在该根下。E2E 每次使用全新 scratch home,/// 若不覆盖就会反复重下;把它指向一个稳定目录即可让首次下载在后续运行中复用。pub const DOWNLOAD_CACHE_ENV_VAR: &str = "DSH_DOWNLOAD_CACHE_DIR";++/// WebView2 用户数据目录的环境变量:仅在 E2E 运行中生效。+///+/// `app_local_data_dir()` 由 `SHGetKnownFolderPath` 解析,重定向 `LOCALAPPDATA`+/// 无效,因此 debug 构建的 WebView2 profile(`EBWebView-dev`,内含 localStorage)+/// 会与用户正在使用的开发版共用:E2E 写入的语言等前端状态会污染开发会话,用例+/// 之间也会互相串。E2E 把它指向 scratch home 即可每次运行独占。+pub const E2E_WEBVIEW_DATA_DIR_ENV_VAR: &str = "DSH_E2E_WEBVIEW_DATA_DIR";pub const STORE_SETTING_KEY: &str = "setting";/// Store 中记录主窗口几何(位置/大小/最大化)的键pub const STORE_WINDOW_STATE_KEY: &str = "window_state";diff --git a/src-tauri/src/desktop/builder.rs b/src-tauri/src/desktop/builder.rsindex fbcdb91b..dbfc4478 100644--- a/src-tauri/src/desktop/builder.rs+++ b/src-tauri/src/desktop/builder.rs@@ -76,6 +76,17 @@ static EXTRA_WINDOW_SEQ: AtomicU64 = AtomicU64::new(0);/// 使用不同的 User Data Folder 而失败。开发版与 release 分目录的原因见主窗口。#[cfg(windows)]fn webview_data_directory(app: &tauri::AppHandle<Wry>) -> std::path::PathBuf {+ // E2E 独占 profile:`app_local_data_dir()` 走 `SHGetKnownFolderPath`,重定向+ // `LOCALAPPDATA` 无效,不覆盖就会与用户正在使用的开发版共用 `EBWebView-dev`+ // (localStorage 等前端状态互相污染)。+ if crate::config::is_e2e_run() {+ if let Some(dir) = std::env::var_os(crate::config::E2E_WEBVIEW_DATA_DIR_ENV_VAR) {+ if !dir.is_empty() {+ return std::path::PathBuf::from(dir);+ }+ }+ }+let mut directory = app.path().app_local_data_dir()