Search in sources :

Example 41 with Page

use of com.gargoylesoftware.htmlunit.Page in project core by weld.

the class AbstractDispatchingTestCase method getResponseAsString.

private String getResponseAsString(String urlSuffix) throws FailingHttpStatusCodeException, MalformedURLException, IOException {
    Page page = client.getPage(contextPath + urlSuffix);
    assertEquals(200, page.getWebResponse().getStatusCode());
    return page.getWebResponse().getContentAsString();
}
Also used : Page(com.gargoylesoftware.htmlunit.Page)

Example 42 with Page

use of com.gargoylesoftware.htmlunit.Page in project core by weld.

the class RemoteScopeTest method testScopeOfProducerMethod.

/*
    * 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);
}
Also used : Page(com.gargoylesoftware.htmlunit.Page) WebClient(com.gargoylesoftware.htmlunit.WebClient) URL(java.net.URL) Test(org.junit.Test)

Example 43 with Page

use of com.gargoylesoftware.htmlunit.Page in project core by weld.

the class EMFFactoryTest method testInstanceManagedBeanEMFProducerField.

/*
    * description = "WELD-632"
    */
@Test
public void testInstanceManagedBeanEMFProducerField() throws Exception {
    WebClient client = new WebClient();
    client.setThrowExceptionOnFailingStatusCode(false);
    Page page = client.getPage(getPath("emfconsumer2"));
    assertEquals(200, page.getWebResponse().getStatusCode());
}
Also used : Page(com.gargoylesoftware.htmlunit.Page) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.junit.Test)

Example 44 with Page

use of com.gargoylesoftware.htmlunit.Page in project core by weld.

the class ClientConversationContextTest method testExceptionInPostConstruct.

@Test
public void testExceptionInPostConstruct() throws Exception {
    WebClient client = new WebClient();
    // First, try a transient conversation
    client.setThrowExceptionOnFailingStatusCode(false);
    // Access a page that throws an exception
    client.getPage(getPath("/hailstorm.jsf"));
    // Then access another page that doesn't and check the contexts are ok
    HtmlPage cloud = client.getPage(getPath("/cloud.jsf"));
    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));
    // And navigate to another page, checking the conversation exists by
    // verifying that state is maintained
    cloudName = getFirstMatchingElement(cloud, HtmlSpan.class, "cloudName").getTextContent();
    assertEquals("gavin", cloudName);
}
Also used : HtmlSpan(com.gargoylesoftware.htmlunit.html.HtmlSpan) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSubmitInput(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput) HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Page(com.gargoylesoftware.htmlunit.Page) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.junit.Test)

Example 45 with Page

use of com.gargoylesoftware.htmlunit.Page in project core by weld.

the class ClientConversationContextTest method testConversationPropagationToNonExistentConversationLeadsException.

@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());
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) Page(com.gargoylesoftware.htmlunit.Page) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.junit.Test)

Aggregations

Page (com.gargoylesoftware.htmlunit.Page)62 Test (org.junit.Test)39 WebClient (com.gargoylesoftware.htmlunit.WebClient)33 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)15 PublicAtsApi (com.axway.ats.common.PublicAtsApi)9 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)5 File (java.io.File)5 IOException (java.io.IOException)5 URL (java.net.URL)5 JenkinsRule (org.jvnet.hudson.test.JenkinsRule)5 VerificationException (com.axway.ats.uiengine.exceptions.VerificationException)4 ConfirmHandler (com.gargoylesoftware.htmlunit.ConfirmHandler)4 Map (java.util.Map)4 JSONObject (net.sf.json.JSONObject)4 RsaJsonWebKey (org.jose4j.jwk.RsaJsonWebKey)4 JsonWebSignature (org.jose4j.jws.JsonWebSignature)4 JwtClaims (org.jose4j.jwt.JwtClaims)4 JwtConsumer (org.jose4j.jwt.consumer.JwtConsumer)4 JwtConsumerBuilder (org.jose4j.jwt.consumer.JwtConsumerBuilder)4 JsonWebStructure (org.jose4j.jwx.JsonWebStructure)4