Expand description
Test framework for Viewpoint browser automation.
This crate provides the primary testing API via TestHarness, along with
assertions and configuration for browser-based E2E tests.
§Primary API: TestHarness
The TestHarness provides explicit test setup with browser, context, and page access.
Cleanup happens automatically via Drop.
use viewpoint_test::TestHarness;
#[tokio::test]
async fn my_test() -> Result<(), Box<dyn std::error::Error>> {
let harness = TestHarness::new().await?;
let page = harness.page();
page.goto("https://example.com").goto().await?;
Ok(()) // harness drops and cleans up
}§Fixture Scoping
The harness supports different scoping levels:
TestHarness::new()- Test-scoped: new browser per test (default)TestHarness::from_browser()- Module-scoped: reuse browser, fresh context/pageTestHarness::from_context()- Shared context: reuse context, fresh page only
Re-exports§
pub use expect::Expectable;pub use expect::LocatorAssertions;pub use expect::PageAssertions;pub use expect::SoftAssertionError;pub use expect::SoftAssertions;pub use expect::SoftLocatorAssertions;pub use expect::SoftPageAssertions;pub use expect::expect;pub use expect::expect_page;
Modules§
- expect
- Assertion API for browser automation tests.
Structs§
- Assertion
Error - Error type for failed assertions.
- Browser
- A browser instance connected via CDP.
- Browser
Context - An isolated browser context.
- Page
- A browser page (tab).
- Test
Config - Configuration for test execution.
- Test
Config Builder - Builder for
TestConfig. - Test
Harness - Test harness that manages browser, context, and page lifecycle.
Enums§
- Core
Error - Errors that can occur in the core domain.
- Document
Load State - Document load states for navigation waiting.
- Test
Error - Errors that can occur during test execution.
Attribute Macros§
- test
- Attribute macro for
Viewpointtests.