Examples of HtmlForm


Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

        PageDecorator.ALL.add(pageDecoratorImpl);
       
        HtmlPage page = new WebClient().goTo("configure");
        assertXPath(page,"//tr[@name='hudson-pages-SystemConfigurationTestCase$PageDecoratorImpl']");

        HtmlForm form = page.getFormByName("config");
        form.getInputByName("_.decoratorId").setValueAttribute("this_is_a_profile");
        submit(form);
        assertEquals("The decorator field was incorrect", "this_is_a_profile", pageDecoratorImpl.getDecoratorId());
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

    public void testActivated() throws Exception {
        for( int i=0; i<=TooManyJobsButNoView.THRESHOLD; i++ )
            createFreeStyleProject();

        HtmlPage p = new WebClient().goTo("manage");
        HtmlForm f = p.getFormByName(mon.id);
        assertNotNull(f);

        // this should take us to the new view page
        URL url = submit(f,"yes").getWebResponse().getUrl();
        assertTrue(url.toExternalForm(),url.toExternalForm().endsWith("/newView"));
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

        ));
        assertFormContents(VIEW_WITH_DEFAULT, testRepeatable);
    }
       
    private void assertFormContents(final String viewName, final ArrayList<ExcitingObject> expected) throws Exception {
        final HtmlForm form = getForm(viewName);
        final List<HtmlTextInput> inputs = toTextInputList(form.getElementsByAttribute("input", "type", "text"));
        assertEquals("size", expected.size(), inputs.size());
        for (int i = 0; i < expected.size(); i++)
            assertEquals(expected.get(i).greatProperty, inputs.get(i).getValueAttribute());
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

        ));
    }

    private HtmlForm getForm(final String viewName) throws Exception {
        final HtmlPage page = createWebClient().goTo("self/" + viewName);
        final HtmlForm form = page.getFormByName("config");
        return form;
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

* @author Kohsuke Kawaguchi
*/
public class AdvancedButtonTest extends HudsonTestCase {
    public void testNestedOptionalBlock() throws Exception {
        HtmlPage p = createWebClient().goTo("self/testNestedOptionalBlock");
        HtmlForm f = p.getFormByName("config");
        f.getButtonByCaption("Advanced...").click();
        f.getInputByName("c").click();
        submit(f);
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

    @Bug(4423)
    public void testConfiguringBlockBuildWhenUpstreamBuildingRoundtrip() throws Exception {
        FreeStyleProject p = createFreeStyleProject();       
        p.blockBuildWhenUpstreamBuilding = false;
       
        HtmlForm form = new WebClient().getPage(p, "configure").getFormByName("config");
        HtmlInput input = form.getInputByName("blockBuildWhenUpstreamBuilding");
        assertFalse("blockBuildWhenUpstreamBuilding check box is checked.", input.isChecked());
       
        input.setChecked(true);
        submit(form);       
        assertTrue("blockBuildWhenUpstreamBuilding was not updated from configuration form", p.blockBuildWhenUpstreamBuilding);
       
        form = new WebClient().getPage(p, "configure").getFormByName("config");
        input = form.getInputByName("blockBuildWhenUpstreamBuilding");
        assertTrue("blockBuildWhenUpstreamBuilding check box is not checked.", input.isChecked());
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

        wc.setThrowExceptionOnFailingStatusCode(false);

        HtmlPage p = wc.goTo("/");
        System.out.println(p.getDocumentURI());
        assertEquals(200, p.getWebResponse().getStatusCode());
        HtmlForm form = p.getFormByName("login");
        form.getInputByName("j_username").setValueAttribute("alice");
        form.getInputByName("j_password").setValueAttribute("alice");
        p = (HtmlPage) form.submit(null);

        System.out.println(p);
    }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

        object.doSubmitDescription("description");

        // test the roundtrip
        HtmlPage page = new WebClient().goTo(url);
    page.getAnchorByHref("editDescription").click();
    HtmlForm form = findForm(page, "submitDescription");
    submit(form);
   
    assertEquals("description", object.getDescription());
  }
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

    }

    /** Tests nested repeatable and use of @DataBoundContructor to process formData */
    public void testNested() throws Exception {
        HtmlPage p = createWebClient().goTo("self/testNested");
        HtmlForm f = p.getFormByName("config");
        try {
            clickButton(p, f, "Add");
            f.getInputByValue("").setValueAttribute("title one");
            clickButton(p,f,"Add Foo");
            f.getInputByValue("").setValueAttribute("txt one");
            clickButton(p,f,"Add Foo");
            f.getInputByValue("").setValueAttribute("txt two");
            f.getInputsByName("bool").get(1).click();
            clickButton(p, f, "Add");
            f.getInputByValue("").setValueAttribute("title two");
            f.getElementsByTagName("button").get(1).click(); // 2nd "Add Foo" button
            f.getInputByValue("").setValueAttribute("txt 2.1");
        } catch (Exception e) {
            System.err.println("HTML at time of failure:\n" + p.getBody().asXml());
            throw e;
        }
        bindClass = FooList.class;
View Full Code Here

Examples of com.gargoylesoftware.htmlunit.html.HtmlForm

        waitForJavaScript(p);
    }

    public void testNestedRadio() throws Exception {
        HtmlPage p = createWebClient().goTo("self/testNestedRadio");
        HtmlForm f = p.getFormByName("config");
        try {
            clickButton(p, f, "Add");
            f.getElementsByAttribute("input", "type", "radio").get(1).click(); // outer=two
            f.getButtonByCaption("Add Moo").click();
            waitForJavaScript(p);
            f.getElementsByAttribute("input", "type", "radio").get(2).click(); // inner=inone
            f.getButtonByCaption("Add").click();
            waitForJavaScript(p);
            f.getElementsByAttribute("input", "type", "radio").get(4).click(); // outer=one
            Thread.sleep(500);
            f.getElementsByTagName("button").get(1).click(); // 2nd "Add Moo" button
            waitForJavaScript(p);
            f.getElementsByAttribute("input", "type", "radio").get(7).click(); // inner=intwo
            f.getElementsByTagName("button").get(1).click();
            waitForJavaScript(p);
            f.getElementsByAttribute("input", "type", "radio").get(8).click(); // inner=inone
        } catch (Exception e) {
            System.err.println("HTML at time of failure:\n" + p.getBody().asXml());
            throw e;
        }
        submit(f);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.