Skip to content

Commit

Permalink
feat(driver): add args to tauri:options (#3154)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog committed Jan 3, 2022
1 parent 4c1be45 commit d0970e3
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changes/webdriver-args.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri-driver": patch
---

Add `args` field (array of application CLI arguments) to the `tauri:options` capabilities.
2 changes: 1 addition & 1 deletion docs/usage/guides/webdriver/example/selenium.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions docs/usage/guides/webdriver/example/webdriverio.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ exports.config = {
maxInstances: 1,
"tauri:options": {
application: "../../target/release/hello-tauri-webdriver",
args: ["app", "cli", "args"]
},
},
],
Expand Down
9 changes: 7 additions & 2 deletions tooling/webdriver/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ const TAURI_OPTIONS: &str = "tauri:options";
#[derive(Debug, Deserialize)]
struct TauriOptions {
application: PathBuf,
#[serde(default)]
args: Vec<String>,
}

impl TauriOptions {
Expand All @@ -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
}
Expand All @@ -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
}
}
Expand Down

0 comments on commit d0970e3

Please sign in to comment.