Web Driver

This section is for native end-to-end tests. For in-browser end-to-end tests see end-to-end.

Sweet can be used with fantoccini or any other webdriver client.

Example

Note the non_send flag, as fantoccini futures are not Send.

use fantoccini::ClientBuilder;
use fantoccini::Locator;
use sweet::*;

#[sweet_test(non_send)]
async fn connects_to_example()->Result<()>{
	let client = ClientBuilder::native()
		.connect("http://localhost:9515").await?;

	client.goto("https://example.com").await?;
	let url = client.current_url().await?;
	expect(url.as_ref()).to_be("https://example.com")?;

	client.close().await?;
	Ok(())
}