Example usage for org.openqa.selenium Platform WINDOWS

List of usage examples for org.openqa.selenium Platform WINDOWS

Introduction

In this page you can find the example usage for org.openqa.selenium Platform WINDOWS.

Prototype

Platform WINDOWS

To view the source code for org.openqa.selenium Platform WINDOWS.

Click Source Link

Document

Never returned, but can be used to request a browser running on any version of Windows.

Usage

From source file:com.rmn.qa.aws.VmManagerTest.java

License:Open Source License

@Test
// Happy path test flow for launching nodes
public void testLaunchNodes() throws NodesCouldNotBeStartedException {
    MockAmazonEc2Client client = new MockAmazonEc2Client(null);
    RunInstancesResult runInstancesResult = new RunInstancesResult();
    Reservation reservation = new Reservation();
    reservation.setInstances(Arrays.asList(new Instance()));
    runInstancesResult.setReservation(reservation);
    client.setRunInstances(runInstancesResult);
    Properties properties = new Properties();
    String region = "east", uuid = "uuid", browser = "chrome";
    Platform os = Platform.WINDOWS;
    Integer threadCount = 5, maxSessions = 5;
    MockManageVm manageEC2 = new MockManageVm(client, properties, region);
    String userData = "userData";
    manageEC2.setUserData(userData);/* w  ww  .ja  v  a  2s . c om*/
    manageEC2.launchNodes(uuid, os, browser, null, threadCount, maxSessions);
    RunInstancesRequest request = client.getRunInstancesRequest();
    Assert.assertEquals("Min count should match thread count requested", threadCount, request.getMinCount());
    Assert.assertEquals("Max count should match thread count requested", threadCount, request.getMaxCount());
    Assert.assertEquals("User data should match", userData, request.getUserData());
    Assert.assertTrue("No security group should be set", request.getSecurityGroupIds().isEmpty());
    Assert.assertNull("No subnet should be set", request.getSubnetId());
    Assert.assertNull("No key name should be set", request.getKeyName());
}

From source file:com.rmn.qa.aws.VmManagerTest.java

License:Open Source License

@Test
// Test that the correct node config file is generated for a windows os
public void testGetNodeConfigWindows() {
    MockManageVm manageEC2 = new MockManageVm(null, null, null);
    String uuid = "uuid", hostName = "hostName", browser = "chrome";
    Platform os = Platform.WINDOWS;
    int maxSessions = 5;
    String nodeConfig = manageEC2.getNodeConfig(uuid, hostName, browser, os, maxSessions);
    Assert.assertTrue("Max sessions should have been passed in",
            nodeConfig.contains(String.valueOf(maxSessions)));
    Assert.assertTrue("UUID should have been passed in", nodeConfig.contains(uuid));
    Assert.assertTrue("Browser should have been passed in", nodeConfig.contains(browser));
    Assert.assertTrue("OS should have been passed in", nodeConfig.contains(os.toString()));
    Assert.assertTrue("Host name should have been passed in", nodeConfig.contains(hostName));
    Assert.assertTrue("IE thread count should have been passed in",
            nodeConfig.contains(String.valueOf(AwsVmManager.FIREFOX_IE_THREAD_COUNT)));
}

From source file:com.rmn.qa.servlet.AutomationTestRunServletTest.java

License:Open Source License

@Test
// Tests a request can be fulfilled when IE nodes have to be spun up
public void testRequestCanFulfillSpinUpNodesIe() throws IOException, ServletException {
    MockVmManager manageEc2 = new MockVmManager();
    System.setProperty(AutomationConstants.IP_ADDRESS, "192.168.1.1");
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(0);/*from  w  w  w .j  av  a  2s.  co  m*/
    MockAutomationTestRunServlet servlet = new MockAutomationTestRunServlet(null, false, manageEc2, matcher);
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter("uuid", "testUuid");
    request.setParameter("browser", "internetexplorer");
    request.setParameter("os", Platform.WINDOWS.toString());
    request.setParameter("threadCount", "1");
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid", nodeId, null, null, new Date(), 50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String, Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String, Object> capabilities = new HashMap<String, Object>();
    capabilities.put(CapabilityType.BROWSER_NAME, "internetexplorer");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    servlet.setProxySet(proxySet);
    AutomationContext.getContext().setTotalNodeCount(50);
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.doGet(request, response);
    Assert.assertEquals("Hub should be able to fulfill request", HttpServletResponse.SC_CREATED,
            response.getStatusCode());
}

From source file:com.rmn.qa.servlet.AutomationTestRunServletTest.java

License:Open Source License

@Test
// Tests a request cannot be fulfilled when the browser is not a supported browser to spin up
public void testRequestCantFulfillUnsupportedBrowser() throws IOException, ServletException {
    MockVmManager manageEc2 = new MockVmManager();
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(0);/*from www.  j av  a2s  .  c  om*/
    MockAutomationTestRunServlet servlet = new MockAutomationTestRunServlet(null, false, manageEc2, matcher);
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter("uuid", "testUuid");
    request.setParameter("browser", BrowserType.SAFARI.toString());
    request.setParameter("os", Platform.WINDOWS.toString());
    request.setParameter("threadCount", "7");
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid", nodeId, null, null, new Date(), 50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String, Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String, Object> capabilities = new HashMap<String, Object>();
    capabilities.put(CapabilityType.BROWSER_NAME, "chrome");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    servlet.setProxySet(proxySet);
    AutomationContext.getContext().setTotalNodeCount(50);
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.doGet(request, response);
    Assert.assertEquals("Hub should not be able to fulfill request", HttpServletResponse.SC_GONE,
            response.getErrorCode());
}

From source file:com.rmn.qa.servlet.AutomationTestRunServletTest.java

License:Open Source License

@Test
// Tests that the cleanup threads are started
public void testInitCleanupThreads() throws IOException, ServletException {
    System.setProperty(AutomationConstants.INSTANCE_ID, "dummyId");
    MockVmManager manageEc2 = new MockVmManager();
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(0);// w w  w  . j  a  v a2  s.c o m
    MockAutomationTestRunServlet servlet = new MockAutomationTestRunServlet(null, true, manageEc2, matcher);
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter("uuid", "testUuid");
    request.setParameter("browser", "chrome");
    request.setParameter("os", Platform.WINDOWS.toString());
    request.setParameter("threadCount", "7");
    request.setParameter("browserVersion", "21");
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid", nodeId, null, null, new Date(), 50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String, Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String, Object> capabilities = new HashMap<String, Object>();
    capabilities.put(CapabilityType.BROWSER_NAME, "chrome");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    servlet.setProxySet(proxySet);
    AutomationContext.getContext().setTotalNodeCount(50);
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.doGet(request, response);
    Assert.assertEquals("Hub should be able to fulfill request", HttpServletResponse.SC_CREATED,
            response.getStatusCode());
}

From source file:com.rmn.qa.servlet.AutomationTestRunServletTest.java

License:Open Source License

@Test
public void testInitCleanupThreadsNoInstanceId() throws IOException, ServletException {
    MockVmManager manageEc2 = new MockVmManager();
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(0);/*  ww  w .j av  a  2  s  . co m*/
    MockAutomationTestRunServlet servlet = new MockAutomationTestRunServlet(null, true, manageEc2, matcher);
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter("uuid", "testUuid");
    request.setParameter("browser", "chrome");
    request.setParameter("os", Platform.WINDOWS.toString());
    request.setParameter("threadCount", "7");
    request.setParameter("browserVersion", "21");
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid", nodeId, null, null, new Date(), 50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String, Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String, Object> capabilities = new HashMap<String, Object>();
    capabilities.put(CapabilityType.BROWSER_NAME, "chrome");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    servlet.setProxySet(proxySet);
    AutomationContext.getContext().setTotalNodeCount(50);
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.doGet(request, response);
    Assert.assertEquals("Hub should be able to fulfill request", HttpServletResponse.SC_CREATED,
            response.getStatusCode());
}

From source file:com.rmn.qa.servlet.AutomationTestRunServletTest.java

License:Open Source License

@Test
//TODO Update descriptions
public void testRequestStartNodesFailed() throws IOException, ServletException {
    MockVmManager manageEc2 = new MockVmManager();
    manageEc2.setThrowException();/*from   w  w w .  j  av  a  2  s.co  m*/
    MockRequestMatcher matcher = new MockRequestMatcher();
    matcher.setThreadsToReturn(0);
    MockAutomationTestRunServlet servlet = new MockAutomationTestRunServlet(null, false, manageEc2, matcher);
    MockHttpServletRequest request = new MockHttpServletRequest();
    request.setParameter("uuid", "testUuid");
    request.setParameter("browser", "firefox");
    request.setParameter("os", Platform.WINDOWS.toString());
    request.setParameter("threadCount", "10");
    String nodeId = "nodeId";
    // Add a node that is not running to make sure its not included in the available calculation
    AutomationDynamicNode node = new AutomationDynamicNode("testUuid", nodeId, null, null, new Date(), 50);
    AutomationContext.getContext().addNode(node);
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setMaxNumberOfConcurrentTestSessions(50);
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String, Object> config = new HashMap<String, Object>();
    config.put(AutomationConstants.INSTANCE_ID, nodeId);
    proxy.setConfig(config);
    Map<String, Object> capabilities = new HashMap<String, Object>();
    capabilities.put(CapabilityType.BROWSER_NAME, "firefox");
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities);
    proxy.setMultipleTestSlots(testSlot, 10);
    proxySet.add(proxy);
    servlet.setProxySet(proxySet);
    AutomationContext.getContext().setTotalNodeCount(50);
    MockHttpServletResponse response = new MockHttpServletResponse();
    servlet.doGet(request, response);
    Assert.assertEquals("Hub should be able to fulfill request", HttpServletResponse.SC_INTERNAL_SERVER_ERROR,
            response.getErrorCode());
    Assert.assertEquals("Error message should return if nodes can't be started",
            "Nodes could not be started: Can't start nodes", response.getErrorMessage());
}

From source file:com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher.java

License:Apache License

/**
 * Check that node and appium are installed
 *///from  w w  w  . j a  va  2 s.  c o  m
private void checkInstallation() {
    appiumHome = System.getenv("APPIUM_HOME");
    if (appiumHome != null) {
        if (Paths.get(appiumHome, "node").toFile().exists()
                || Paths.get(appiumHome, "node.exe").toFile().exists()) {
            nodeCommand = Paths.get(appiumHome, "node").toString();
        } else {
            nodeCommand = "node";
        }
    } else {
        throw new ConfigurationException("APPIUM_HOME environment variable not set");
    }

    // get appium version
    checkAppiumVersion();

    // get version for node
    String reply = OSCommand.executeCommandAndWait(nodeCommand + " -v").trim();
    if (!reply.matches("v\\d+\\.\\d+.*")) {
        throw new ConfigurationException(
                "Node does not seem to be installed, is environment variable APPIUM_HOME set ?");
    } else {
        nodeVersion = reply;
    }

    if (OSUtility.getCurrentPlatorm() == Platform.WINDOWS) {
        nodeCommand = "cmd /c start cmd /C " + nodeCommand;
    }
}

From source file:com.seleniumtests.connectors.db.Oracle.java

License:Apache License

/**
 * Search Oracle client on test server//from   w  ww  .j  a  v a  2s. c o  m
 * Steps are:
 * - use ORACLE_HOME env variable if it exists
 * - use C:\Oracle folder on windows
 *  
 * @return   root path of Oracle folder or null if none found
 */
public static String findOracleClient() {
    String oracleEnv = System.getenv("ORACLE_HOME");
    if (oracleEnv != null) {
        return oracleEnv;
    }

    if (OSUtility.getCurrentPlatorm() == Platform.WINDOWS && new File("C:\\oracle").isDirectory()) {
        for (File orCli : new File("C:\\oracle").listFiles()) {
            if (new File(orCli.getAbsolutePath() + File.separator + "NETWORK\\ADMIN\\sqlnet.ora").isFile()) {
                return orCli.getAbsolutePath();
            }
        }
    }
    return null;
}

From source file:com.seleniumtests.connectors.extools.SoapUi.java

License:Apache License

private void checkInstallation() {
    soapUiPath = System.getenv("SOAPUI_HOME");
    if (soapUiPath == null) {
        throw new ConfigurationException(
                "To use SoapUI, install it and create env var SOAPUI_HOME pointing to root installation path");
    }/*from  ww  w  .  j  a va 2s .  c o  m*/
    if (!Paths.get(soapUiPath, "bin").toFile().exists()) {
        throw new ConfigurationException(
                String.format("Path %s does not contain SOAP UI installation", soapUiPath));
    }

    if (OSUtility.getCurrentPlatorm() == Platform.WINDOWS) {
        soapUiPath = Paths.get(soapUiPath, "bin", "testrunner.bat").toString();
    } else {
        soapUiPath = Paths.get(soapUiPath, "bin", "testrunner.sh").toString();
    }
}