pub struct Page {
pub width: u32,
pub height: u32,
pub url: String,
pub wasm_ready: bool,
/* private fields */
}Expand description
A browser page for testing (mock when browser feature disabled)
Fields§
§width: u32Page width
height: u32Page height
url: StringCurrent URL
wasm_ready: boolWhether WASM is ready
Implementations§
Source§impl Page
impl Page
Sourcepub fn new_with_tracing(
width: u32,
height: u32,
trace_collector: Option<TraceCollector>,
) -> Self
pub fn new_with_tracing( width: u32, height: u32, trace_collector: Option<TraceCollector>, ) -> Self
Create a new page with optional tracing
Sourcepub fn goto(&mut self, url: &str) -> ProbarResult<()>
pub fn goto(&mut self, url: &str) -> ProbarResult<()>
Sourcepub fn wait_for_wasm_ready(&mut self) -> ProbarResult<()>
pub fn wait_for_wasm_ready(&mut self) -> ProbarResult<()>
Sourcepub fn eval_wasm<T: DeserializeOwned>(&self, _expr: &str) -> ProbarResult<T>
pub fn eval_wasm<T: DeserializeOwned>(&self, _expr: &str) -> ProbarResult<T>
Sourcepub fn touch(&self, _touch: Touch) -> ProbarResult<()>
pub fn touch(&self, _touch: Touch) -> ProbarResult<()>
Sourcepub fn screenshot(&self) -> ProbarResult<Vec<u8>>
pub fn screenshot(&self) -> ProbarResult<Vec<u8>>
Sourcepub fn current_url(&self) -> &str
pub fn current_url(&self) -> &str
Get current URL
Sourcepub const fn is_wasm_ready(&self) -> bool
pub const fn is_wasm_ready(&self) -> bool
Check if WASM is ready
Sourcepub fn enable_console_capture(&mut self) -> ProbarResult<()>
pub fn enable_console_capture(&mut self) -> ProbarResult<()>
Sourcepub const fn is_console_capture_enabled(&self) -> bool
pub const fn is_console_capture_enabled(&self) -> bool
Check if console capture is enabled
Sourcepub fn console_messages(&self) -> Vec<BrowserConsoleMessage>
pub fn console_messages(&self) -> Vec<BrowserConsoleMessage>
Get all captured console messages (mock returns stored messages)
Sourcepub fn clear_console(&self)
pub fn clear_console(&self)
Clear captured console messages
Sourcepub fn add_console_message(&self, msg: BrowserConsoleMessage)
pub fn add_console_message(&self, msg: BrowserConsoleMessage)
Add a console message (mock - for testing)
Sourcepub fn wait_for_console<F>(
&self,
predicate: F,
_timeout_ms: u64,
) -> ProbarResult<BrowserConsoleMessage>
pub fn wait_for_console<F>( &self, predicate: F, _timeout_ms: u64, ) -> ProbarResult<BrowserConsoleMessage>
Wait for console message (mock - returns first matching or error)
§Errors
Returns error if no matching message found
Sourcepub fn inject_console_capture(&mut self) -> ProbarResult<()>
pub fn inject_console_capture(&mut self) -> ProbarResult<()>
Sourcepub fn fetch_console_messages(&self) -> ProbarResult<Vec<BrowserConsoleMessage>>
pub fn fetch_console_messages(&self) -> ProbarResult<Vec<BrowserConsoleMessage>>
Fetch console messages (mock - returns stored messages)
§Errors
Always returns Ok with stored messages
Sourcepub fn is_tracing_enabled(&self) -> bool
pub fn is_tracing_enabled(&self) -> bool
Check if tracing is enabled for this page
Sourcepub fn traceparent(&self) -> Option<String>
pub fn traceparent(&self) -> Option<String>
Get the traceparent header for W3C Trace Context propagation
Sourcepub fn start_span(
&mut self,
name: impl Into<String>,
category: impl Into<String>,
) -> Option<TraceSpan>
pub fn start_span( &mut self, name: impl Into<String>, category: impl Into<String>, ) -> Option<TraceSpan>
Start a new trace span
Sourcepub fn record_span(&mut self, span: TraceSpan)
pub fn record_span(&mut self, span: TraceSpan)
Record a completed span
Sourcepub fn record_trace_console(&mut self, message: impl Into<String>)
pub fn record_trace_console(&mut self, message: impl Into<String>)
Record a console message in the trace
Sourcepub fn export_chrome_trace(&self) -> Option<ChromeTrace>
pub fn export_chrome_trace(&self) -> Option<ChromeTrace>
Export trace in Chrome trace format
Sourcepub fn export_trace_json(&self) -> ProbarResult<Option<String>>
pub fn export_trace_json(&self) -> ProbarResult<Option<String>>
Sourcepub fn inject_trace_context(&mut self) -> ProbarResult<()>
pub fn inject_trace_context(&mut self) -> ProbarResult<()>
Sourcepub fn start_coverage(&mut self) -> ProbarResult<()>
pub fn start_coverage(&mut self) -> ProbarResult<()>
Sourcepub fn start_coverage_with_config(
&mut self,
_config: CoverageConfig,
) -> ProbarResult<()>
pub fn start_coverage_with_config( &mut self, _config: CoverageConfig, ) -> ProbarResult<()>
Sourcepub fn take_coverage(&self) -> ProbarResult<CoverageReport>
pub fn take_coverage(&self) -> ProbarResult<CoverageReport>
Take a coverage snapshot (mock - returns simulated data)
§Errors
Returns error if coverage not enabled
Sourcepub fn stop_coverage(&mut self) -> ProbarResult<CoverageReport>
pub fn stop_coverage(&mut self) -> ProbarResult<CoverageReport>
Sourcepub const fn is_coverage_enabled(&self) -> bool
pub const fn is_coverage_enabled(&self) -> bool
Check if coverage is enabled
Sourcepub fn add_mock_coverage(&self, func: FunctionCoverage)
pub fn add_mock_coverage(&self, func: FunctionCoverage)
Add mock function coverage data (for testing)
Sourcepub fn clear_mock_coverage(&self)
pub fn clear_mock_coverage(&self)
Clear mock coverage data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Page
impl RefUnwindSafe for Page
impl Send for Page
impl Sync for Page
impl Unpin for Page
impl UnsafeUnpin for Page
impl UnwindSafe for Page
Blanket Implementations§
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
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>
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>
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