1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
//! 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
//!
//! ```rust,ignore
//! 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)
//!
//! ```rust,ignore
//! 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);
//! }
//! ```
pub use TestApp;
pub use ;
pub use ;
pub use TestError;
pub use ;
pub use ;
/// Returns `true` if E2E tests should run (i.e., `VICTAURI_E2E` env var is set).
///
/// Use this to gate integration tests that require a running Tauri app:
///
/// ```rust,ignore
/// #[tokio::test]
/// async fn my_test() {
/// if !victauri_test::is_e2e() { return; }
/// // ...
/// }
/// ```
/// Connect to a Victauri server using standard env var configuration.
///
/// Reads `VICTAURI_PORT` (default 7373) and `VICTAURI_AUTH_TOKEN` (optional).
/// This is a shorthand for `VictauriClient::discover()`.
///
/// # Errors
///
/// Returns [`TestError::Connection`] if the server is unreachable.
pub async
/// Declare an E2E test that auto-skips when `VICTAURI_E2E` is not set
/// and auto-connects to the running server.
///
/// # Example
///
/// ```rust,ignore
/// use victauri_test::{e2e_test, VictauriClient};
///
/// e2e_test!(greet_flow, |client: &mut VictauriClient| async move {
/// client.fill_by_id("name-input", "World").await.unwrap();
/// client.click_by_id("greet-btn").await.unwrap();
/// client.expect_text("Hello, World!").await.unwrap();
/// });
/// ```