Package com.meterware.httpunit

Examples of com.meterware.httpunit.WebForm


    public void endBug948626(WebResponse response)
            throws Exception
    {
        WebConversation conversation = new WebConversation();
        response = conversation.getResponse(response.getURL().toExternalForm());
        WebForm form = response.getFormWithID("testForm");
        SubmitButton submitButton = form.getSubmitButtonWithID("testForm:submit");
        assertEquals("0", form.getParameterValue("testForm:hidden"));
        assertTrue(response.getText().indexOf("false") != -1);
        assertTrue(response.getText().indexOf("true") == -1);
        response = form.submit(submitButton);
        assertTrue(response.getText().indexOf("false") == -1);
        assertTrue(response.getText().indexOf("true") != -1);
    }
View Full Code Here


    public void endBug972165(WebResponse response)
        throws Exception
    {
        WebConversation conversation = new WebConversation();
        response = conversation.getResponse(response.getURL().toExternalForm());
        WebForm form = response.getFormWithID("testForm");
        SubmitButton submitButton = form.getSubmitButtonWithID("testForm:submit");

        assertTrue(response.getText().indexOf("CheckDisabled:true") != -1);
        assertEquals("true", form.getParameterValue("testForm:checkDisabled"));
        response = form.submit(submitButton);
        assertTrue(response.getText().indexOf("CheckDisabled:true") != -1);
        assertEquals("true", form.getParameterValue("testForm:checkDisabled"));
    }
View Full Code Here

    public void endBug(WebResponse response)
        throws Exception
    {
        WebConversation conversation = new WebConversation();
        response = conversation.getResponse(response.getURL().toExternalForm());
        WebForm form = response.getFormWithID("testForm");
        form.setParameter("testForm:size", "12");
        SubmitButton submitButton = form.getSubmitButtonWithID("testForm:submit");
        response = form.submit(submitButton);

        // is it a Long?
        assertTrue(response.getText().indexOf("12class java.lang.Long") != -1);
    }
View Full Code Here

      WebRequest req = new GetMethodWebRequest(baseURL + "bundled-myfaces-hellojsf/index.faces");
      WebResponse webResponse = webConversation.getResponse(req);
      assertTrue(contains(webResponse.getText(), "Enter your name"));

      // submit data
      WebForm form = webResponse.getFormWithID("form1");
      form.setParameter("form1:input_foo_text", "Stan");
      SubmitButton submitButton = form.getSubmitButtonWithID("form1:submit_button");
      webResponse = form.submit(submitButton);
      assertTrue(contains(webResponse.getText(), "Hello Stan"));
   }
View Full Code Here

        LOGGER.trace("RESPONSE: " + response.getText());
       
        assertTrue(response.getURL().getPath().startsWith("/idp"));
        assertEquals(1, response.getForms().length);

        WebForm webForm = response.getForms()[0];

        webForm.setParameter("j_username", "tomcat");
        webForm.setParameter("j_password", "tomcat");

        webForm.getSubmitButtons()[0].click();

        response = conversation.getCurrentPage();

        assertTrue("cannot reach protected content at " + formatUrl(this.serviceProvider1),
          response.getText().contains("Welcome to " + formatContextPath(this.serviceProvider1)));
View Full Code Here

        LOGGER.trace("RESPONSE: " + response.getText());
       
        assertTrue(response.getURL().getPath().startsWith("/idp"));
        assertEquals(1, response.getForms().length);

        WebForm webForm = response.getForms()[0];

        webForm.setParameter("j_username", "tomcat");
        webForm.setParameter("j_password", "tomcat");

        webForm.getSubmitButtons()[0].click();

        response = conversation.getCurrentPage();

        assertTrue("cannot reach protected content at " + formatUrl(this.serviceProvider1),
                response.getText().contains("Welcome to " + formatContextPath(this.serviceProvider1)));
View Full Code Here

    public void testPostOriginalRequest(@ArquillianResource URL serviceProvider2) throws Exception {
        WebRequest request = new GetMethodWebRequest(formatUrl(serviceProvider2) + "/savedRequest/savedRequest.html");
        WebConversation conversation = new WebConversation();
        WebResponse response = conversation.getResponse(request);

        WebForm webForm = response.getForms()[0];

        webForm.setParameter("j_username", "tomcat");
        webForm.setParameter("j_password", "tomcat");

        webForm.getSubmitButtons()[0].click();

        response = conversation.getCurrentPage();

        assertTrue(response.getText().contains("Back to the original requested resource."));
    }
View Full Code Here

        request.setParameter("SAVED_PARAM", "Param was saved.");

        WebConversation conversation = new WebConversation();
        WebResponse response = conversation.getResponse(request);

        WebForm webForm = response.getForms()[0];

        webForm.setParameter("j_username", "tomcat");
        webForm.setParameter("j_password", "tomcat");

        webForm.getSubmitButtons()[0].click();

        response = conversation.getCurrentPage();

        assertTrue(response.getText().contains("Param was saved."));
    }
View Full Code Here

    public void testRedirectOriginalRequest(@ArquillianResource URL serviceProvider1) throws Exception {
        WebRequest request = new GetMethodWebRequest(formatUrl(serviceProvider1) + "/savedRequest/savedRequest.html");
        WebConversation conversation = new WebConversation();
        WebResponse response = conversation.getResponse(request);

        WebForm webForm = response.getForms()[0];

        webForm.setParameter("j_username", "tomcat");
        webForm.setParameter("j_password", "tomcat");

        webForm.getSubmitButtons()[0].click();

        response = conversation.getCurrentPage();

        assertTrue(response.getText().contains("Back to the original requested resource."));
    }
View Full Code Here

    public void testPostOriginalRequest(@ArquillianResource URL url) throws Exception {
        WebRequest request = new GetMethodWebRequest(url.toString());
        WebConversation conversation = new WebConversation();
        WebResponse response = conversation.getResponse(request);

        WebForm webForm = response.getForms()[0];

        webForm.setParameter("j_username", "tomcat");
        webForm.setParameter("j_password", "tomcat");

        webForm.getSubmitButtons()[0].click();

        request = new GetMethodWebRequest(url + "?SAML_VERSION=2.0&TARGET=" + this.serviceProviderPostURL + "/savedRequest/savedRequest.html");

        response = conversation.getResponse(request);
View Full Code Here

TOP

Related Classes of com.meterware.httpunit.WebForm

Copyright © 2018 www.massapicom. 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.