Skip to content

Commit

Permalink
makes form completion more resilient in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nubis committed Apr 15, 2023
1 parent c94dbb9 commit 62e49b7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions integration_tests/src/selenium.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,14 @@ impl Selenium {
}

pub async fn delete_letters_and_send_new_keys(&self, selector: &str, times: i32, new_keys: &str) {
let element = self.driver.find(By::Css(selector)).await.expect("to find {selector}");
let element = self.driver.find(By::Css(selector)).await.expect("to find {selector} for deletion");
for _ in 0..times {
element.send_keys(Key::Backspace.to_string()).await.expect("to delete in {selector}");
let _ = element.send_keys(Key::Backspace.to_string()).await;
}
element.send_keys(new_keys).await.expect("to fill in {selector}");
self.driver.find(By::Css(selector)).await
.expect("to find {selector} after deletion and possible redraw.")
.send_keys(new_keys).await
.expect(&format!("to fill in {selector}"));
}

pub async fn get_handles_and_go_to_window_one(&self) -> Vec<WindowHandle> {
Expand Down

0 comments on commit 62e49b7

Please sign in to comment.