// 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, get_stdout};1819use rstest::rstest;2021use std::fs::File;22use std::io::{BufWriter, Write};23use tempfile::Builder;2425mod common;2627#[rstest]28#[case("chrome")]29#[case("firefox")]30#[case("edge")]31fn config_test(#[case] browser_name: String) {32let tmp_dir = Builder::new().prefix("sm-config-test").tempdir().unwrap();33let config_path = tmp_dir.path().join("se-config.toml");34let config_file = File::create(config_path.as_path()).unwrap();35let mut writer = BufWriter::new(config_file);36writer37.write_all(format!(r#"browser="{}""#, browser_name).as_bytes())38.unwrap();39writer.flush().unwrap();4041let mut cmd = get_selenium_manager();42cmd.args([43"--output",44"json",45"--debug",46"--cache-path",47tmp_dir.path().to_str().unwrap(),48])49.assert()50.success()51.code(0);5253let stdout = get_stdout(&mut cmd);5455assert!(!stdout.contains("WARN") && !stdout.contains("ERROR"));56assert_driver(&mut cmd);57assert_browser(&mut cmd);58}596061