diff --git a/cli/src/native/cdp/chrome.rs b/cli/src/native/cdp/chrome.rs index 387cf3b..5b269a0 100644 --- a/cli/src/native/cdp/chrome.rs +++ b/cli/src/native/cdp/chrome.rs @@ -190,6 +190,10 @@ fn build_chrome_args(options: &LaunchOptions) -> Result { (dir.clone(), Some(dir)) }; + if options.ignore_https_errors { + args.push("--ignore-certificate-errors".to_string()); + } + if options.allow_file_access { args.push("--allow-file-access-from-files".to_string()); args.push("--allow-file-access".to_string()); @@ -1169,6 +1173,35 @@ mod tests { } } + #[test] + fn test_build_args_ignore_https_errors_includes_flag() { + let opts = LaunchOptions { + ignore_https_errors: true, + ..Default::default() + }; + let result = build_chrome_args(&opts).unwrap(); + assert!(result + .args + .iter() + .any(|a| a == "--ignore-certificate-errors")); + if let Some(ref dir) = result.temp_user_data_dir { + let _ = std::fs::remove_dir_all(dir); + } + } + + #[test] + fn test_build_args_ignore_https_errors_default_no_flag() { + let opts = LaunchOptions::default(); + let result = build_chrome_args(&opts).unwrap(); + assert!(!result + .args + .iter() + .any(|a| a == "--ignore-certificate-errors")); + if let Some(ref dir) = result.temp_user_data_dir { + let _ = std::fs::remove_dir_all(dir); + } + } + #[test] fn test_chrome_process_drop_cleans_temp_dir() { let dir = std::env::temp_dir().join(format!(