pub struct Browser { /* private fields */ }Expand description
The current test’s browser: see browser. Cheap to clone, and every
clone is the same browser.
Implementations§
Source§impl Browser
impl Browser
Sourcepub fn ws_endpoint(&self) -> &str
pub fn ws_endpoint(&self) -> &str
What a DevTools Protocol client connects to: the address of a
WebSocket, as a browser gives for itself
(ws://127.0.0.1:53211/devtools/browser/…).
Sourcepub fn recording(&self) -> Option<&Path>
pub fn recording(&self) -> Option<&Path>
The file the recording is written to when the test ends, if it is
kept: one HTML file that plays the pages back beside what the test
and the app did. None when nothing is recorded.
Sourcepub fn url(&self, name: &str) -> Result<String, Error>
pub fn url(&self, name: &str) -> Result<String, Error>
The URL a page reaches the gateway or frontend name at: the one
encore run has it at, which the frontend is written against. The
browser’s requests there go to the test session.
Sourcepub fn step<F: Future>(
&self,
name: impl Into<String>,
statement: F,
) -> impl Future<Output = F::Output>
pub fn step<F: Future>( &self, name: impl Into<String>, statement: F, ) -> impl Future<Output = F::Output>
Runs statement as the step name of the test: a statement of the
test, as it reads, with where it is.
Encore reads what the test’s tool has the browser do — a click, a
key, a navigation — off the protocol. That says what was done, not
which line of the test did it. What the browser is told between a
step’s beginning and its end is that step’s doing: in the recording
and in the test’s telemetry, the click is under the statement,
and the requests it set off under the click.
statement is not polled until Encore knows the step has begun. A
step that panics, or is dropped before it finishes, is recorded as
failed. Reporting never fails the test: with no browser to tell, the
statement runs as it is.
browser.step("pay", page.find_element("button#pay").await?.click()).await?;Trait Implementations§
Auto Trait Implementations§
impl Forget for Browser
impl Freeze for Browser
impl Move for Browser
impl RefUnwindSafe for Browser
impl Send for Browser
impl Sync for Browser
impl Unpin for Browser
impl UnsafeUnpin for Browser
impl UnwindSafe for Browser
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request