mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-03 10:11:15 +02:00
feat(driver): add args to tauri:options (#3154)
This commit is contained in:
committed by
GitHub
parent
4c1be45106
commit
d0970e3499
5
.changes/webdriver-args.md
Normal file
5
.changes/webdriver-args.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-driver": patch
|
||||
---
|
||||
|
||||
Add `args` field (array of application CLI arguments) to the `tauri:options` capabilities.
|
||||
@@ -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
|
||||
|
||||
@@ -128,6 +128,7 @@ exports.config = {
|
||||
maxInstances: 1,
|
||||
"tauri:options": {
|
||||
application: "../../target/release/hello-tauri-webdriver",
|
||||
args: ["app", "cli", "args"]
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
@@ -22,6 +22,8 @@ const TAURI_OPTIONS: &str = "tauri:options";
|
||||
#[derive(Debug, Deserialize)]
|
||||
struct TauriOptions {
|
||||
application: PathBuf,
|
||||
#[serde(default)]
|
||||
args: Vec<String>,
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user