From 5de1148c871a69957b584db4f32ab10e9ce0e79b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABlle=20Huisman?= Date: Sat, 16 Aug 2025 14:36:05 +0200 Subject: [PATCH] fix(dom): remove option from get_by and find_by queries --- book/src/core/user-actions/firing-events.md | 4 +- packages/dom/src/get_queries_for_element.rs | 12 ++-- packages/dom/src/lib.rs | 2 + packages/dom/src/queries/alt_text.rs | 2 +- packages/dom/src/queries/display_value.rs | 2 +- packages/dom/src/queries/label_text.rs | 2 +- packages/dom/src/queries/placeholder_text.rs | 2 +- packages/dom/src/queries/role.rs | 2 +- packages/dom/src/queries/test_id.rs | 2 +- packages/dom/src/queries/text.rs | 2 +- packages/dom/src/queries/title.rs | 2 +- packages/dom/src/query_helpers.rs | 29 ++++----- packages/dom/src/wait_for.rs | 2 +- packages/dom/tests/aria_attributes.rs | 20 ++---- packages/dom/tests/element_queries.rs | 65 ++++++++++---------- packages/dom/tests/role_helpers.rs | 35 ----------- 16 files changed, 70 insertions(+), 115 deletions(-) diff --git a/book/src/core/user-actions/firing-events.md b/book/src/core/user-actions/firing-events.md index 179f117..d90921b 100644 --- a/book/src/core/user-actions/firing-events.md +++ b/book/src/core/user-actions/firing-events.md @@ -26,9 +26,7 @@ event.set_bubbles(true); event.set_cancelable(true); fire_event( - get_by_text(&container, "Submit") - .expect("Get should succeed.") - .expect("Get should return an element."), + get_by_text(&container, "Submit").expect("Get should succeed."), &event, ).expect("Event should be fired."); ``` diff --git a/packages/dom/src/get_queries_for_element.rs b/packages/dom/src/get_queries_for_element.rs index 3ea40da..7afd44a 100644 --- a/packages/dom/src/get_queries_for_element.rs +++ b/packages/dom/src/get_queries_for_element.rs @@ -19,29 +19,29 @@ macro_rules! queries_for_element { ($(($name:ident, $matcher_type:ty, $options_type:ty)),*,) => { paste::paste! { impl BoundFunctions { - $(pub fn [< find_by_ $name >]>( + $(pub async fn [< find_by_ $name >]>( &self, matcher: M, options: $options_type, wait_for_options: WaitForOptions, - ) -> Result, QueryError> { - [< find_by_ $name >](&self.element, matcher, options, wait_for_options) + ) -> Result { + [< find_by_ $name >](&self.element, matcher, options, wait_for_options).await })* - $(pub fn [< find_all_by_ $name >]>( + $(pub async fn [< find_all_by_ $name >]>( &self, matcher: M, options: $options_type, wait_for_options: WaitForOptions, ) -> Result, QueryError> { - [< find_all_by_ $name >](&self.element, matcher, options, wait_for_options) + [< find_all_by_ $name >](&self.element, matcher, options, wait_for_options).await })* $(pub fn [< get_by_ $name >]>( &self, matcher: M, options: $options_type, - ) -> Result, QueryError> { + ) -> Result { [< get_by_ $name >](&self.element, matcher, options) })* diff --git a/packages/dom/src/lib.rs b/packages/dom/src/lib.rs index 00766b2..9c914cb 100644 --- a/packages/dom/src/lib.rs +++ b/packages/dom/src/lib.rs @@ -20,6 +20,7 @@ pub use config::{configure, get_config}; pub use error::QueryError; pub use events::*; pub use get_node_text::*; +pub use get_queries_for_element::get_queries_for_element as within; pub use get_queries_for_element::*; pub use matches::get_default_normalizer; pub use pretty_dom::*; @@ -34,4 +35,5 @@ pub use types::*; pub use wait_for::*; // TODO: Export useful types from `aria_query`. +#[doc(no_inline)] pub use aria_query::{AriaRole, AriaRoleDefinitionKey}; diff --git a/packages/dom/src/queries/alt_text.rs b/packages/dom/src/queries/alt_text.rs index ac96e13..ef4e7f4 100644 --- a/packages/dom/src/queries/alt_text.rs +++ b/packages/dom/src/queries/alt_text.rs @@ -8,7 +8,7 @@ use crate::{ types::{Matcher, MatcherOptions}, }; -pub fn _query_all_by_alt_text>( +pub(crate) fn _query_all_by_alt_text>( container: &HtmlElement, alt: M, options: MatcherOptions, diff --git a/packages/dom/src/queries/display_value.rs b/packages/dom/src/queries/display_value.rs index b3dd430..780cdd5 100644 --- a/packages/dom/src/queries/display_value.rs +++ b/packages/dom/src/queries/display_value.rs @@ -10,7 +10,7 @@ use crate::{ util::{html_collection_to_vec, node_list_to_vec}, }; -pub fn _query_all_by_display_value>( +pub(crate) fn _query_all_by_display_value>( container: &HtmlElement, value: M, options: MatcherOptions, diff --git a/packages/dom/src/queries/label_text.rs b/packages/dom/src/queries/label_text.rs index a9decbe..bf33037 100644 --- a/packages/dom/src/queries/label_text.rs +++ b/packages/dom/src/queries/label_text.rs @@ -10,7 +10,7 @@ use crate::{ util::node_list_to_vec, }; -pub fn _query_all_by_label_text>( +pub(crate) fn _query_all_by_label_text>( container: &HtmlElement, text: M, options: SelectorMatcherOptions, diff --git a/packages/dom/src/queries/placeholder_text.rs b/packages/dom/src/queries/placeholder_text.rs index d524a29..1d8f531 100644 --- a/packages/dom/src/queries/placeholder_text.rs +++ b/packages/dom/src/queries/placeholder_text.rs @@ -7,7 +7,7 @@ use crate::{ types::{Matcher, MatcherOptions}, }; -pub fn _query_all_by_placeholder_text>( +pub(crate) fn _query_all_by_placeholder_text>( container: &HtmlElement, text: M, options: MatcherOptions, diff --git a/packages/dom/src/queries/role.rs b/packages/dom/src/queries/role.rs index cc25a82..2db3a4f 100644 --- a/packages/dom/src/queries/role.rs +++ b/packages/dom/src/queries/role.rs @@ -21,7 +21,7 @@ use crate::{ util::node_list_to_vec, }; -pub fn _query_all_by_role>( +pub(crate) fn _query_all_by_role>( container: &HtmlElement, role: M, options: ByRoleOptions, diff --git a/packages/dom/src/queries/test_id.rs b/packages/dom/src/queries/test_id.rs index 40fac3c..851122a 100644 --- a/packages/dom/src/queries/test_id.rs +++ b/packages/dom/src/queries/test_id.rs @@ -12,7 +12,7 @@ fn get_test_id_attribute() -> String { get_config().test_id_attribute } -pub fn _query_all_by_test_id>( +pub(crate) fn _query_all_by_test_id>( container: &HtmlElement, id: M, options: MatcherOptions, diff --git a/packages/dom/src/queries/text.rs b/packages/dom/src/queries/text.rs index 2018b8b..c0c2737 100644 --- a/packages/dom/src/queries/text.rs +++ b/packages/dom/src/queries/text.rs @@ -10,7 +10,7 @@ use crate::{ util::node_list_to_vec, }; -pub fn _query_all_by_text>( +pub(crate) fn _query_all_by_text>( container: &HtmlElement, text: M, options: SelectorMatcherOptions, diff --git a/packages/dom/src/queries/title.rs b/packages/dom/src/queries/title.rs index 2ad61be..73d8b3a 100644 --- a/packages/dom/src/queries/title.rs +++ b/packages/dom/src/queries/title.rs @@ -18,7 +18,7 @@ fn is_svg_title(node: &HtmlElement) -> bool { .is_some_and(|parent_node| parent_node.tag_name().to_lowercase() == "svg") } -pub fn _query_all_by_title>( +pub(crate) fn _query_all_by_title>( container: &HtmlElement, text: M, options: MatcherOptions, diff --git a/packages/dom/src/query_helpers.rs b/packages/dom/src/query_helpers.rs index 648f934..27dfe5f 100644 --- a/packages/dom/src/query_helpers.rs +++ b/packages/dom/src/query_helpers.rs @@ -93,12 +93,12 @@ pub fn get_suggestion_error(suggestion: String, container: Element) -> QueryErro #[macro_export] macro_rules! make_single_query { - ($all_query:ident, $get_multiple_error:ident, $name:ident, $matcher_type:ty, $options_type:ty) => { + ($all_query:ident, $get_multiple_error:ident, $name:ident, $matcher_type:ty, $options_type:ty, $return_type:ty, $func:ident $(,$args:literal)*) => { pub fn $name>( container: &HtmlElement, matcher: M, options: $options_type, - ) -> Result, QueryError> { + ) -> Result<$return_type, QueryError> { let matcher = matcher.into(); let mut els = $all_query(container, matcher.clone(), options.clone())?; @@ -118,7 +118,7 @@ macro_rules! make_single_query { container.clone().into(), )) } else { - Ok(els.pop()) + Ok(Vec::$func(&mut els $(,$args)*)) } } }; @@ -150,7 +150,7 @@ macro_rules! make_get_all_query { #[macro_export] macro_rules! make_find_query { ($getter:ident, $name:ident, $matcher_type:ty, $options_type:ty, $return_type:ty) => { - pub fn $name>( + pub async fn $name>( container: &HtmlElement, matcher: M, options: $options_type, @@ -164,22 +164,23 @@ macro_rules! make_find_query { }, wait_for_options.container(container.clone()), ) + .await } }; } #[macro_export] macro_rules! wrap_single_query_with_suggestion { - ($query:ident, $query_by_all_name:expr_2021, $variant:expr_2021, $name:ident, $matcher_type:ty, $options_type:ty) => { + ($query:ident, $query_by_all_name:expr, $variant:expr, $name:ident, $matcher_type:ty, $options_type:ty, $return_type:ty) => { pub fn $name>( container: &HtmlElement, matcher: M, options: $options_type, - ) -> Result, QueryError> { + ) -> Result<$return_type, QueryError> { let element = $query(container, matcher, options)?; let suggest = get_config().throw_suggestions; - if let Some(element) = element.as_ref() { + if let Some(element) = Option::<&HtmlElement>::from(&element) { if suggest { let suggestion = get_suggested_query(element, Some($variant), None); if let Some(suggestion) = suggestion { @@ -200,7 +201,7 @@ macro_rules! wrap_single_query_with_suggestion { #[macro_export] macro_rules! wrap_all_by_query_with_suggestion { - ($query:ident, $query_by_all_name:expr_2021, $variant:expr_2021, $name:ident, $matcher_type:ty, $options_type:ty) => { + ($query:ident, $query_by_all_name:expr, $variant:expr, $name:ident, $matcher_type:ty, $options_type:ty) => { pub fn $name>( container: &HtmlElement, matcher: M, @@ -240,10 +241,10 @@ macro_rules! build_queries { $crate::wrap_all_by_query_with_suggestion!($query_by_all, stringify!($query_by_all), Variant::QueryAll, [], $matcher_type, $options_type); // Internal query by - $crate::make_single_query!($query_by_all, $get_multiple_error, [<_query_by_ $name>], $matcher_type, $options_type); + $crate::make_single_query!($query_by_all, $get_multiple_error, [<_query_by_ $name>], $matcher_type, $options_type, Option, pop); // Query by - $crate::wrap_single_query_with_suggestion!([<_query_by_ $name>], stringify!($query_by_all), Variant::Query, [], $matcher_type, $options_type); + $crate::wrap_single_query_with_suggestion!([<_query_by_ $name>], stringify!($query_by_all), Variant::Query, [], $matcher_type, $options_type, Option); // Internal get all by $crate::make_get_all_query!($query_by_all, $get_missing_error, [<_get_all_by_ $name>], $matcher_type, $options_type); @@ -252,10 +253,10 @@ macro_rules! build_queries { $crate::wrap_all_by_query_with_suggestion!([<_get_all_by_ $name>], stringify!($query_by_all).replace("query", "get"), Variant::GetAll, [], $matcher_type, $options_type); // Internal get by - $crate::make_single_query!([<_get_all_by_ $name>], $get_multiple_error, [<_get_by_ $name>], $matcher_type, $options_type); + $crate::make_single_query!([<_get_all_by_ $name>], $get_multiple_error, [<_get_by_ $name>], $matcher_type, $options_type, HtmlElement, swap_remove, 0); // Get by - $crate::wrap_single_query_with_suggestion!([<_get_by_ $name>], stringify!($query_by_all), Variant::Get, [], $matcher_type, $options_type); + $crate::wrap_single_query_with_suggestion!([<_get_by_ $name>], stringify!($query_by_all), Variant::Get, [], $matcher_type, $options_type, HtmlElement); // Internal find all by $crate::wrap_all_by_query_with_suggestion!([<_get_all_by_ $name>], stringify!($query_by_all), Variant::FindAll, [<_find_all_by_ $name>], $matcher_type, $options_type); @@ -264,10 +265,10 @@ macro_rules! build_queries { $crate::make_find_query!([<_find_all_by_ $name>], [], $matcher_type, $options_type, Vec); // Internal find by - $crate::wrap_single_query_with_suggestion!([<_get_by_ $name>], stringify!($query_by_all), Variant::Find, [<_find_by_ $name>], $matcher_type, $options_type); + $crate::wrap_single_query_with_suggestion!([<_get_by_ $name>], stringify!($query_by_all), Variant::Find, [<_find_by_ $name>], $matcher_type, $options_type, HtmlElement); // Find by - $crate::make_find_query!([<_find_by_ $name>], [], $matcher_type, $options_type, Option); + $crate::make_find_query!([<_find_by_ $name>], [], $matcher_type, $options_type, HtmlElement); } } }; diff --git a/packages/dom/src/wait_for.rs b/packages/dom/src/wait_for.rs index 630c172..e849647 100644 --- a/packages/dom/src/wait_for.rs +++ b/packages/dom/src/wait_for.rs @@ -1,5 +1,5 @@ use crate::types::WaitForOptions; -pub fn wait_for(callback: Box T>, _options: WaitForOptions) -> T { +pub async fn wait_for(callback: Box T>, _options: WaitForOptions) -> T { callback() } diff --git a/packages/dom/tests/aria_attributes.rs b/packages/dom/tests/aria_attributes.rs index 07ac0fe..c959dbe 100644 --- a/packages/dom/tests/aria_attributes.rs +++ b/packages/dom/tests/aria_attributes.rs @@ -103,14 +103,12 @@ fn busy_true_false_matches_busy_regions() { assert!( container_queries .get_by_role(AriaRole::Log, ByRoleOptions::default().busy(true)) - .expect("Get should succeed.") - .is_some(), + .is_ok() ); assert!( container_queries .get_by_role(AriaRole::Log, ByRoleOptions::default().busy(false)) - .expect("Get should succeed.") - .is_some(), + .is_ok() ); } @@ -128,14 +126,12 @@ fn checked_true_false_matches_checked_checkboxes() { assert!( container_queries .get_by_role(AriaRole::Checkbox, ByRoleOptions::default().checked(true)) - .expect("Get should succeed.") - .is_some(), + .is_ok() ); assert!( container_queries .get_by_role(AriaRole::Checkbox, ByRoleOptions::default().checked(false)) - .expect("Get should succeed.") - .is_some(), + .is_ok(), ); } @@ -153,14 +149,12 @@ fn checked_true_false_matches_checked_elements_with_proper_role() { assert!( container_queries .get_by_role(AriaRole::Checkbox, ByRoleOptions::default().checked(true)) - .expect("Get should succeed.") - .is_some(), + .is_ok() ); assert!( container_queries .get_by_role(AriaRole::Checkbox, ByRoleOptions::default().checked(false)) - .expect("Get should succeed.") - .is_some(), + .is_ok() ); } @@ -179,13 +173,11 @@ fn checked_true_false_does_not_match_element_in_indeterminate_state() { container_queries .get_by_label_text("indeteminate yes", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .expect("Get should return a result.") .unchecked_into::() .set_indeterminate(true); container_queries .get_by_label_text("indeteminate no", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .expect("Get should return a result.") .unchecked_into::() .set_indeterminate(true); diff --git a/packages/dom/tests/element_queries.rs b/packages/dom/tests/element_queries.rs index 811b18c..9f0e7eb 100644 --- a/packages/dom/tests/element_queries.rs +++ b/packages/dom/tests/element_queries.rs @@ -435,64 +435,64 @@ fn can_get_form_controls_by_label_text() { container_queries .get_by_label_text("1st", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("first-id".to_owned()) + .id(), + "first-id" ); assert_eq!( container_queries .get_by_label_text("2nd", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("second-id".to_owned()) + .id(), + "second-id" ); assert_eq!( container_queries .get_by_label_text("3rd", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("third-id".to_owned()) + .id(), + "third-id" ); assert_eq!( container_queries .get_by_label_text("4th", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("fourth-id".to_owned()) + .id(), + "fourth-id" ); assert_eq!( container_queries .get_by_label_text("5th one", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("fifth-id".to_owned()) + .id(), + "fifth-id" ); assert_eq!( container_queries .get_by_label_text("5th two", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("fifth-id".to_owned()) + .id(), + "fifth-id" ); assert_eq!( container_queries .get_by_label_text("6th one", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("sixth-id".to_owned()) + .id(), + "sixth-id" ); assert_eq!( container_queries .get_by_label_text("6th two", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("sixth-id".to_owned()) + .id(), + "sixth-id" ); assert_eq!( container_queries .get_by_label_text("6th one 6th two", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("sixth-id".to_owned()) + .id(), + "sixth-id" ); assert_eq!( container_queries @@ -501,22 +501,22 @@ fn can_get_form_controls_by_label_text() { SelectorMatcherOptions::default() ) .expect("Get should succeed.") - .map(|element| element.id()), - Some("sixth-id".to_owned()) + .id(), + "sixth-id" ); assert_eq!( container_queries .get_by_label_text("7th one", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("seventh-id".to_owned()) + .id(), + "seventh-id" ); assert_eq!( container_queries .get_by_label_text("8th one", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("eighth.id".to_owned()) + .id(), + "eighth.id" ); } @@ -553,8 +553,8 @@ fn can_get_elements_labelled_with_aria_labelledby_attribute() { container_queries .get_by_label_text("Section One", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.id()), - Some("section-one".to_owned()) + .id(), + "section-one" ); } @@ -649,8 +649,8 @@ fn can_find_any_labelable_element_when_label_text_is_inside_other_elements() { SelectorMatcherOptions::default().selector(node_type) ) .expect("Get should succeed.") - .map(|element| element.node_name()), - Some(node_type.to_uppercase()) + .node_name(), + node_type.to_uppercase() ); } } @@ -683,8 +683,8 @@ fn returns_the_labelable_element_control_inside_a_label() { container_queries .get_by_label_text("Test Label", SelectorMatcherOptions::default()) .expect("Get should succeed.") - .map(|element| element.node_name()), - Some("BUTTON".to_owned()) + .node_name(), + "BUTTON" ); } @@ -742,10 +742,7 @@ fn can_find_the_correct_element_when_there_are_multiple_matching_labels() { ) .expect("Get should succeed."); - assert_eq!( - result.map(|element| element.node_name()), - Some("INPUT".to_owned()) - ); + assert_eq!(result.node_name(), "INPUT"); } #[wasm_bindgen_test] diff --git a/packages/dom/tests/role_helpers.rs b/packages/dom/tests/role_helpers.rs index b3d998e..0580929 100644 --- a/packages/dom/tests/role_helpers.rs +++ b/packages/dom/tests/role_helpers.rs @@ -124,177 +124,142 @@ fn setup() -> Setup { unnamed_section: container_queries .get_by_test_id("a-section", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), named_section: container_queries .get_by_test_id("named-section", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), anchor: container_queries .get_by_test_id("a-link", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), h1: container_queries .get_by_test_id("a-h1", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), h2: container_queries .get_by_test_id("a-h2", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), h3: container_queries .get_by_test_id("a-h3", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), nav: container_queries .get_by_test_id("a-nav", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), article: container_queries .get_by_test_id("a-article", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), a_ul: container_queries .get_by_test_id("a-list", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), a_li1: container_queries .get_by_test_id("a-list-item-1", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), a_li2: container_queries .get_by_test_id("a-list-item-2", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), b_ul: container_queries .get_by_test_id("b-list", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), b_li1: container_queries .get_by_test_id("b-list-item-1", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), b_li2: container_queries .get_by_test_id("b-list-item-2", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), table: container_queries .get_by_test_id("a-table", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), tbody: container_queries .get_by_test_id("a-tbody", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), tr: container_queries .get_by_test_id("a-row", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), td1: container_queries .get_by_test_id("a-cell-1", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), td2: container_queries .get_by_test_id("a-cell-2", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), td3: container_queries .get_by_test_id("a-cell-3", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), unnamed_form: container_queries .get_by_test_id("a-form", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), named_form: container_queries .get_by_test_id("named-form", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), radio: container_queries .get_by_test_id("a-radio-1", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), radio2: container_queries .get_by_test_id("a-radio-2", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), input: container_queries .get_by_test_id("a-input-1", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), input2: container_queries .get_by_test_id("a-input-2", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), textarea: container_queries .get_by_test_id("a-textarea", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), dt: container_queries .get_by_test_id("a-dt", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), dd: container_queries .get_by_test_id("a-dd", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), header: container_queries .get_by_test_id("a-header", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), invalid_anchor: container_queries .get_by_test_id("invalid-link", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), unnamed_img: container_queries .get_by_test_id("a-img-1", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), presentation_img: container_queries .get_by_test_id("a-img-2", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), named_img: container_queries .get_by_test_id("a-img-3", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), footer: container_queries .get_by_test_id("a-footer", MatcherOptions::default()) .expect("Get should succeed.") - .expect("Query should return an element.") .into(), } }