Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/rust/tests/browser_download_tests.rs
2885 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
use crate::common::{assert_browser, assert_driver, get_selenium_manager};
19
20
use rstest::rstest;
21
use std::env::consts::OS;
22
23
mod common;
24
25
#[rstest]
26
#[case("chrome")]
27
#[case("firefox")]
28
#[case("edge")]
29
fn browser_latest_download_test(#[case] browser: String) {
30
if !browser.eq("edge") || !OS.eq("windows") {
31
let mut cmd = get_selenium_manager();
32
cmd.args([
33
"--browser",
34
&browser,
35
"--force-browser-download",
36
"--output",
37
"json",
38
"--debug",
39
])
40
.assert()
41
.success()
42
.code(0);
43
44
assert_driver(&mut cmd);
45
assert_browser(&mut cmd);
46
}
47
}
48
49
#[rstest]
50
#[case("chrome", "113")]
51
#[case("chrome", "131.0.6725.0")]
52
#[case("chrome", "beta")]
53
#[case("firefox", "116")]
54
#[case("firefox", "121.0.1")]
55
#[case("firefox", "beta")]
56
#[case("firefox", "esr")]
57
#[case("edge", "137.0.3296.93")]
58
#[case("edge", "beta")]
59
fn browser_version_download_test(#[case] browser: String, #[case] browser_version: String) {
60
if OS.eq("windows") && browser.eq("edge") {
61
println!("Skipping Edge download test on Windows since the installation requires admin privileges");
62
} else {
63
let mut cmd = get_selenium_manager();
64
cmd.args([
65
"--browser",
66
&browser,
67
"--browser-version",
68
&browser_version,
69
"--output",
70
"json",
71
"--debug",
72
])
73
.assert()
74
.success()
75
.code(0);
76
77
assert_driver(&mut cmd);
78
assert_browser(&mut cmd);
79
}
80
}
81
82