use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateVersionServerInactive.
@Test(groups = { "ut" })
public void testCreateVersionServerInactive() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = configureNotAliveConnection();
// reset to be sure it's recreated
connector.setVersionId(null);
connector.createVersion();
PowerMockito.verifyStatic(Unirest.class, never());
Unirest.post(ArgumentMatchers.contains(SeleniumRobotSnapshotServerConnector.VERSION_API_URL));
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCheckSnapshotHasNoDifferencesWithDiff.
@Test(groups = { "ut" })
public void testCheckSnapshotHasNoDifferencesWithDiff() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
// set it directly has it has been reset on creation
connector.setVersionId(11);
createServerMock("PUT", SeleniumRobotSnapshotServerConnector.SNAPSHOT_API_URL, 200, "{'id': null, 'computed': true, 'computingError': '', 'diffPixelPercentage': 10.0, 'tooManyDiffs': true}");
SnapshotComparisonResult snapshotHasNoDifference = connector.checkSnapshotHasNoDifferences(snapshot, "Test 1", "Step 1");
// When there are differences, return false
Assert.assertEquals(snapshotHasNoDifference, SnapshotComparisonResult.KO);
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateApplicationInError.
@Test(groups = { "ut" }, expectedExceptions = SeleniumRobotServerException.class)
public void testCreateApplicationInError() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = configureMockedSnapshotServerConnection();
// reset to be sure it's recreated
connector.setApplicationId(null);
HttpRequest<HttpRequest> req = createServerMock("POST", SeleniumRobotSnapshotServerConnector.APPLICATION_API_URL, 200, "{'id': '9'}", "body");
when(req.asString()).thenThrow(UnirestException.class);
connector.createApplication();
Assert.assertNull(connector.getApplicationId());
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateTestCaseInSessionLongName.
/**
* Test case in session name is limited to 100 chars by server, check we strip it
* @throws UnirestException
*/
@Test(groups = { "ut" })
public void testCreateTestCaseInSessionLongName() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
MultipartBody request = (MultipartBody) createServerMock("POST", SeleniumRobotSnapshotServerConnector.TESTCASEINSESSION_API_URL, 200, "{'id': '14'}", "body");
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1" + StringUtils.repeat("-", 95));
verify(request).field("name", ("Test 1" + StringUtils.repeat("-", 94)));
Assert.assertEquals((int) testCaseInSessionId, 14);
}
use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.
the class TestSeleniumRobotSnapshotServerConnector method testCreateExcludeZone.
@Test(groups = { "ut" })
public void testCreateExcludeZone() throws UnirestException {
SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
Integer sessionId = connector.createSession("Session1");
Integer testCaseId = connector.createTestCase("Test 1");
Integer testCaseInSessionId = connector.createTestCaseInSession(sessionId, testCaseId, "Test 1");
Integer testStepId = connector.createTestStep("Step 1", testCaseInSessionId);
Integer stepResultId = connector.recordStepResult(true, "", 1, sessionId, testCaseInSessionId, testStepId);
Integer snapshotId = connector.createSnapshot(snapshot, sessionId, testCaseInSessionId, stepResultId);
int excludeZoneId = connector.createExcludeZones(new Rectangle(1, 1, 1, 1), snapshotId);
// check prerequisites has been created
Assert.assertEquals(excludeZoneId, 18);
}
Aggregations