use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateSessionServerInactive.
@Test(groups = { "ut" })
public void testCreateSessionServerInactive() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = configureNotAliveConnection();
connector.createSession("Session1");
PowerMockito.verifyStatic(Unirest.class, never());
Unirest.post(ArgumentMatchers.contains(SeleniumRobotSnapshotServerConnector.SESSION_API_URL));
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testAddNoTestStepToTestCase.
@Test(groups = { "ut" })
public void testAddNoTestStepToTestCase() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = configureMockedSnapshotServerConnection();
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1");
connector.addTestStepsToTestCases(new ArrayList<>(), testCaseInSessionId);
PowerMockito.verifyStatic(Unirest.class, never());
Unirest.patch(ArgumentMatchers.contains(SeleniumRobotSnapshotServerConnector.TESTCASEINSESSION_API_URL));
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testGetStepListFromTestCase.
@Test(groups = { "ut" })
public void testGetStepListFromTestCase() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = configureMockedSnapshotServerConnection();
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1");
createServerMock("GET", SeleniumRobotSnapshotServerConnector.TESTCASEINSESSION_API_URL + "15", 200, "{'testSteps': ['1', '2']}");
Assert.assertEquals(connector.getStepListFromTestCase(testCaseInSessionId).size(), 2);
Assert.assertEquals(connector.getStepListFromTestCase(testCaseInSessionId).get(0), "1");
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testGetComparisonResultNotCompleted.
/**
* when comparison is not completed, do not interfere with result => returns true
* @throws UnirestException
*/
@Test(groups = { "ut" })
public void testGetComparisonResultNotCompleted() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
createServerMock("GET", SeleniumRobotSnapshotServerConnector.TESTCASEINSESSION_API_URL + "15", 200, "{'testSteps': [], 'completed': false, 'isOkWithSnapshots': true}");
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1");
StringBuilder errorMessage = new StringBuilder();
int comparisonResult = connector.getTestCaseInSessionComparisonResult(testCaseInSessionId, errorMessage);
Assert.assertEquals(comparisonResult, ITestResult.SUCCESS);
// no computing error message
Assert.assertTrue(errorMessage.toString().isEmpty());
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateVersionInError.
@Test(groups = { "ut" }, expectedExceptions = SeleniumRobotServerException.class)
public void testCreateVersionInError() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = configureMockedSnapshotServerConnection();
// reset to be sure it's recreated
connector.setVersionId(null);
HttpRequest<HttpRequest> req = createServerMock("POST", SeleniumRobotSnapshotServerConnector.VERSION_API_URL, 200, "{'id': '9'}", "body");
when(req.asString()).thenThrow(UnirestException.class);
connector.createVersion();
}
Aggregations