Expand description
Play test framework for E2E testing
This module provides a scene-based testing framework with automatic cleanup.
§Overview
The Play framework enables E2E testing by:
- Creating test data via a seeder API
- Providing test isolation through unique play IDs
- Automatic cleanup when the test closure completes
§Example
ⓘ
use bitwarden_test::play::{play_test, Play, SingleUserArgs, SingleUserScene};
#[play_test]
async fn test_user_login(play: Play) {
let args = SingleUserArgs {
email: "[email protected]".to_string(),
..Default::default()
};
let scene = play.scene::<SingleUserScene>(&args).await.unwrap();
// Access result data directly
let user_id = &scene.result().user_id;
let api_key = &scene.result().api_key;
// Use mangled values for test isolation
let email = scene.get_mangled("[email protected]");
// Cleanup happens automatically
}Re-exports§
pub use scenes::SingleUserArgs;pub use scenes::SingleUserResult;pub use scenes::SingleUserScene;
Modules§
- config 🔒
- Configuration for the Play test framework
- error 🔒
- Error types for the Play test framework
- http_
client 🔒 - HTTP client with automatic x-play-id header injection
- play 🔒
- Main Play struct with builder pattern and closure-based cleanup
- query 🔒
- Query trait for parameterized database queries
- scene 🔒
- Scene wrapper for test data
- scene_
template 🔒 - SceneTemplate trait for defining test scenes
- scenes
- Scene template implementations
Structs§
- Play
- The Play test framework for E2E testing
- Play
Builder - Builder for Play instances with closure-based execution
- Play
Config - Configuration for connecting to Bitwarden services during E2E tests
- Scene
- A scene containing test data created by the seeder
Enums§
- Play
Error - Errors that can occur during Play framework operations
Traits§
- Query
- Trait for defining parameterized queries
- Scene
Template - Trait for defining scene templates
Type Aliases§
- Play
Result - Result type for Play framework operations
Attribute Macros§
- play_
test - Attribute macro for Play framework tests