chrome_for_testing_manager/
lib.rs1mod cache;
2mod chromedriver;
3mod download;
4mod mgr;
5mod port;
6mod session;
7
8pub mod prelude {
9 pub use crate::chromedriver::Chromedriver;
10 pub use crate::mgr::ChromeForTestingManager;
11 pub use crate::mgr::VersionRequest;
12 pub use crate::session::Session;
13 pub use crate::session::SessionHandle;
14 pub use chrome_for_testing::api::channel::Channel;
15 pub use chrome_for_testing::api::version::Version;
16}
17
18#[cfg(test)]
19mod tests {
20 use crate::prelude::*;
21 use assertr::prelude::*;
22 use serial_test::serial;
23 use thirtyfour::ChromiumLikeCapabilities;
24
25 #[ctor::ctor]
26 fn init_test_tracing() {
27 tracing_subscriber::fmt().with_test_writer().try_init().ok();
28 }
29
30 #[tokio::test(flavor = "multi_thread")]
31 #[serial]
32 #[cfg(feature = "thirtyfour")]
33 async fn latest_stable() -> anyhow::Result<()> {
34 let mut chromedriver = Chromedriver::run_latest_stable().await?;
35 let (handle, session) = chromedriver.new_session().await?;
36
37 session.goto("https://www.google.com").await?;
38
39 let url = session.current_url().await?;
40 assert_that(url).has_display_value("https://www.google.com/");
41
42 chromedriver.quit(handle).await?;
43
44 Ok(())
45 }
46
47 #[tokio::test(flavor = "multi_thread")]
48 #[serial]
49 #[cfg(feature = "thirtyfour")]
50 async fn latest_stable_with_caps() -> anyhow::Result<()> {
51 let mut chromedriver = Chromedriver::run_latest_stable().await?;
52 let (handle, session) = chromedriver
53 .new_session_with_caps(|caps| caps.unset_headless())
54 .await?;
55
56 session.goto("https://www.google.com").await?;
57
58 let url = session.current_url().await?;
59 assert_that(url).has_display_value("https://www.google.com/");
60
61 chromedriver.quit(handle).await?;
62
63 Ok(())
64 }
65}