diff --git a/.changes/webdriver-args.md b/.changes/webdriver-args.md new file mode 100644 index 000000000..7296a4bbe --- /dev/null +++ b/.changes/webdriver-args.md @@ -0,0 +1,5 @@ +--- +"tauri-driver": patch +--- + +Add `args` field (array of application CLI arguments) to the `tauri:options` capabilities. diff --git a/docs/usage/guides/webdriver/example/selenium.md b/docs/usage/guides/webdriver/example/selenium.md index 361973dda..77478b919 100644 --- a/docs/usage/guides/webdriver/example/selenium.md +++ b/docs/usage/guides/webdriver/example/selenium.md @@ -148,7 +148,7 @@ before(async function() { ); const capabilities = new Capabilities(); - capabilities.set("tauri:options", { application }); + capabilities.set("tauri:options", { application, args: ["app", "cli", "args"] }); capabilities.setBrowserName("wry"); // start the webdriver client diff --git a/docs/usage/guides/webdriver/example/webdriverio.md b/docs/usage/guides/webdriver/example/webdriverio.md index 3697f914c..d0d262721 100644 --- a/docs/usage/guides/webdriver/example/webdriverio.md +++ b/docs/usage/guides/webdriver/example/webdriverio.md @@ -128,6 +128,7 @@ exports.config = { maxInstances: 1, "tauri:options": { application: "../../target/release/hello-tauri-webdriver", + args: ["app", "cli", "args"] }, }, ], diff --git a/tooling/webdriver/src/server.rs b/tooling/webdriver/src/server.rs index 15c44c399..be87e238a 100644 --- a/tooling/webdriver/src/server.rs +++ b/tooling/webdriver/src/server.rs @@ -22,6 +22,8 @@ const TAURI_OPTIONS: &str = "tauri:options"; #[derive(Debug, Deserialize)] struct TauriOptions { application: PathBuf, + #[serde(default)] + args: Vec, } impl TauriOptions { @@ -30,7 +32,7 @@ impl TauriOptions { let mut map = Map::new(); map.insert( "webkitgtk:browserOptions".into(), - json!({"binary": self.application}), + json!({"binary": self.application, "args": self.args}), ); map } @@ -40,7 +42,10 @@ impl TauriOptions { let mut map = Map::new(); map.insert("ms:edgeChromium".into(), json!(true)); map.insert("browserName".into(), json!("webview2")); - map.insert("ms:edgeOptions".into(), json!({"binary": self.application})); + map.insert( + "ms:edgeOptions".into(), + json!({"binary": self.application, "args": self.args}), + ); map } }