More informative error message when `ViewDescriptorTest` fails
package hudson.model;
+import static org.awaitility.Awaitility.await;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
@@ -35,7 +37,6 @@ import java.util.TreeSet;
import java.util.concurrent.TimeUnit;
import jenkins.model.DirectlyModifiableTopLevelItemGroup;
import net.sf.json.JSONObject;
-import org.awaitility.Awaitility;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
@@ -111,8 +112,7 @@ public class ViewDescriptorTest {
.getSomeProperty());
//WHEN the users goes with "Edit View" on the configure page
- JenkinsRule.WebClient webClient = r.createWebClient();
- HtmlPage editViewPage = webClient.getPage(myListView, "configure");
+ HtmlPage editViewPage = r.createWebClient().getPage(myListView, "configure");
//THEN the invisible property is not displayed on page
assertFalse("CustomInvisibleProperty should not be displayed on the View edition page UI.",
@@ -124,10 +124,9 @@ public class ViewDescriptorTest {
r.submit(editViewForm);
//Check that the description is updated on view
- Awaitility.waitAtMost(10, TimeUnit.SECONDS).until(() -> webClient.getPage(myListView)
- .asNormalizedText()
- .contains("This list view is awesome !"));
-
+ await().pollInterval(1, TimeUnit.SECONDS)
+ .atMost(10, TimeUnit.SECONDS)
+ .until(() -> r.createWebClient().getPage(myListView).asNormalizedText(), containsString("This list view is awesome !"));
//AND THEN after View save, the invisible property is still persisted with the View.
assertNotNull("The CustomInvisibleProperty should be persisted on the View.",
