Search in sources :

Example 66 with Call

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

the class ServicesResponseAssertEqualsIT method assertArraySizeGood.

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

Example 67 with Call

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

the class ServicesResponseAssertEqualsIT method assertNestArraySizeNotArray.

@Test(groups = { "integration", "service", "httpget", "response" }, description = "An integration test to verify json data response")
public void assertNestArraySizeNotArray() {
    // use this object to verify the app looks as expected
    Call call = this.calls.get();
    // perform some actions
    Response response = call.get("/null/");
    response.assertEquals().nestedArraySize(Collections.singletonList("name"), -1);
    // verify no issues
    finish();
}
Also used : Response(com.coveros.selenified.services.Response) Call(com.coveros.selenified.services.Call) Test(org.testng.annotations.Test)

Example 68 with Call

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

the class SauceIT method sauceBuildTest.

@Test(groups = { "integration", "hub", "sauce", "sauceAPI" }, dependsOnMethods = { "hubTitleTest" }, description = "An integration test to check that sauce get all expected information")
public void sauceBuildTest(ITestContext iTestContext) throws IOException {
    SessionId sessionId = (SessionId) iTestContext.getAttribute("HUB_SESSION_ID");
    String buildName = iTestContext.getAttribute("HUB_BUILD").toString();
    Hub hub = new Hub();
    Call call = this.calls.get();
    call.addCredentials(hub.getUsername(), hub.getPassword());
    Response response = call.get("rest/v1/" + hub.getUsername() + "/jobs/" + sessionId.toString());
    Map<String, Object> expectedResults = new HashMap<>();
    expectedResults.put("build", buildName);
    response.assertContains().keyValues(expectedResults);
    finish();
}
Also used : Response(com.coveros.selenified.services.Response) Call(com.coveros.selenified.services.Call) Hub(com.coveros.selenified.utilities.Hub) HashMap(java.util.HashMap) SessionId(org.openqa.selenium.remote.SessionId) Test(org.testng.annotations.Test)

Example 69 with Call

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

the class SauceIT method sauceNameTest.

@Test(groups = { "integration", "hub", "sauce", "sauceAPI" }, dependsOnMethods = { "hubTitleTest" }, description = "An integration test to check that sauce get all expected information")
public void sauceNameTest(ITestContext iTestContext) throws IOException {
    SessionId sessionId = (SessionId) iTestContext.getAttribute("HUB_SESSION_ID");
    Hub hub = new Hub();
    Call call = this.calls.get();
    call.addCredentials(hub.getUsername(), hub.getPassword());
    Response response = call.get("rest/v1/" + hub.getUsername() + "/jobs/" + sessionId.toString());
    Map<String, Object> expectedResults = new HashMap<>();
    expectedResults.put("name", "integration.hub.SauceIT.hubTitleTest");
    response.assertContains().keyValues(expectedResults);
    finish();
}
Also used : Response(com.coveros.selenified.services.Response) Call(com.coveros.selenified.services.Call) Hub(com.coveros.selenified.utilities.Hub) HashMap(java.util.HashMap) SessionId(org.openqa.selenium.remote.SessionId) Test(org.testng.annotations.Test)

Example 70 with Call

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

the class SauceIT method sauceSeleniumVersionTest.

@Test(groups = { "integration", "hub", "sauce", "sauceAPI" }, dependsOnMethods = { "hubTitleTest" }, description = "An integration test to check that sauce get all expected information")
public void sauceSeleniumVersionTest(ITestContext iTestContext) throws IOException {
    SessionId sessionId = (SessionId) iTestContext.getAttribute("HUB_SESSION_ID");
    Hub hub = new Hub();
    Call call = this.calls.get();
    call.addCredentials(hub.getUsername(), hub.getPassword());
    Response response = call.get("rest/v1/" + hub.getUsername() + "/jobs/" + sessionId.toString());
    Map<String, Object> expectedResults = new HashMap<>();
    expectedResults.put("selenium_version", System.getProperty("selenium.version"));
    response.assertContains().keyValues(expectedResults);
    finish();
}
Also used : Response(com.coveros.selenified.services.Response) Call(com.coveros.selenified.services.Call) Hub(com.coveros.selenified.utilities.Hub) HashMap(java.util.HashMap) SessionId(org.openqa.selenium.remote.SessionId) 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