Crate viewpoint_test_macros

Crate viewpoint_test_macros 

Source
Expand description

Proc macros for Viewpoint test framework.

This crate provides the #[viewpoint::test] attribute macro for convenient test setup. It is an optional convenience layer - the primary API is TestHarness from viewpoint-test.

§Example

use viewpoint_test_macros::test;
use viewpoint_test::Page;

#[viewpoint_test_macros::test]
async fn my_test(page: Page) -> Result<(), Box<dyn std::error::Error>> {
    page.goto("https://example.com").goto().await?;
    Ok(())
}

§Scoping

The macro supports fixture scoping via attributes:

// Module-scoped browser
#[viewpoint_test_macros::test(scope = "browser", browser = "shared_browser")]
async fn fast_test(page: Page) -> Result<(), Box<dyn std::error::Error>> {
    // ...
}

Attribute Macros§

test
Attribute macro for Viewpoint tests.