Przeglądaj źródła

feat: add webdriver options for windows (#8609)

* feat: add webdriver options for windows

* add change file, camel case

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
thewh1teagle 1 rok temu
rodzic
commit
435d7513e4

+ 5 - 0
.changes/webdriver-webview-options.md

@@ -0,0 +1,5 @@
+---
+"tauri-driver": patch:feat
+---
+
+Added `webviewOptions` object to the `tauri:options` capability to configure the [Edge webview options](https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/capabilities-edge-options#webviewoptions-object) on Windows.

+ 5 - 1
tooling/webdriver/src/server.rs

@@ -20,10 +20,14 @@ type HttpClient = Client<hyper::client::HttpConnector>;
 const TAURI_OPTIONS: &str = "tauri:options";
 
 #[derive(Debug, Deserialize)]
+#[serde(rename_all = "camelCase")]
 struct TauriOptions {
   application: PathBuf,
   #[serde(default)]
   args: Vec<String>,
+  #[cfg(target_os = "windows")]
+  #[serde(default)]
+  webview_options: Option<Value>,
 }
 
 impl TauriOptions {
@@ -44,7 +48,7 @@ impl TauriOptions {
     map.insert("browserName".into(), json!("webview2"));
     map.insert(
       "ms:edgeOptions".into(),
-      json!({"binary": self.application, "args": self.args}),
+      json!({"binary": self.application, "args": self.args, "webviewOptions": self.webview_options}),
     );
     map
   }