// when button with immediate="true" is pressed.
//
public void testSelectOneRadioTypeInteger() throws Exception {
HtmlPage page = getPage("/faces/jsp/selectOneRadioTypeInteger.jsp");
HtmlSubmitInput nonImmediateButton = null, immediateButton = null;
HtmlRadioButtonInput radio1 = null, radio2 = null, radio3 = null;
List submitList = getAllElementsOfGivenClass(page, null, HtmlSubmitInput.class);
List radioList = getAllElementsOfGivenClass(page, null, HtmlRadioButtonInput.class);
radio1 = (HtmlRadioButtonInput) radioList.get(0);
radio2 = (HtmlRadioButtonInput) radioList.get(1);
radio3 = (HtmlRadioButtonInput) radioList.get(2);
for (int i = 0; i < submitList.size(); i++) {
HtmlSubmitInput result = (HtmlSubmitInput) submitList.get(i);
if (-1 != result.getIdAttribute().indexOf("nonImmediate")) {
nonImmediateButton = result;
} else {
immediateButton = result;
}
}
assertTrue(-1 != page.asText().indexOf("Model Selection:2"));
// now press the immediate button and verify that our original
// selection is there...
page = (HtmlPage) immediateButton.click();
assertTrue(-1 != page.asText().indexOf("Model Selection:2"));
// now click the first radio option...
radio1.setChecked(true);
// now press the immediate button and verify that our original
// selection is there...
page = (HtmlPage) immediateButton.click();
assertTrue(-1 != page.asText().indexOf("Model Selection:2"));
// now click the first radio option...
radio1.setChecked(true);
// now press the non immediate button and verify that our new
// selection is there...
page = (HtmlPage) nonImmediateButton.click();
assertTrue(-1 != page.asText().indexOf("Model Selection:1"));
}