Skip to content

Commit

Permalink
add more checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Delta456 committed Sep 20, 2024
1 parent 94f0f5c commit e725eeb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
19 changes: 14 additions & 5 deletions rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,20 @@ pub trait SeleniumManager {
discovered_major_browser_version,
major_browser_version,
));
self.set_fallback_driver_from_cache(false);
return Err(anyhow!(format!(
"Invalid version {} provided",
major_browser_version
)));
if self
.request_fixed_browser_version_from_online(
major_browser_version.as_str(),
)
.is_err()
{
self.set_fallback_driver_from_cache(false);
return Err(anyhow!(format!(
"Invalid {} version provided: {}",
self.get_browser_name(),
major_browser_version
)));
}
download_browser = true;
} else {
self.set_browser_version(discovered_version);
}
Expand Down
9 changes: 9 additions & 0 deletions rust/tests/browser_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,12 @@ fn invalid_browser_version_test() {
.code(DATAERR)
.failure();
}

#[test]
fn valid_browser_version_pass_test() {
let mut cmd = get_selenium_manager();
cmd.args(["--browser", "chrome", "--browser-version", "127"])
.assert()
.code(0)
.success();
}

0 comments on commit e725eeb

Please sign in to comment.