Skip to content

Commit

Permalink
[JENKINS-43990] Implement kind of wait for element.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evaristo Gutiérrez committed May 4, 2017
1 parent afa011d commit d490bca
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/test/java/hudson/matrix/AxisTest.java
Expand Up @@ -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.