Search in sources :

Example 16 with WebClient

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

the class ProbeInvocationsTest method testInvocationsEndpoint.

@Test
public void testInvocationsEndpoint() throws IOException {
    WebClient client = invokeSimpleAction(url);
    JsonObject invocations = getPageAsJSONObject(INVOCATIONS_PATH, url, client);
    ReadContext ctx = JsonPath.parse(invocations.toString());
    List<String> methodNames = ctx.read("$." + DATA + "[*]." + METHOD_NAME, List.class);
    assertTrue("No invocations in invocation tree!", methodNames.size() > 0);
    assertTrue(methodNames.contains(ModelBean.SIMPLE_CALL_METHOD_NAME));
}
Also used : ReadContext(com.jayway.jsonpath.ReadContext) JsonObject(javax.json.JsonObject) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.junit.Test)

Example 17 with WebClient

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

the class TxEventTest method testRequestContextLifecycle.

/*
    * description = "WBRI-401"
    */
@Test
public void testRequestContextLifecycle() throws Exception {
    WebClient webClient = new WebClient();
    HtmlPage home = webClient.getPage(getPath("home.jsf"));
    HtmlSubmitInput beginConversationButton = getFirstMatchingElement(home, HtmlSubmitInput.class, "SaveButton");
    beginConversationButton.click();
}
Also used : HtmlPage(com.gargoylesoftware.htmlunit.html.HtmlPage) HtmlSubmitInput(com.gargoylesoftware.htmlunit.html.HtmlSubmitInput) WebClient(com.gargoylesoftware.htmlunit.WebClient) Test(org.junit.Test)

Example 18 with WebClient

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

the class FlowMultipleWarTest method testFlows.

@Test
@RunAsClient
public void testFlows(@ArquillianResource @OperateOnDeployment(WAR1) URL war1Context, @ArquillianResource @OperateOnDeployment(WAR2) URL war2Context) throws FailingHttpStatusCodeException, MalformedURLException, IOException {
    WebClient client = new WebClient();
    testFlow(client, war1Context);
    testFlow(client, war2Context);
}
Also used : WebClient(com.gargoylesoftware.htmlunit.WebClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 19 with WebClient

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

the class ManagedBeansWithCDITest method testManagedBeansWithCDI.

@Test
@RunAsClient
public void testManagedBeansWithCDI(@ArquillianResource URL url) throws Exception {
    WebClient client = new WebClient();
    client.getPage(url + "/index.faces");
}
Also used : WebClient(com.gargoylesoftware.htmlunit.WebClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 20 with WebClient

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

the class Weld1037Test method testRedirectInPreRenderViewAction.

@Test
@RunAsClient
public void testRedirectInPreRenderViewAction(@ArquillianResource URL url) throws Exception {
    WebClient client = new WebClient();
    client.setRedirectEnabled(false);
    client.setThrowExceptionOnFailingStatusCode(false);
    Page page = client.getPage(url + "/doRedirect.faces");
    assertEquals("Expected redirect:", HttpServletResponse.SC_MOVED_TEMPORARILY, page.getWebResponse().getStatusCode());
}
Also used : Page(com.gargoylesoftware.htmlunit.Page) WebClient(com.gargoylesoftware.htmlunit.WebClient) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

WebClient (com.gargoylesoftware.htmlunit.WebClient)182 Test (org.junit.Test)110 HtmlPage (com.gargoylesoftware.htmlunit.html.HtmlPage)55 Page (com.gargoylesoftware.htmlunit.Page)33 TextPage (com.gargoylesoftware.htmlunit.TextPage)21 Before (org.junit.Before)20 HtmlSubmitInput (com.gargoylesoftware.htmlunit.html.HtmlSubmitInput)17 URL (java.net.URL)14 JsonObject (javax.json.JsonObject)13 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)13 WebResponse (com.gargoylesoftware.htmlunit.WebResponse)12 SpecAssertion (org.jboss.test.audit.annotations.SpecAssertion)11 HtmlSpan (com.gargoylesoftware.htmlunit.html.HtmlSpan)10 ReadContext (com.jayway.jsonpath.ReadContext)10 File (java.io.File)9 IOException (java.io.IOException)8 NicelyResynchronizingAjaxController (com.gargoylesoftware.htmlunit.NicelyResynchronizingAjaxController)7 Test (org.junit.jupiter.api.Test)7 HtmlForm (com.gargoylesoftware.htmlunit.html.HtmlForm)6 DefaultCredentialsProvider (com.gargoylesoftware.htmlunit.DefaultCredentialsProvider)5