use of com.seleniumtests.connectors.selenium.SeleniumGridConnector in project seleniumRobot by bhecquet.
the class TestSeleniumGridConnector method testIsGridActiveWithGridPresent.
@Test(groups = { "ut" })
public void testIsGridActiveWithGridPresent() throws ClientProtocolException, IOException, UnirestException {
SeleniumGridConnector connector = new SeleniumGridConnector(SERVER_URL);
createServerMock("GET", SeleniumGridConnector.CONSOLE_SERVLET, 200, "some text");
Assert.assertTrue(connector.isGridActive());
}
use of com.seleniumtests.connectors.selenium.SeleniumGridConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotGridConnector method testIsGridActiveWithRobotGridActiveInvalidStatus.
/**
* Check that we get false if the status returned by grid is invalid (no JSON)
* @throws ClientProtocolException
* @throws IOException
* @throws UnirestException
*/
@Test(groups = { "ut" })
public void testIsGridActiveWithRobotGridActiveInvalidStatus() throws ClientProtocolException, IOException {
String hubStatus = "null";
SeleniumGridConnector connector = new SeleniumRobotGridConnector(SERVER_URL);
createServerMock("GET", SeleniumGridConnector.CONSOLE_SERVLET, 200, "some text");
createServerMock("GET", SeleniumRobotGridConnector.STATUS_SERVLET, 200, hubStatus);
Assert.assertFalse(connector.isGridActive());
}
use of com.seleniumtests.connectors.selenium.SeleniumGridConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotGridConnector method testIsGridActiveWithGridNotPresent.
@Test(groups = { "ut" })
public void testIsGridActiveWithGridNotPresent() throws ClientProtocolException, IOException {
SeleniumGridConnector connector = new SeleniumRobotGridConnector(SERVER_URL);
when(Unirest.get(SERVER_URL + SeleniumGridConnector.CONSOLE_SERVLET)).thenReturn(getRequest);
when(getRequest.asString()).thenThrow(UnirestException.class);
Assert.assertFalse(connector.isGridActive());
}
use of com.seleniumtests.connectors.selenium.SeleniumGridConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotGridConnector method testExecuteCommand.
@Test(groups = { "ut" })
public void testExecuteCommand() throws UnsupportedOperationException, IOException {
HttpRequestWithBody req = (HttpRequestWithBody) createServerMock("POST", SeleniumRobotGridConnector.NODE_TASK_SERVLET, 200, "foo");
SeleniumGridConnector connector = new SeleniumRobotGridConnector("http://localhost:4444/wd/hub");
connector.setSessionId(new SessionId("1234"));
connector.setNodeUrl("http://localhost:4321");
Assert.assertEquals(connector.executeCommand("myProcess", "arg1", "arg2"), "foo");
verify(req).queryString("arg0", "arg1");
verify(req).queryString("arg1", "arg2");
verify(req).queryString("name", "myProcess");
verify(req).queryString("action", "command");
}
use of com.seleniumtests.connectors.selenium.SeleniumGridConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotGridConnector method testIsGridActiveWithRobotGridInactive.
/**
* Check that we get false if the grid is INACTIVE
* @throws ClientProtocolException
* @throws IOException
* @throws UnirestException
*/
@Test(groups = { "ut" })
public void testIsGridActiveWithRobotGridInactive() throws ClientProtocolException, IOException {
String hubStatus = "{" + "\"http:\\u002f\\u002fnode1.company.com:5555\": {\r\n" + " \"busy\": false,\r\n" + " \"lastSessionStart\": \"2018-08-31T08:30:06Z\",\r\n" + " \"version\": \"3.14.0\",\r\n" + " \"usedTestSlots\": 0,\r\n" + " \"testSlots\": 1,\r\n" + " \"status\": \"INACTIVE\"\r\n" + " },\r\n" + " \"hub\": {\r\n" + " \"version\": \"3.14.0\",\r\n" + " \"status\": \"INACTIVE\"\r\n" + " },\r\n" + " \"success\": true\r\n" + "}";
SeleniumGridConnector connector = new SeleniumRobotGridConnector(SERVER_URL);
createServerMock("GET", SeleniumGridConnector.CONSOLE_SERVLET, 200, "some text");
createServerMock("GET", SeleniumRobotGridConnector.STATUS_SERVLET, 200, hubStatus);
Assert.assertFalse(connector.isGridActive());
}
Aggregations