The browser a test run shares.
Browsers are launched once per type, the first time a test asks for one,
and every test gets a browser context of its own, which isolates its
storage, cookies and pages the way a browser of its own would. See
with_page/3.
The process also keeps what the contexts load: the test runtime,
priv/ts/test/browser.ts, bundled once when the run starts and installed
in every context before its page loads, and the bundled test modules,
written to _build/volt/browser-tests, emptied when the run starts, and
reused while the source files they were bundled from keep their
modification times. See module/2.
Volt.Test.Browser.Supervisor starts this process next to the Playwright
driver.
Summary
Functions
Returns a specification to start this module under a supervisor.
Drop a browser that is no longer reachable, so the next request launches a new one.
The browser of type, launched on first request.
The file: URL of the bundled module for the test file at path, bundled
with bundle_opts.
Open a context in the browser of type, with the test runtime installed
and a page on the blank document, and call fun with the page's main frame.
Types
@type launched() :: %{guid: String.t()}
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
Drop a browser that is no longer reachable, so the next request launches a new one.
The browser of type, launched on first request.
The file: URL of the bundled module for the test file at path, bundled
with bundle_opts.
Bundling happens in the caller, so tests of different files bundle concurrently. Modules are named by their content, so two callers bundling the same file at once write the same module.
@spec with_page(atom(), timeout(), (map() -> result)) :: result | {:error, term()} when result: term()
Open a context in the browser of type, with the test runtime installed
and a page on the blank document, and call fun with the page's main frame.
The context closes when fun returns or raises. A browser that is no longer
reachable, because it crashed since it was launched, is launched again once.