Skip to content
Permalink
Browse files

[JENKINS-43990] Implement kind of wait for element.

  • Loading branch information
Evaristo Gutiérrez
Evaristo Gutiérrez committed May 4, 2017
1 parent afa011d commit d490bca746e0c1ebd7bd9ca6ed02bbbdecf54c04
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/test/java/hudson/matrix/AxisTest.java
@@ -142,7 +142,19 @@ private HtmlForm addAxis(String axis) throws Exception {
HtmlForm form = page.getFormByName("config");
j.getButtonByCaption(form, "Add axis").click();
page.getAnchorByText(axis).click();
Thread.sleep(300);
waitForInput(form);
return form;
}

private void waitForInput(HtmlForm form) throws InterruptedException {
int numberInputs = form.getInputsByName("_.name").size();
int tries = 30;
while (tries > 0 && numberInputs == 0) {
tries--;
Thread.sleep(10);
numberInputs = form.getInputsByName("_.name").size();
}

assertThat("Input should have appeared", numberInputs != 0);
}
}

0 comments on commit d490bca

Please sign in to comment.
You can’t perform that action at this time.