fix(examples): websocket tests fail (occasionally) second attemp (#3910)

do not check the label immediately
This commit is contained in:
Saber Haj Rabiee
2025-05-01 11:54:57 -07:00
committed by GitHub
parent 2e393aaca0
commit a7bb2565c4
4 changed files with 2 additions and 22 deletions

View File

@@ -10,19 +10,9 @@ pub async fn goto_path(client: &Client, path: &str) -> Result<()> {
Ok(())
}
pub async fn add_text(client: &Client, text: &str) -> Result<String> {
fill_input(client, text).await?;
get_label(client).await
}
pub async fn fill_input(client: &Client, text: &str) -> Result<()> {
let textbox = find::input(client).await;
textbox.send_keys(text).await?;
Ok(())
}
pub async fn get_label(client: &Client) -> Result<String> {
let label = find::label(client).await;
Ok(label.text().await?)
}

View File

@@ -9,13 +9,3 @@ pub async fn input(client: &Client) -> Element {
textbox
}
pub async fn label(client: &Client) -> Element {
let label = client
.wait()
.for_element(Locator::Css("p"))
.await
.expect("");
label
}

View File

@@ -14,7 +14,7 @@ async fn i_open_the_app(world: &mut AppWorld) -> Result<()> {
#[given(regex = "^I add a text as (.*)$")]
async fn i_add_a_text(world: &mut AppWorld, text: String) -> Result<()> {
let client = &world.client;
action::add_text(client, text.as_str()).await?;
action::fill_input(client, text.as_str()).await?;
Ok(())
}

View File

@@ -20,7 +20,7 @@ async fn i_see_the_label_of_the_input_is(
world: &mut AppWorld,
text: String,
) -> Result<()> {
sleep(Duration::from_millis(50)).await;
sleep(Duration::from_millis(500)).await;
let client = &world.client;
check::text_on_element(client, "p", &text).await?;