Skip to content

The headless browser for AI agents and web scraping

2.4 KB
Raw Blame
// One link of the browser engine. Nextest still starts a process per test.
macro_rules! integration_tests {
    ($($module:ident),* $(,)?) => {
        $(mod $module;)*

        #[test]
        fn every_integration_file_is_registered() {
            use std::collections::BTreeSet;
            let registered: BTreeSet<String> = [$(stringify!($module).to_owned(),)*]
                .into_iter().collect();
            let files: BTreeSet<String> = std::fs::read_dir(
                concat!(env!("CARGO_MANIFEST_DIR"), "/tests"),
            ).unwrap().map(|entry| entry.unwrap().path())
                .filter(|path| path.extension().is_some_and(|ext| ext == "rs"))
                .map(|path| path.file_stem().unwrap().to_str().unwrap().to_owned())
                .filter(|name| name != "integration")
                .collect();
            assert_eq!(registered, files, "register new test files in integration_tests!");
        }
    };
}

integration_tests!(
    accept_thread_survives_silent_connections,
    accessibility_names,
    backspace_surrogate,
    binding_called_session,
    call_function_on_object_id_arg,
    cdp_click_submit_parity,
    cdp_ws_origin_policy,
    child_frame_tree,
    concurrent_connections_heavy_page,
    concurrent_navigations,
    concurrent_navigations_with_fetch,
    concurrent_page_isolation,
    connection_storage_isolation,
    control_plane_unblocked,
    document_write_lifecycle,
    dom_get_outer_html_object_id,
    dom_node_queries,
    dynamic_script_onload_fires,
    dynamic_stylesheet_onload_fires,
    execution_context_ownership,
    execution_context_pruned_on_navigation,
    file_navigation_gate,
    file_upload_integrity,
    form_submission_ownership,
    form_submit_method_bypasses_listener,
    html_serialization_escaping,
    iframe_event_dispatch,
    input_activation_author_accessors,
    input_key_event_escaping,
    input_mouse_event_parity,
    input_mouse_label_activation,
    js_fetch_emits_network_events,
    legacy_table_apis,
    lifecycle_replay,
    max_connections_cap,
    module_network_events,
    nodefilter_constants,
    page_close_destroys_target,
    page_frame_contract,
    runtime_by_value_undefined,
    runtime_console_events,
    runtime_get_properties_objectid_escaping,
    runtime_primitives,
    scroll_event_on_assignment,
    structured_clone_crypto_parity,
    textarea_enter_selection,
    treewalker_document_order,
    window_conformance_parity,
);