pub struct UiHarness { /* private fields */ }Expand description
Mounts UI routes and exercises the real pipeline: middlewares, extractors, rendering, the static cache and actions.
let harness = UiHarness::new(NotesController::register_ui_routes(&container, ui_router()));
let page = harness.get("/notes").await;
page.assert_ok();
assert!(page.contains("<h1>Notes</h1>"));
assert!(page.has_island("notes-form"));Implementations§
Source§impl UiHarness
impl UiHarness
Sourcepub fn new(router: Router) -> Self
pub fn new(router: Router) -> Self
Build from a router — usually
MyController::register_ui_routes(&container, ui_router()).
Pass the real ui_router() rather than Router::new() if the
test touches the client runtime or boosted navigation, since
that is where /_wabot/client.js lives.
Sourcepub fn rest(&self) -> &RestHarness
pub fn rest(&self) -> &RestHarness
The underlying REST harness, for headers, cookies and anything page-shaped this doesn’t cover.
pub fn with_header( &self, name: impl Into<String>, value: impl Into<String>, ) -> Self
pub fn with_bearer(&self, token: impl Display) -> Self
GET a view the way the client runtime does after the first
load: X-Wabot-Nav: 1, answered with a JSON fragment instead
of a document.
Sourcepub async fn action<T: Serialize>(
&self,
base: &str,
name: &str,
body: &T,
) -> TestResponse
pub async fn action<T: Serialize>( &self, base: &str, name: &str, body: &T, ) -> TestResponse
POST to an #[action], addressing it the way the client
runtime does — <controller>/_action/<name>, built with the
framework’s own route helper so the convention can’t drift.
Sourcepub async fn client_runtime(&self) -> TestResponse
pub async fn client_runtime(&self) -> TestResponse
The client runtime, to check it is being served at all.