mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 09:54:41 -05:00
fix(examples): websocket tests fail (occasionally) second attemp (#3910)
do not check the label immediately
This commit is contained in:
10
examples/websocket/e2e/tests/fixtures/action.rs
vendored
10
examples/websocket/e2e/tests/fixtures/action.rs
vendored
@@ -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?)
|
||||
}
|
||||
|
||||
10
examples/websocket/e2e/tests/fixtures/find.rs
vendored
10
examples/websocket/e2e/tests/fixtures/find.rs
vendored
@@ -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
|
||||
}
|
||||
|
||||
@@ -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(())
|
||||
}
|
||||
|
||||
@@ -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?;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user