use of com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput in project faces by jakartaee.
the class Issue2767IT method testCommandLinkRadio.
/**
* @see AjaxBehavior
* @see https://github.com/eclipse-ee4j/mojarra/issues/2771
*/
@Test
public void testCommandLinkRadio() throws Exception {
HtmlPage page = getPage("issue2767.xhtml");
HtmlAnchor anchor = (HtmlAnchor) page.getElementById("testLink");
// This will ensure JavaScript finishes before evaluating the page.
webClient.waitForBackgroundJavaScript(3000);
anchor.click();
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("LINK ACTION"));
HtmlRadioButtonInput radio1 = (HtmlRadioButtonInput) page.getElementById("testRadio:0");
HtmlRadioButtonInput radio2 = (HtmlRadioButtonInput) page.getElementById("testRadio:1");
HtmlRadioButtonInput radio3 = (HtmlRadioButtonInput) page.getElementById("testRadio:2");
page = radio1.click();
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("RADIO:red"));
page = radio2.click();
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("RADIO:blue"));
page = radio3.click();
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("RADIO:white"));
}
use of com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput in project faces by jakartaee.
the class Issue2408IT method testSelectOneRadioIdsInComposite.
/**
* This test verifies correct function of SelectOneRadio in a Composite
* Component over Ajax. The components in the page have ids.
*/
@Test
public void testSelectOneRadioIdsInComposite() throws Exception {
HtmlPage page = getPage("selectOneRadioIdsInComposite.xhtml");
// This will ensure JavaScript finishes before evaluating the page.
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("Status: Pending"));
HtmlRadioButtonInput radio1 = (HtmlRadioButtonInput) page.getElementById("form:compId:radio:0");
page = radio1.click();
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("Status: radio-1"));
HtmlRadioButtonInput radio2 = (HtmlRadioButtonInput) page.getElementById("form:compId:radio:1");
page = radio2.click();
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("Status: radio-2"));
HtmlRadioButtonInput radio3 = (HtmlRadioButtonInput) page.getElementById("form:compId:radio:2");
page = radio3.click();
webClient.waitForBackgroundJavaScript(3000);
assertTrue(page.asXml().contains("Status: radio-3"));
}
use of com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput in project faces by jakartaee.
the class Issue4330IT method testIssue4330.
/**
* @see HtmlSelectManyCheckbox
* @see UISelectItem#isItemDisabled()
* @see https://github.com/eclipse-ee4j/mojarra/issues/4330
*/
@Test
public void testIssue4330() throws Exception {
HtmlPage page;
HtmlRadioButtonInput disabledRadio;
HtmlCheckBoxInput enabledCheckbox;
HtmlCheckBoxInput disabledCheckbox;
HtmlButtonInput hack;
HtmlSubmitInput submit;
page = getPage("issue4330.xhtml");
assertTrue(page.getHtmlElementById("form:result").asNormalizedText().isEmpty());
disabledRadio = page.getHtmlElementById("form:one:1");
enabledCheckbox = page.getHtmlElementById("form:many:0");
disabledCheckbox = page.getHtmlElementById("form:many:1");
hack = page.getHtmlElementById("form:hack");
submit = page.getHtmlElementById("form:submit");
assertTrue(disabledRadio.isDisabled());
assertTrue(disabledCheckbox.isDisabled());
hack.click();
webClient.waitForBackgroundJavaScript(1000);
assertFalse(disabledRadio.isDisabled());
assertFalse(disabledCheckbox.isDisabled());
disabledRadio.setChecked(true);
enabledCheckbox.setChecked(true);
disabledCheckbox.setChecked(true);
page = submit.click();
// Thus not "disabled[enabled, disabled]"
assertTrue(page.getHtmlElementById("form:result").asNormalizedText().equals("[enabled]"));
}
use of com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput in project throttle-concurrent-builds-plugin by jenkinsci.
the class ThrottleQueueTaskDispatcherTest method configureNewNodeWithLabel.
private void configureNewNodeWithLabel(String label) throws IOException {
URL url = new URL(r.getURL() + "computer/new");
HtmlPage page = r.createWebClient().getPage(url);
HtmlForm form = page.getFormByName("createItem");
HtmlInput input = form.getInputByName("name");
input.setValueAttribute("test");
List<HtmlRadioButtonInput> radios = form.getRadioButtonsByName("mode");
for (HtmlRadioButtonInput radio : radios) {
radio.setChecked(radio.getValueAttribute().equals("hudson.slaves.DumbSlave"));
}
page = submitForm(form);
boolean buttonFound;
List<HtmlForm> forms = page.getForms();
for (HtmlForm aForm : forms) {
if (aForm.getActionAttribute().equals("doCreateItem")) {
form = aForm;
break;
}
}
input = form.getInputByName("_.numExecutors");
input.setValueAttribute("1");
input = form.getInputByName("_.remoteFS");
input.setValueAttribute("/");
input = form.getInputByName("_.labelString");
input.setValueAttribute(label);
List<HtmlButton> buttons = HtmlUnitHelper.getButtonsByXPath(form, buttonsXPath);
buttonFound = buttonFoundThusFormSubmitted(form, buttons, saveButtonText);
failWithMessageIfButtonNotFoundOnPage(buttonFound, saveButtonText, url);
}
use of com.gargoylesoftware.htmlunit.html.HtmlRadioButtonInput in project throttle-concurrent-builds-plugin by jenkinsci.
the class ThrottleQueueTaskDispatcherTest method configureJobThrottling.
private void configureJobThrottling(FreeStyleProject project) throws IOException {
URL url = new URL(r.getURL() + project.getUrl() + configUrlSuffix);
HtmlPage page = r.createWebClient().getPage(url);
HtmlForm form = page.getFormByName(configFormName);
List<HtmlButton> buttons = HtmlUnitHelper.getButtonsByXPath(form, buttonsXPath);
String buttonText = saveButtonText;
boolean buttonFound = false;
for (HtmlButton button : buttons) {
if (button.getTextContent().equals(buttonText)) {
buttonFound = true;
String checkboxName = "throttleEnabled";
HtmlElement checkbox = page.getElementByName(checkboxName);
assertNotNull(checkboxName + " checkbox not found on test job config page; plugin installed?", checkbox);
checkbox.click();
List<HtmlRadioButtonInput> radios = form.getRadioButtonsByName("throttleOption");
for (HtmlRadioButtonInput radio : radios) {
radio.setChecked(radio.getValueAttribute().equals("category"));
}
checkbox = page.getElementByName("categories");
checkbox.click();
button.click();
break;
}
}
failWithMessageIfButtonNotFoundOnPage(buttonFound, buttonText, url);
}
Aggregations