Search in sources :

Example 1 with HtmlCheckBoxInput

use of com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput in project selenium_java by sergueik.

the class JenkinsConfigurationPage method setAuditReportsPermissionState.

public void setAuditReportsPermissionState(final String userName, final boolean state) {
    final HtmlCheckBoxInput input = getAuditReportsPermissionCheckbox(userName);
    input.setChecked(state);
}
Also used : HtmlCheckBoxInput(com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput)

Example 2 with HtmlCheckBoxInput

use of com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput in project workflow-job-plugin by jenkinsci.

the class WorkflowJobTest method disabled.

@Issue("JENKINS-27299")
@Test
public void disabled() throws Exception {
    WorkflowJob p = j.jenkins.createProject(WorkflowJob.class, "p");
    assertFalse(p.isDisabled());
    assertTrue(p.isBuildable());
    JenkinsRule.WebClient wc = j.createWebClient();
    j.submit(wc.getPage(p).<HtmlForm>getHtmlElementById("disable-project"));
    assertTrue(p.isDisabled());
    assertFalse(p.isBuildable());
    HtmlForm form = wc.getPage(p, "configure").getFormByName("config");
    HtmlCheckBoxInput checkbox = form.getInputByName("disable");
    assertTrue(checkbox.isChecked());
    checkbox.setChecked(false);
    j.submit(form);
    assertFalse(p.isDisabled());
    wc.getPage(new WebRequest(wc.createCrumbedUrl(p.getUrl() + "disable"), HttpMethod.POST));
    assertTrue(p.isDisabled());
    assertNull(p.scheduleBuild2(0));
    assertThat(new CLICommandInvoker(j, "enable-job").invokeWithArgs("p"), CLICommandInvoker.Matcher.succeededSilently());
    assertFalse(p.isDisabled());
}
Also used : HtmlCheckBoxInput(com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput) HtmlForm(com.gargoylesoftware.htmlunit.html.HtmlForm) WebRequest(com.gargoylesoftware.htmlunit.WebRequest) JenkinsRule(org.jvnet.hudson.test.JenkinsRule) CLICommandInvoker(hudson.cli.CLICommandInvoker) Issue(org.jvnet.hudson.test.Issue) Test(org.junit.Test)

Example 3 with HtmlCheckBoxInput

use of com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput in project shiro by apache.

the class ContainerIntegrationIT method logInAndRememberMe.

@Test
public void logInAndRememberMe() throws Exception {
    HtmlPage page = webClient.getPage(getBaseUri() + "login.jsp");
    HtmlForm form = page.getFormByName("loginform");
    form.<HtmlInput>getInputByName("username").setValueAttribute("root");
    form.<HtmlInput>getInputByName("password").setValueAttribute("secret");
    HtmlCheckBoxInput checkbox = form.getInputByName("rememberMe");
    checkbox.setChecked(true);
    page = form.<HtmlInput>getInputByName("submit").click();
    jetty.stop();
    jetty.start();
    page = webClient.getPage(getBaseUri());
    // page.getAnchorByHref("/logout");
    WebAssert.assertLinkPresentWithText(page, "Log out");
    page = page.getAnchorByHref("/account").click();
    // login page should be shown again - user remembered but not authenticated
    WebAssert.assertFormPresent(page, "loginform");
}
Also used : HtmlCheckBoxInput(com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput) HtmlForm(com.gargoylesoftware.htmlunit.html.HtmlForm) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlInput(com.gargoylesoftware.htmlunit.html.HtmlInput) Test(org.junit.Test)

Aggregations

HtmlCheckBoxInput (com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput)3 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)2 Test (org.junit.Test)2 WebRequest (com.gargoylesoftware.htmlunit.WebRequest)1 HtmlInput (com.gargoylesoftware.htmlunit.html.HtmlInput)1 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)1 CLICommandInvoker (hudson.cli.CLICommandInvoker)1 Issue (org.jvnet.hudson.test.Issue)1 JenkinsRule (org.jvnet.hudson.test.JenkinsRule)1