pub struct Play {
client: Arc<PlayHttpClient>,
}Expand description
The Play test framework for E2E testing
Provides methods for creating scenes, executing queries, and managing test data with automatic cleanup.
§Example
ⓘ
use bitwarden_test::play::{Play, SingleUserArgs, SingleUserScene};
#[tokio::test]
async fn test_user_login() {
Play::builder()
.run(|play| async move {
let args = SingleUserArgs {
email: "[email protected]".to_string(),
verified: true,
..Default::default()
};
let scene = play.scene::<SingleUserScene>(&args).await.unwrap();
// Use scene.get_mangled() to look up mangled values
let client_id = scene.get_mangled("client_id");
// Cleanup is automatic when run() completes
})
.await;
}Fields§
§client: Arc<PlayHttpClient>Implementations§
Source§impl Play
impl Play
Sourcepub fn builder() -> PlayBuilder
pub fn builder() -> PlayBuilder
Sourcefn new_internal(config: PlayConfig) -> Self
fn new_internal(config: PlayConfig) -> Self
Internal constructor for creating Play instances
Sourcepub async fn scene<T>(&self, arguments: &T::Arguments) -> PlayResult<Scene<T>>where
T: SceneTemplate,
pub async fn scene<T>(&self, arguments: &T::Arguments) -> PlayResult<Scene<T>>where
T: SceneTemplate,
Create a new scene from template arguments
The scene data will be cleaned up when the enclosing run() completes.
Sourcepub async fn query<Q>(&self, arguments: &Q::Args) -> PlayResult<Q>where
Q: Query,
pub async fn query<Q>(&self, arguments: &Q::Args) -> PlayResult<Q>where
Q: Query,
Execute a query
Sourcepub async fn clean(&self) -> PlayResult<()>
pub async fn clean(&self) -> PlayResult<()>
Clean all test data for this play_id
This is called automatically by PlayBuilder::run(), but can be called
manually if needed.
Sourcepub fn config(&self) -> &PlayConfig
pub fn config(&self) -> &PlayConfig
Get the configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Play
impl !RefUnwindSafe for Play
impl Send for Play
impl Sync for Play
impl Unpin for Play
impl !UnwindSafe for Play
Blanket Implementations§
§impl<T> AnySync for T
impl<T> AnySync for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Consume a handle, getting back the initial
Arc<> Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more