Search in sources :

Example 91 with Call

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

the class ServicesResponseAssertContainsIT method assertJsonCrumbsBadCrumbContain.

@Test(groups = { "integration", "service", "httpget", "response" }, description = "An integration test to verify json data response", expectedExceptions = AssertionError.class)
public void assertJsonCrumbsBadCrumbContain() {
    Map<String, Object> values = new HashMap<>();
    values.put("id", 4);
    List<String> crumbs = new ArrayList<>();
    crumbs.add("user");
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/?id=4").assertContains().nestedKeyValues(crumbs, values);
    // verify 1 issues
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 92 with Call

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

the class ServicesResponseAssertContainsIT method assertNestedKeysNoCrumb.

@Test(groups = { "integration", "service", "httpget", "response" }, description = "An integration test to verify json data response")
public void assertNestedKeysNoCrumb() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("ids/1").assertContains().nestedKeys(new ArrayList<>(), Collections.singletonList("ids"));
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) Test(org.testng.annotations.Test)

Example 93 with Call

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

the class ServicesResponseAssertContainsIT method assertJsonCrumbsEmptyContain.

@Test(groups = { "integration", "service", "httpget", "response" }, description = "An integration test to verify json data response")
public void assertJsonCrumbsEmptyContain() {
    Map<String, Object> values = new HashMap<>();
    values.put("id", 4);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/?id=4").assertContains().nestedKeyValues(new ArrayList<>(), values);
    // verify no issues
    finish();
}
Also used : Call(com.coveros.selenified.services.Call) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 94 with Call

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

the class ServicesResponseAssertContainsIT method assertJsonObjectDoesntContainMismatch.

@Test(groups = { "integration", "service", "httpget", "response" }, description = "An integration test to verify json data response", expectedExceptions = AssertionError.class)
public void assertJsonObjectDoesntContainMismatch() {
    JsonObject json = new JsonObject();
    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/?id=4").assertContains().value(json);
    // verify 1 issue
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Example 95 with Call

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

the class ServicesResponseAssertContainsIT method assertJsonArrayDoesntContainMismatch.

@Test(groups = { "integration", "service", "httpget", "response" }, description = "An integration test to verify json data response", expectedExceptions = AssertionError.class)
public void assertJsonArrayDoesntContainMismatch() {
    Map<String, Object> values = new HashMap<>();
    values.put("id", 3);
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    call.get("posts/").assertContains().keyValues(values);
    // verify 1 issue
    finish(1);
}
Also used : Call(com.coveros.selenified.services.Call) JsonObject(com.google.gson.JsonObject) Test(org.testng.annotations.Test)

Aggregations

Call (com.coveros.selenified.services.Call)377 Test (org.testng.annotations.Test)375 Request (com.coveros.selenified.services.Request)142 JsonObject (com.google.gson.JsonObject)139 HashMap (java.util.HashMap)94 Response (com.coveros.selenified.services.Response)40 JsonArray (com.google.gson.JsonArray)38 File (java.io.File)21 ArrayList (java.util.ArrayList)14 Hub (com.coveros.selenified.utilities.Hub)10 SessionId (org.openqa.selenium.remote.SessionId)10 HTTP (com.coveros.selenified.services.HTTP)3 App (com.coveros.selenified.application.App)2 JsonParser (com.google.gson.JsonParser)2 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)2 InvalidBrowserException (com.coveros.selenified.exceptions.InvalidBrowserException)1 MalformedURLException (java.net.MalformedURLException)1