Search in sources :

Example 1 with Call

use of com.coveros.selenified.services.Call in project selenified by Coveros.

the class ServicesErrorIT method compareDeleteResponseCode200Test.

@Test(groups = { "integration", "services", "httpdelete" }, description = "An integration test to verify the response code from a delete call")
public void compareDeleteResponseCode200Test() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 1);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 5);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.delete("posts/5", new Request(request)).assertEquals(200);
    // verify 2 issues
    finish(2);
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 2 with Call

use of com.coveros.selenified.services.Call in project selenified by Coveros.

the class ServicesErrorIT method comparePostResponseCode201Test.

@Test(groups = { "integration", "services", "httppost" }, description = "An integration test to verify the response code from a post call")
public void comparePostResponseCode201Test() {
    JsonObject request = new JsonObject();
    request.addProperty("title", "foo");
    request.addProperty("body", "bar");
    request.addProperty("userId", 2);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.post("posts/", new Request(request)).assertEquals(201);
    // verify 2 issues
    finish(2);
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 3 with Call

use of com.coveros.selenified.services.Call in project selenified by Coveros.

the class ServicesErrorIT method comparePutResponseCode200Test.

@Test(groups = { "integration", "services", "httpput" }, description = "An integration test to verify the response code from a put call")
public void comparePutResponseCode200Test() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 1);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 3);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.put("posts/3", new Request(request)).assertEquals(200);
    // verify 2 issues
    finish(2);
}
Also used : Call(com.coveros.selenified.services.Call) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 4 with Call

use of com.coveros.selenified.services.Call in project selenified by Coveros.

the class ServicesHeaderIT method overrideAcceptTest.

@Test(groups = { "integration", "services", "headers" }, description = "An integration test to verify we can successfully override standard header values")
public void overrideAcceptTest() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // set some custom headers
    Map<String, String> headers = new HashMap<>();
    headers.put("Accept", "no-check");
    call.resetHeaders();
    call.addHeaders(headers);
    // perform some actions
    call.get("posts/").assertEquals(200);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Test(org.testng.annotations.Test)

Example 5 with Call

use of com.coveros.selenified.services.Call in project selenified by Coveros.

the class ServicesHeaderIT method setHeaderTest.

@Test(groups = { "integration", "services", "headers" }, description = "An integration test to verify we can successfully set header values")
public void setHeaderTest() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // set some custom headers
    Map<String, String> headers = new HashMap<>();
    headers.put("X-Atlassian-Token", "no-check");
    call.addHeaders(headers);
    // perform some actions
    call.get("posts/").assertEquals(200);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Test(org.testng.annotations.Test)

Aggregations

Call (com.coveros.selenified.services.Call)76 Test (org.testng.annotations.Test)75 Request (com.coveros.selenified.services.Request)56 JsonObject (com.google.gson.JsonObject)49 HashMap (java.util.HashMap)36 JsonArray (com.google.gson.JsonArray)5 JsonParser (com.google.gson.JsonParser)2 App (com.coveros.selenified.application.App)1 InvalidBrowserException (com.coveros.selenified.exceptions.InvalidBrowserException)1 HTTP (com.coveros.selenified.services.HTTP)1 MalformedURLException (java.net.MalformedURLException)1 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)1