Skip to main content

Crate vertigo_testing

Crate vertigo_testing 

Source
Expand description

Harness for end-to-end browser tests of vertigo apps.

A test crate builds its apps, starts what they run against and describes that as its own environment: a type implementing Env that dereferences to Core. Each test binary (harness = false) is one suite, run by run_suite: it starts the environment once, lazily, gives every browser test its own Chrome session wrapped in Ctx, and checks the browser console after each of them.

The building blocks of an environment:

  • build: the apps, with the vertigo-cli library, and the backend, with cargo,
  • serve: a build served in this process, as vertigo serve does,
  • free_port: a port for a server the suite starts.

Settings come from E2E_* environment variables, see Settings.

Re-exports§

pub use ctx::Ctx;
pub use ctx::HydrationReport;
pub use ctx::normalize;
pub use ctx::xpath_literal;
pub use env::ChromeConfig;
pub use env::Core;
pub use env::Env;
pub use env::POLL;
pub use env::Settings;
pub use env::WAIT;
pub use env::free_port;
pub use runner::Body;
pub use runner::TestCase;
pub use runner::TestFuture;
pub use runner::known_failures;
pub use runner::run_suite;
pub use reqwest;
pub use thirtyfour;

Modules§

build
Builds what a suite serves: the WASM apps, with the vertigo-cli library, and the backend, with cargo.
ctx
What a browser test gets: a Chrome session plus helpers that know how a vertigo app behaves.
env
What a suite runs against. Core is the part every environment has: the settings, the address of the app, the work directory, an HTTP client and a chromedriver shared by the tests. A test crate wraps it in its own environment, which adds whatever its app needs (a backend, a database) and implements Env.
prelude
What the tests and the helpers of a test crate usually need.
runner
A libtest-compatible runner (filters, --list, --test-threads, --ignored) which starts the environment once per suite, lazily, and gives each browser test its own Chrome session.
serve
A build served in this process, as vertigo serve does it (SSR included), for apps that need no backend of their own.

Macros§

browser_tests
browser_tests![module::test, ...]: tests taking a Ctx.
http_tests
http_tests![module::test, ...]: tests taking an Arc of the environment.