Skip to main content

Page

Struct Page 

Source
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: u32

Page width

§height: u32

Page height

§url: String

Current URL

§wasm_ready: bool

Whether WASM is ready

Implementations§

Source§

impl Page

Source

pub fn new(width: u32, height: u32) -> Self

Create a new page

Source

pub fn new_with_tracing( width: u32, height: u32, trace_collector: Option<TraceCollector>, ) -> Self

Create a new page with optional tracing

Source

pub fn goto(&mut self, url: &str) -> ProbarResult<()>

Navigate to a URL

§Errors

Returns error if navigation fails

Source

pub fn wait_for_wasm_ready(&mut self) -> ProbarResult<()>

Wait for WASM to be ready

§Errors

Returns error if WASM fails to initialize

Source

pub fn eval_wasm<T: DeserializeOwned>(&self, _expr: &str) -> ProbarResult<T>

Evaluate WASM expression (mock returns error)

§Errors

Always returns error in mock mode

Source

pub fn touch(&self, _touch: Touch) -> ProbarResult<()>

Simulate touch input (mock does nothing)

§Errors

Returns Ok in mock mode

Source

pub fn screenshot(&self) -> ProbarResult<Vec<u8>>

Take a screenshot (mock returns empty)

§Errors

Returns empty bytes in mock mode

Source

pub fn current_url(&self) -> &str

Get current URL

Source

pub const fn is_wasm_ready(&self) -> bool

Check if WASM is ready

Source

pub fn enable_console_capture(&mut self) -> ProbarResult<()>

Enable console message capture (mock - always succeeds)

§Errors

Always returns Ok in mock mode

Source

pub const fn is_console_capture_enabled(&self) -> bool

Check if console capture is enabled

Source

pub fn console_messages(&self) -> Vec<BrowserConsoleMessage>

Get all captured console messages (mock returns stored messages)

Source

pub fn clear_console(&self)

Clear captured console messages

Source

pub fn add_console_message(&self, msg: BrowserConsoleMessage)

Add a console message (mock - for testing)

Source

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

Source

pub fn inject_console_capture(&mut self) -> ProbarResult<()>

Inject console capture (mock - always succeeds)

§Errors

Always returns Ok in mock mode

Source

pub fn fetch_console_messages(&self) -> ProbarResult<Vec<BrowserConsoleMessage>>

Fetch console messages (mock - returns stored messages)

§Errors

Always returns Ok with stored messages

Source

pub fn is_tracing_enabled(&self) -> bool

Check if tracing is enabled for this page

Source

pub fn traceparent(&self) -> Option<String>

Get the traceparent header for W3C Trace Context propagation

Source

pub fn start_span( &mut self, name: impl Into<String>, category: impl Into<String>, ) -> Option<TraceSpan>

Start a new trace span

Source

pub fn record_span(&mut self, span: TraceSpan)

Record a completed span

Source

pub fn record_trace_console(&mut self, message: impl Into<String>)

Record a console message in the trace

Source

pub fn export_chrome_trace(&self) -> Option<ChromeTrace>

Export trace in Chrome trace format

Source

pub fn export_trace_json(&self) -> ProbarResult<Option<String>>

Export trace as JSON string

§Errors

Returns error if serialization fails

Source

pub fn inject_trace_context(&mut self) -> ProbarResult<()>

Inject trace context into the page (mock - does nothing)

§Errors

Always returns Ok in mock mode

Source

pub fn start_coverage(&mut self) -> ProbarResult<()>

Start code coverage collection (mock)

§Errors

Always returns Ok in mock mode

Source

pub fn start_coverage_with_config( &mut self, _config: CoverageConfig, ) -> ProbarResult<()>

Start coverage with custom configuration (mock)

§Errors

Always returns Ok in mock mode

Source

pub fn take_coverage(&self) -> ProbarResult<CoverageReport>

Take a coverage snapshot (mock - returns simulated data)

§Errors

Returns error if coverage not enabled

Source

pub fn stop_coverage(&mut self) -> ProbarResult<CoverageReport>

Stop coverage and return final report (mock)

§Errors

Returns error if coverage not enabled

Source

pub const fn is_coverage_enabled(&self) -> bool

Check if coverage is enabled

Source

pub fn add_mock_coverage(&self, func: FunctionCoverage)

Add mock function coverage data (for testing)

Source

pub fn clear_mock_coverage(&self)

Clear mock coverage data

Trait Implementations§

Source§

impl Debug for Page

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.