use super::{BrowserContext, DEFAULT_TEST_ID_ATTRIBUTE};
impl BrowserContext {
pub async fn set_test_id_attribute(&self, name: impl Into<String>) {
let mut attr = self.test_id_attribute.write().await;
*attr = name.into();
}
pub async fn test_id_attribute(&self) -> String {
self.test_id_attribute.read().await.clone()
}
pub(crate) fn test_id_attribute_blocking(&self) -> String {
self.test_id_attribute.try_read().map_or_else(
|_| DEFAULT_TEST_ID_ATTRIBUTE.to_string(),
|guard| guard.clone(),
)
}
}