Skip to main content

Crate victauri_test

Crate victauri_test 

Source
Expand description

Integration testing for Tauri apps via the Victauri MCP server.

Provides TestApp for managed app lifecycle and VictauriClient with Playwright-style interactions (click_by_text, fill_by_id, expect_text) plus assertion helpers for accessibility, performance, and state verification.

§Quick Start

use victauri_test::TestApp;

#[tokio::test]
async fn greet_flow() {
    let app = TestApp::spawn("cargo run -p my-app").await.unwrap();
    let mut client = app.client().await.unwrap();

    client.fill_by_id("name-input", "World").await.unwrap();
    client.click_by_id("greet-btn").await.unwrap();
    client.expect_text("Hello, World!").await.unwrap();
}

§Without TestApp (connect to existing server)

use victauri_test::VictauriClient;

#[tokio::test]
async fn check_health() {
    let mut client = VictauriClient::discover().await.unwrap();
    let audit = client.audit_accessibility().await.unwrap();
    assert_eq!(audit["summary"]["violations"], 0);
}

Re-exports§

pub use locator::Bounds;
pub use locator::Locator;
pub use locator::LocatorExpect;
pub use locator::LocatorMatch;
pub use smoke::SmokeCheckResult;
pub use smoke::SmokeConfig;
pub use smoke::SmokeReport;

Modules§

coverage
IPC coverage tracking — measures which Tauri commands are exercised by tests.
locator
Playwright-style composable element locators with actions, queries, and auto-waiting expectations.
prelude
Convenience re-exports for concise test imports.
reporting
JUnit XML report generation for CI integration.
smoke
Built-in smoke test suite for Victauri-powered Tauri apps.
visual
Visual regression testing — compare screenshots against baselines.

Macros§

e2e_test
Declare an E2E test that auto-skips when VICTAURI_E2E is not set and auto-connects to the running server.

Structs§

CheckResult
A single check result — pass or fail with context.
MemoryStats
Structured process memory statistics returned by VictauriClient::memory_stats.
PluginInfo
Structured plugin information returned by VictauriClient::plugin_info.
TestApp
Managed Tauri application lifecycle for integration testing.
VerifyBuilder
Fluent assertion builder for full-stack Tauri test verification.
VerifyReport
Collection of check results from a verify() run.
VictauriClient
Typed HTTP client for the Victauri MCP server.
WaitForBuilder
Builder for configuring and executing a wait_for condition.

Enums§

TestError
Errors that can occur when interacting with the Victauri MCP server from tests.

Functions§

assert_ipc_called
Assert that a specific IPC command was called at least once.
assert_ipc_called_with
Assert that a specific IPC command was called with the given arguments.
assert_ipc_healthy
Assert that IPC integrity is healthy (no stale or errored calls).
assert_ipc_not_called
Assert that a specific IPC command was NOT called.
assert_json_eq
Assert that a JSON value at the given pointer equals the expected value.
assert_json_truthy
Assert that a JSON value at the given pointer is truthy (not null/false/0/“”).
assert_no_a11y_violations
Assert that an accessibility audit has zero violations.
assert_performance_budget
Assert that all performance metrics are within budget.
assert_state_matches
Assert that state verification passed with no divergences.
connect
Connect to a Victauri server using standard env var configuration.
is_e2e
Returns true if E2E tests should run (i.e., VICTAURI_E2E env var is set).