Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[rust] Return complete safari and safaritp browser path #12434

Merged
merged 2 commits into from
Jul 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions rust/src/safari.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ use crate::{create_http_client, format_one_arg, Logger, SeleniumManager, PLIST_C

pub const SAFARI_NAME: &str = "safari";
pub const SAFARIDRIVER_NAME: &str = "safaridriver";
const SAFARI_PATH: &str = r#"/Applications/Safari.app"#;
const SAFARI_FULL_PATH: &str = r#"/Applications/Safari.app/Contents/MacOS/Safari"#;

pub struct SafariManager {
pub browser_name: &'static str,
Expand Down Expand Up @@ -69,10 +71,7 @@ impl SeleniumManager for SafariManager {
}

fn get_browser_path_map(&self) -> HashMap<BrowserPath, &str> {
HashMap::from([(
BrowserPath::new(MACOS, STABLE),
r#"/Applications/Safari.app"#,
)])
HashMap::from([(BrowserPath::new(MACOS, STABLE), SAFARI_PATH)])
}

fn discover_browser_version(&mut self) -> Option<String> {
Expand All @@ -90,6 +89,7 @@ impl SeleniumManager for SafariManager {
} else {
return None;
};
self.set_browser_path(SAFARI_FULL_PATH.to_string());
self.detect_browser_version(command)
}

Expand Down
9 changes: 5 additions & 4 deletions rust/src/safaritp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ pub const SAFARITP_NAMES: &[&str] = &[
"safaritechnologypreview",
];
pub const SAFARITPDRIVER_NAME: &str = "safaridriver";
const SAFARITP_PATH: &str = r#"/Applications/Safari Technology Preview.app"#;
const SAFARITP_FULL_PATH: &str =
r#"/Applications/Safari Technology Preview.app/Contents/MacOS/Safari Technology Preview"#;

pub struct SafariTPManager {
pub browser_name: &'static str,
Expand Down Expand Up @@ -74,10 +77,7 @@ impl SeleniumManager for SafariTPManager {
}

fn get_browser_path_map(&self) -> HashMap<BrowserPath, &str> {
HashMap::from([(
BrowserPath::new(MACOS, STABLE),
r#"/Applications/Safari\ Technology\ Preview.app"#,
)])
HashMap::from([(BrowserPath::new(MACOS, STABLE), SAFARITP_PATH)])
}

fn discover_browser_version(&mut self) -> Option<String> {
Expand All @@ -95,6 +95,7 @@ impl SeleniumManager for SafariTPManager {
} else {
return None;
};
self.set_browser_path(SAFARITP_FULL_PATH.to_string());
self.detect_browser_version(command)
}

Expand Down