Search in sources :

Example 21 with SeleniumRobotGridConnector

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

the class TestTestTasks method testGetProcessListOtherRunMode.

/**
 * Test kill process is not called when not using local or grid mode
 * @param testNGCtx
 */
@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class)
public void testGetProcessListOtherRunMode(final ITestContext testNGCtx) {
    SeleniumGridConnector gridConnector = spy(new SeleniumRobotGridConnector("http://saucelabs:4444/hub/wd"));
    PowerMockito.mockStatic(SeleniumGridConnectorFactory.class);
    PowerMockito.when(SeleniumGridConnectorFactory.getInstances(Arrays.asList("http://saucelabs:4444/hub/wd"))).thenReturn(Arrays.asList(gridConnector));
    try {
        System.setProperty(SeleniumTestsContext.RUN_MODE, "saucelabs");
        System.setProperty(SeleniumTestsContext.PLATFORM, "windows");
        System.setProperty(SeleniumTestsContext.WEB_DRIVER_GRID, "http://saucelabs:4444/hub/wd");
        initThreadContext(testNGCtx);
        TestTasks.getProcessList("some_process");
    } finally {
        System.clearProperty(SeleniumTestsContext.RUN_MODE);
        System.clearProperty(SeleniumTestsContext.PLATFORM);
        System.clearProperty(SeleniumTestsContext.WEB_DRIVER_GRID);
    }
}
Also used : SeleniumRobotGridConnector(com.seleniumtests.connectors.selenium.SeleniumRobotGridConnector) SeleniumGridConnector(com.seleniumtests.connectors.selenium.SeleniumGridConnector) Test(org.testng.annotations.Test) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) XmlTest(org.testng.xml.XmlTest) GenericTest(com.seleniumtests.GenericTest) MockitoTest(com.seleniumtests.MockitoTest)

Aggregations

SeleniumRobotGridConnector (com.seleniumtests.connectors.selenium.SeleniumRobotGridConnector)21 SeleniumGridConnector (com.seleniumtests.connectors.selenium.SeleniumGridConnector)19 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)19 Test (org.testng.annotations.Test)19 GenericTest (com.seleniumtests.GenericTest)10 MockitoTest (com.seleniumtests.MockitoTest)10 XmlTest (org.testng.xml.XmlTest)10 ConnectorsTest (com.seleniumtests.ConnectorsTest)9 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)7 SessionId (org.openqa.selenium.remote.SessionId)6 BeforeMethod (org.testng.annotations.BeforeMethod)2 HttpRequestWithBody (kong.unirest.HttpRequestWithBody)1 SkipException (org.testng.SkipException)1