-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
These won't run yet because several still need to be written.
- Loading branch information
1 parent
55c21eb
commit 6f979eb
Showing
5 changed files
with
62 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use fantoccini::{Client, Locator}; | ||
use perseus::wait_for_checkpoint; | ||
|
||
#[perseus::test] | ||
async fn main(c: &mut Client) -> Result<(), fantoccini::error::CmdError> { | ||
c.goto("http://localhost:8080").await?; | ||
wait_for_checkpoint!("begin", 0, c); | ||
let url = c.current_url().await?; | ||
assert!(url.as_ref().starts_with("http://localhost:8080")); | ||
|
||
// The greeting was passed through using build state | ||
wait_for_checkpoint!("initial_state_present", 0, c); | ||
wait_for_checkpoint!("page_visible", 0, c); | ||
let greeting = c.find(Locator::Css("p")).await?.text().await?; | ||
assert_eq!(greeting, "Hello World!"); | ||
// For some reason, retrieving the inner HTML or text of a `<title>` doens't work | ||
let title = c.find(Locator::Css("title")).await?.html(false).await?; | ||
assert!(title.contains("Index Page")); | ||
|
||
// Go to `/about` | ||
c.find(Locator::Id("about-link")).await?.click().await?; | ||
let url = c.current_url().await?; | ||
assert!(url.as_ref().starts_with("http://localhost:8080/about")); | ||
wait_for_checkpoint!("initial_state_not_present", 0, c); | ||
wait_for_checkpoint!("page_visible", 1, c); | ||
// Make sure the hardcoded text there exists | ||
let text = c.find(Locator::Css("p")).await?.text().await?; | ||
assert_eq!(text, "About."); | ||
let title = c.find(Locator::Css("title")).await?.html(false).await?; | ||
assert!(title.contains("About Page")); | ||
// Make sure we get initial state if we refresh | ||
c.refresh().await?; | ||
wait_for_checkpoint!("initial_state_present", 0, c); | ||
|
||
Ok(()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters