Expand description
🦕 Doco
Doco is a test runner and library for writing end-to-tests of web applications. It is designed to be framework-agnostic and easy to use, both locally and in CI/CD pipelines.
Under the hood, Doco uses containers to create ephemeral, isolated environments for each test. This prevents state to leak between tests and ensures that each test is run with a known and predictable environment.
Doco has a very simple, yet powerful API to make it easy to write tests. In a main function,
the environment for tests is defined and configured. Most importantly, Doco is told about the
server and its dependencies. Then, tests are written just like with any other Rust test. The
tests are passed a Client that can be used to interact with a website, making it easy to
simulate user interactions and write assertions against the web application.
§Example
use doco::{Client, Doco, Result, Server, Service, WaitFor};
#[doco::test]
async fn visit_root_path(client: Client) -> Result<()> {
client.goto("/").await?;
let body = client.source().await?;
assert!(body.contains("Hello World"));
Ok(())
}
#[doco::main]
async fn main() -> Doco {
let server = Server::builder()
.image("crccheck/hello-world")
.tag("v1.0.0")
.port(8000)
.build();
Doco::builder().server(server).build()
}Macros§
- anyhow
- Construct an ad-hoc error from a string or existing non-
anyhowerror value.
Structs§
- By
- Element Selector struct providing a convenient way to specify selectors.
- Client
- WebDriver client that interacts with the web application
- Doco
- Configuration for end-to-end tests with Doco
- Error
- The
Errortype, a wrapper around a dynamic error type. - Mount
- Represents a filesystem mount. For more information see Docker Storage documentation.
- Server
- Server for the web application that is being tested
- Service
- Auxiliary service required by the server
- Session
- A long-lived browser session connected to a running application
- Test
Case - A test case registered by the
#[doco::test]macro - Test
Runner - Test runner for Doco’s end-to-end tests
- Viewport
- Browser viewport dimensions
Enums§
- Access
Mode - WaitFor
- Represents a condition that needs to be met before a container is considered ready.
Traits§
- Context
- Provides the
contextmethod forResult.
Type Aliases§
- Result
Result<T, Error>