Initial template commit
This commit is contained in:
47
tests/src/main.rs
Normal file
47
tests/src/main.rs
Normal file
@@ -0,0 +1,47 @@
|
||||
use std::{
|
||||
error::Error,
|
||||
thread::sleep,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
use thirtyfour::prelude::*;
|
||||
use tokio::time::{
|
||||
Timeout,
|
||||
timeout,
|
||||
};
|
||||
|
||||
pub const LINK_BTNS: [(&'static str, &'static str); 6] = [
|
||||
("tauri_link_btn", "https://tauri.app/"),
|
||||
("leptos_link_btn", "https://leptos.dev/"),
|
||||
("tailwindcss_link_btn", "https://tailwindcss.com/"),
|
||||
("daisyui_link_btn", "https://daisyui.com/"),
|
||||
("helix_link_btn", "https://helix-editor.com/"),
|
||||
("dprint_link_btn", "https://dprint.dev/"),
|
||||
];
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), Box<dyn Error + Send + Sync>> {
|
||||
// let caps = DesiredCapabilities::chrome();
|
||||
// let driver = WebDriver::new("http://localhost:9515", caps).await?;
|
||||
let caps = DesiredCapabilities::firefox();
|
||||
let driver = WebDriver::new("http://localhost:4444", caps).await?;
|
||||
|
||||
driver
|
||||
.goto("http://127.0.0.1:42069")
|
||||
.await?;
|
||||
|
||||
for link_btn in LINK_BTNS {
|
||||
let btn = driver.find(By::Id(link_btn.0)).await?;
|
||||
|
||||
assert_eq!(
|
||||
link_btn.1,
|
||||
btn.prop("href")
|
||||
.await?
|
||||
.unwrap_or_default()
|
||||
);
|
||||
}
|
||||
|
||||
driver.quit().await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user