Path: blob/trunk/rust/tests/browser_download_tests.rs
4012 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617use crate::common::{assert_browser, assert_driver, get_selenium_manager};1819use rstest::rstest;20use std::env::consts::OS;2122mod common;2324#[rstest]25#[case("chrome")]26#[case("firefox")]27#[case("edge")]28fn browser_latest_download_test(#[case] browser: String) {29if !browser.eq("edge") || !OS.eq("windows") {30let mut cmd = get_selenium_manager();31cmd.args([32"--browser",33&browser,34"--force-browser-download",35"--output",36"json",37"--debug",38])39.assert()40.success()41.code(0);4243assert_driver(&mut cmd);44assert_browser(&mut cmd);45}46}4748#[rstest]49#[case("chrome", "131")]50#[case("chrome", "131.0.6778.264")]51#[case("chrome", "beta")]52#[case("firefox", "121")]53#[case("firefox", "121.0.1")]54#[case("firefox", "beta")]55#[case("firefox", "esr")]56#[case("edge", "stable")]57#[case("edge", "beta")]58fn browser_version_download_test(#[case] browser: String, #[case] browser_version: String) {59if OS.eq("windows") && browser.eq("edge") {60println!(61"Skipping Edge download test on Windows since the installation requires admin privileges"62);63} else {64let mut cmd = get_selenium_manager();65cmd.args([66"--browser",67&browser,68"--browser-version",69&browser_version,70"--output",71"json",72"--debug",73])74.assert()75.success()76.code(0);7778assert_driver(&mut cmd);79assert_browser(&mut cmd);80}81}828384