webClient.setAjaxController(new NicelyResynchronizingAjaxController());
HtmlPage storm = webClient.getPage(getPath("storm-ajax.jsf"));
// Begin long-running conversation - note that we use ajax
HtmlSubmitInput beginConversationButton = getFirstMatchingElement(storm, HtmlSubmitInput.class,
"beginConversationButton");
storm = beginConversationButton.click();
String cid = getFirstMatchingElement(storm, HtmlInput.class, "conversationId").getValueAttribute();
assertFalse(cid.isEmpty());
// Set input value
HtmlTextInput stormStrength = getFirstMatchingElement(storm, HtmlTextInput.class, "stormStrength");
stormStrength.setValueAttribute(AJAX_STORM_STRENGTH);
// Submit value - note that we use ajax
HtmlSubmitInput thunderButton = getFirstMatchingElement(storm, HtmlSubmitInput.class, "thunderButton");
thunderButton.click();
HtmlPage thunder = webClient.getPage(getPath("thunder.jsf", cid));
stormStrength = getFirstMatchingElement(thunder, HtmlTextInput.class, "stormStrength");
assertEquals(stormStrength.getValueAttribute(), AJAX_STORM_STRENGTH);
}