Search in sources :

Example 16 with Call

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

the class ServicesIT method checkGetResponseContainsMultipleBadObjectDataTest.

@Test(groups = { "integration", "services", "httpget" }, description = "An integration test to verify the data from a get call")
public void checkGetResponseContainsMultipleBadObjectDataTest() {
    Map<String, String> responsePairs = new HashMap<>();
    responsePairs.put("userId", "1");
    responsePairs.put("id", "7");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/6").assertContains(responsePairs);
    // verify 1 issue
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Test(org.testng.annotations.Test)

Example 17 with Call

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

the class ServicesIT method checkGetResponseContainsArrayDataTest.

@Test(groups = { "integration", "services", "httpget" }, description = "An integration test to verify the data from a get call")
public void checkGetResponseContainsArrayDataTest() {
    JsonObject json = new JsonObject();
    json.addProperty("userId", 1);
    json.addProperty("id", 1);
    json.addProperty("title", "sunt aut facere repellat provident occaecati excepturi optio reprehenderit");
    json.addProperty("body", "quia et suscipit\nsuscipit recusandae consequuntur expedita et cum\nreprehenderit molestiae ut ut quas totam\nnostrum rerum est autem sunt rem eveniet architecto");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts").assertContains(json);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 18 with Call

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

the class ServicesIT method compareGetResponseCode200Test.

@Test(groups = { "integration", "services", "httpget" }, description = "An integration test to verify the response code from a get call")
public void compareGetResponseCode200Test() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/").assertEquals(200);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) Test(org.testng.annotations.Test)

Example 19 with Call

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

the class ServicesIT method checkGetResponseContainsSingleBadObjectDataTest.

@Test(groups = { "integration", "services", "httpget" }, description = "An integration test to verify the data from a get call")
public void checkGetResponseContainsSingleBadObjectDataTest() {
    Map<String, String> responsePairs = new HashMap<>();
    responsePairs.put("userId", "2");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/6").assertContains(responsePairs);
    // verify 1 issue
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Test(org.testng.annotations.Test)

Example 20 with Call

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

the class ServicesIT method checkPatchResponseContainsSingleDataTest.

@Test(groups = { "integration", "services", "httppatch" }, description = "An integration test to verify the data from a patch call")
public void checkPatchResponseContainsSingleDataTest() {
    JsonObject request = new JsonObject();
    request.addProperty("id", 4);
    request.addProperty("title", "foo1");
    request.addProperty("body", "bar");
    request.addProperty("userId", 4);
    Map<String, String> responsePairs = new HashMap<>();
    responsePairs.put("userId", "4");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.patch("posts/4", new Request(request)).assertContains(responsePairs);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) HashMap(java.util.HashMap) Request(com.coveros.selenified.services.Request) JsonObject(com.google.gson.JsonObject) 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