Skip to main content

browser

Function browser 

Source
pub async fn browser() -> Result<Browser, Error>
Expand description

The current test’s browser: a headless Chromium Encore runs for the test, for a tool of the test’s own to drive. It is started the first time the test asks, and ends with the test.

It is the test’s in every way a call the test makes is:

  • It reaches the app where encore run has it. A frontend says itself where its API is, as http://localhost:4000: a page’s requests there, and to the frontends’ own addresses, go to the test session.
  • Each request a page makes to the app carries the test, so what the app does for a click is done on the test’s data, and settled waits for it.
  • What the test has the browser do, and each request a page makes, is in the test’s telemetry, with what the app did for a request under it. So is what a page says went wrong: an error on its console, an exception nothing caught, a request that failed.
  • Its pages are recorded. A test that fails is left a file that plays them back beside all of that (Browser::recording).

The chromiumoxide feature connects chromiumoxide to it (testing::chromiumoxide::connect). This is for any other tool that speaks the DevTools Protocol.

The browser is the browser/chromium component, which Encore downloads the first time a test asks for one.

ⓘ
let browser = system::browser().await?;
let (chromium, handler) = chromiumoxide::Browser::connect(browser.ws_endpoint()).await?;
let page = chromium.new_page(browser.url("web")?).await?;