Package com.gargoylesoftware.htmlunit

Examples of com.gargoylesoftware.htmlunit.Page


    */
    @Test
    public void testStaticManagedBeanEMFProducerField() throws Exception {
        WebClient client = new WebClient();
        client.setThrowExceptionOnFailingStatusCode(false);
        Page page = client.getPage(getPath("emfconsumer3"));

        assertEquals(200, page.getWebResponse().getStatusCode());
    }
View Full Code Here


                client.getCookieManager().addCookie(cookie);
            }
        }

        public Void call() throws Exception {
            Page page = client.getPage(url);
            if (page.getWebResponse().getStatusCode() == 500) {
                throw new RuntimeException(page.getWebResponse().getContentAsString());
            }
            return null;
        }
View Full Code Here

    * description = "WELD-311"
    */
    @Test
    public void testScopeOfProducerMethod(@ArquillianResource URL baseURL) throws Exception {
        WebClient client = new WebClient();
        Page page = client.getPage(new URL(baseURL, "request1"));
        assertEquals(page.getWebResponse().getStatusCode(), HttpServletResponse.SC_OK);
        page = client.getPage(new URL(baseURL, "request2"));
        assertEquals(page.getWebResponse().getStatusCode(), HttpServletResponse.SC_OK);
    }
View Full Code Here

    @Test
    public void testConversationPropagationToNonExistentConversationLeadsException() throws Exception {
        WebClient client = new WebClient();
        client.setThrowExceptionOnFailingStatusCode(false);
        Page page = client.getPage(getPath("/cloud.jsf", "org.jboss.jsr299"));

        Assert.assertEquals(500, page.getWebResponse().getStatusCode());
    }
View Full Code Here

        String cloudName = getFirstMatchingElement(cloud, HtmlSpan.class, "cloudName").getTextContent();
        assertEquals(Cloud.NAME, cloudName);

        // Now start a conversation and access the page that throws an exception
        // again
        Page hailstorm = getFirstMatchingElement(cloud, HtmlSubmitInput.class, "hail").click();

        String cid = getCid(hailstorm);

        cloud = client.getPage(getPath("/cloud.jsf", cid));
View Full Code Here

        }

        // verify that the conversation can no longer be restored
        {
            client.setThrowExceptionOnFailingStatusCode(false);
            Page page = client.getPage(getPath("/display", cid));
            assertEquals(500, page.getWebResponse().getStatusCode());
        }
    }
View Full Code Here

        }

        // Verify that the conversation 1 cannot be associated
        {
            client.setThrowExceptionOnFailingStatusCode(false);
            Page page = client.getPage(getPath("/display", cid1));
            assertEquals(500, page.getWebResponse().getStatusCode());
        }

        // Verify that the conversation 2 cannot be associated
        {
            client.setThrowExceptionOnFailingStatusCode(false);
            Page page = client.getPage(getPath("/display", cid2));
            assertEquals(500, page.getWebResponse().getStatusCode());
        }
    }
View Full Code Here

        ListView view = new ListView("Test", hudson);
        view.getJobFilters().add(filter);
        hudson.addView(view);

        WebClient web = createWebClient();
        Page page = web.goTo("/view/Test/api/json", "application/json");
        JSONObject json = (JSONObject)JSONSerializer.toJSON(page.getWebResponse().getContentAsString());
        //Just to test that we can find both in an open installation.
        assertTrue(json.has("jobs"));
        JSONArray jobs = (JSONArray)json.get("jobs");
        assertEquals(2, jobs.size());

        //Lets secure Jenkins
        hudson.setSecurityRealm(createDummySecurityRealm());
        hudson.setAuthorizationStrategy(new TestACL());

        web = createWebClient();
        web = web.login("testuser");

        page = web.goTo("/view/Test/api/json", "application/json");
        json = (JSONObject)JSONSerializer.toJSON(page.getWebResponse().getContentAsString());
        //Does it still applies to secured projects?
        assertTrue(json.has("jobs"));
        jobs = (JSONArray)json.get("jobs");
        assertEquals(1, jobs.size());
    }
View Full Code Here

        return "example/index.html";
    }

    @Test
    public void shouldNotInstrument() throws Exception {
        Page page = webClient.getPage("http://localhost:9001/example/lib/noInstrument.js");
        assertThat(page.getWebResponse().getContentAsString(), equalTo("alert('Hey');"));
    }
View Full Code Here

    protected void doTestRequests(HttpMethod... methods) throws Exception {
        URL testURL = new URL(getTestUrl());
        for (HttpMethod method : methods) {
            WebRequest request = new WebRequest(testURL, method);
            Page page = webClient.getPage(request);
            assertEquals("Unexpected response", CONTENT, page.getWebResponse().getContentAsString());
        }
    }
View Full Code Here

TOP

Related Classes of com.gargoylesoftware.htmlunit.Page

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.