Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/rust/tests/proxy_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_output, get_selenium_manager};
19
20
use exitcode::DATAERR;
21
22
mod common;
23
24
#[tokio::test]
25
async fn wrong_proxy_test() {
26
let mut cmd = get_selenium_manager();
27
let result = cmd
28
.args([
29
"--debug",
30
"--browser",
31
"chrome",
32
"--proxy",
33
"http://localhost:12345",
34
])
35
.assert()
36
.try_success();
37
38
assert_output(&mut cmd, result, vec!["in PATH"], DATAERR);
39
}
40
#[test]
41
fn wrong_protocol_proxy_test() {
42
let mut cmd = get_selenium_manager();
43
let result = cmd
44
.args(["--browser", "chrome", "--proxy", "wrong:://proxy"])
45
.assert()
46
.try_success();
47
48
assert_output(&mut cmd, result, vec!["There was an error"], DATAERR);
49
}
50
51
#[test]
52
fn wrong_port_proxy_test() {
53
let mut cmd = get_selenium_manager();
54
let result = cmd
55
.args([
56
"--browser",
57
"chrome",
58
"--proxy",
59
"https:://localhost:1234567",
60
])
61
.assert()
62
.try_success();
63
64
assert_output(&mut cmd, result, vec!["There was an error"], DATAERR);
65
}
66
67