Search in sources :

Example 6 with SeleniumRobotSnapshotServerConnector

use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.

the class TestSeleniumRobotSnapshotServerConnector method testCreateVersion.

@Test(groups = { "ut" })
public void testCreateVersion() throws UnirestException {
    SeleniumRobotSnapshotServerConnector connector = spy(configureMockedSnapshotServerConnection());
    // reset to be sure it's recreated
    connector.setVersionId(null);
    connector.createVersion();
    Assert.assertNotNull(connector.getVersionId());
    Assert.assertEquals((int) connector.getVersionId(), 11);
}
Also used : SeleniumRobotSnapshotServerConnector(com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with SeleniumRobotSnapshotServerConnector

use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.

the class TestSeleniumRobotSnapshotServerConnector method testCreateTestStep.

// test step creation
@Test(groups = { "ut" })
public void testCreateTestStep() throws UnirestException {
    SeleniumRobotSnapshotServerConnector connector = 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);
    Assert.assertEquals((int) testStepId, 14);
}
Also used : SeleniumRobotSnapshotServerConnector(com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with SeleniumRobotSnapshotServerConnector

use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.

the class TestSeleniumRobotSnapshotServerConnector method testCheckSnapshotHasNoDifferencesWithComputingError.

@Test(groups = { "ut" })
public void testCheckSnapshotHasNoDifferencesWithComputingError() 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': 'Error computing', 'diffPixelPercentage': 0.0, 'tooManyDiffs': false}");
    SnapshotComparisonResult snapshotHasNoDifference = connector.checkSnapshotHasNoDifferences(snapshot, "Test 1", "Step 1");
    // In case of computing errors, it may be due to server problem, so do not retry
    Assert.assertEquals(snapshotHasNoDifference, SnapshotComparisonResult.NOT_DONE);
}
Also used : SeleniumRobotSnapshotServerConnector(com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector) SnapshotComparisonResult(com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector.SnapshotComparisonResult) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 9 with SeleniumRobotSnapshotServerConnector

use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.

the class TestSeleniumRobotSnapshotServerConnector method testGetStepReferenceSnapshotServerInactive.

@Test(groups = { "ut" })
public void testGetStepReferenceSnapshotServerInactive() throws UnirestException {
    SeleniumRobotSnapshotServerConnector connector = configureNotAliveConnection();
    connector.getReferenceSnapshot(1);
    PowerMockito.verifyStatic(Unirest.class, never());
    Unirest.post(ArgumentMatchers.contains(SeleniumRobotSnapshotServerConnector.STEP_REFERENCE_API_URL));
}
Also used : SeleniumRobotSnapshotServerConnector(com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 10 with SeleniumRobotSnapshotServerConnector

use of com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector in project seleniumRobot by bhecquet.

the class TestSeleniumRobotSnapshotServerConnector method testGetStepListFromTestCaseNone.

// getStepList
@Test(groups = { "ut" })
public void testGetStepListFromTestCaseNone() throws UnirestException {
    SeleniumRobotSnapshotServerConnector connector = configureMockedSnapshotServerConnection();
    Assert.assertEquals(connector.getStepListFromTestCase(null).size(), 0);
}
Also used : SeleniumRobotSnapshotServerConnector(com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector) Test(org.testng.annotations.Test) ConnectorsTest(com.seleniumtests.ConnectorsTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

SeleniumRobotSnapshotServerConnector (com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector)113 Test (org.testng.annotations.Test)106 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)86 ConnectorsTest (com.seleniumtests.ConnectorsTest)84 HttpRequest (kong.unirest.HttpRequest)15 SnapshotComparisonResult (com.seleniumtests.connectors.selenium.SeleniumRobotSnapshotServerConnector.SnapshotComparisonResult)6 File (java.io.File)6 Rectangle (org.openqa.selenium.Rectangle)5 MultipartBody (kong.unirest.MultipartBody)4 SeleniumRobotServerException (com.seleniumtests.customexception.SeleniumRobotServerException)3 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)2 ReporterTest (com.seleniumtests.it.reporter.ReporterTest)2 StubTestClassForDriverParallelTest (com.seleniumtests.it.stubclasses.StubTestClassForDriverParallelTest)2 Snapshot (com.seleniumtests.reporter.logger.Snapshot)2 TestStep (com.seleniumtests.reporter.logger.TestStep)2 ArrayList (java.util.ArrayList)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 ITestContext (org.testng.ITestContext)2 ITestResult (org.testng.ITestResult)2 XmlTest (org.testng.xml.XmlTest)2