Example usage for org.openqa.selenium.remote.http HttpResponse HttpResponse

List of usage examples for org.openqa.selenium.remote.http HttpResponse HttpResponse

Introduction

In this page you can find the example usage for org.openqa.selenium.remote.http HttpResponse HttpResponse.

Prototype

HttpResponse

Source Link

Usage

From source file:org.openqa.grid.web.servlet.DisplayHelpHandlerTest.java

License:Apache License

@Test
public void testGetHelpPageForStandalone() throws IOException {
    assertThat(handler.getHelperType()).isEqualTo("Standalone");

    HttpRequest request = new HttpRequest(GET, "/");
    HttpResponse response = new HttpResponse();
    handler.execute(request, response);//from   ww w  .  ja  v a2 s .c  om
    assertThat(response.getStatus()).isEqualTo(HTTP_OK);

    String body = response.getContentString();
    assertThat(body).isNotNull().contains("Whoops! The URL specified routes to this help page.",
            "\"type\": \"Standalone\"", "\"consoleLink\": \"\\u002fwd\\u002fhub\"");
}

From source file:org.openqa.grid.web.servlet.DisplayHelpHandlerTest.java

License:Apache License

@Test
public void testGetHelpPageAsset() throws IOException {
    HttpResponse response = new HttpResponse();

    handler.execute(new HttpRequest(GET, "/assets/displayhelpservlet.css"), response);

    assertThat(response.getStatus()).isEqualTo(HTTP_OK);
    assertThat(response.getContentString()).isNotNull().contains("#help-heading #logo");
}

From source file:org.openqa.grid.web.servlet.DisplayHelpHandlerTest.java

License:Apache License

@Test
public void testNoSuchAsset() throws IOException {
    HttpResponse response = new HttpResponse();

    handler.execute(new HttpRequest(GET, "/assets/foo.bar"), response);

    assertThat(response.getStatus()).isEqualTo(HTTP_NOT_FOUND);
}

From source file:org.openqa.grid.web.servlet.DisplayHelpHandlerTest.java

License:Apache License

@Test
public void testAccessRoot() throws IOException {
    HttpResponse response = new HttpResponse();

    handler.execute(new HttpRequest(GET, "/"), response);

    assertThat(response.getStatus()).isEqualTo(HTTP_OK);
}