Example usage for org.openqa.selenium Platform LINUX

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

Introduction

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

Prototype

Platform LINUX

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

Click Source Link

Usage

From source file:com.rmn.qa.AutomationRunContextTest.java

License:Open Source License

@Test
// Tests that an old run gets cleaned up (removed)
public void testOldRun() {
    AutomationRunRequest oldRequest = new AutomationRunRequest("uuid", 10, "firefox", "10", Platform.LINUX,
            AutomationUtils.modifyDate(new Date(), -5, Calendar.MINUTE));
    AutomationRunContext context = AutomationContext.getContext();
    context.addRun(oldRequest);/*from   w  ww.  ja v  a2  s. c  o m*/

    Assert.assertTrue("Run should exist", context.hasRun(oldRequest.getUuid()));
    ProxySet proxySet = new ProxySet(false);
    proxySet.add(new MockRemoteProxy());
    context.cleanUpRunRequests(proxySet);
    Assert.assertFalse("Run request should no longer exist as it should have been removed",
            context.hasRun(oldRequest.getUuid()));
}

From source file:com.rmn.qa.AutomationRunContextTest.java

License:Open Source License

@Test
// Tests that a new run does not get cleaned up (removed)
public void testNewRunIE() {
    AutomationRunRequest oldRequest = new AutomationRunRequest("uuid", 10, "internetexplorer", "10",
            Platform.LINUX, AutomationUtils.modifyDate(new Date(), -7, Calendar.MINUTE));
    AutomationRunContext context = AutomationContext.getContext();
    context.addRun(oldRequest);//from   ww w .  j  ava 2 s . co m

    Assert.assertTrue("Run should exist", context.hasRun(oldRequest.getUuid()));
    ProxySet proxySet = new ProxySet(false);
    proxySet.add(new MockRemoteProxy());
    context.cleanUpRunRequests(proxySet);
    Assert.assertTrue("Run request should still exist as the run was new enough",
            context.hasRun(oldRequest.getUuid()));
}

From source file:com.rmn.qa.AutomationRunContextTest.java

License:Open Source License

@Test
// Tests that a new run does not get cleaned up (removed)
public void testOldRunIE() {
    AutomationRunRequest oldRequest = new AutomationRunRequest("uuid", 10, "internetexplorer", "10",
            Platform.LINUX, AutomationUtils.modifyDate(new Date(), -15, Calendar.MINUTE));
    AutomationRunContext context = AutomationContext.getContext();
    context.addRun(oldRequest);// ww  w  . ja va 2 s. c  o m

    Assert.assertTrue("Run should exist", context.hasRun(oldRequest.getUuid()));
    ProxySet proxySet = new ProxySet(false);
    proxySet.add(new MockRemoteProxy());
    context.cleanUpRunRequests(proxySet);
    Assert.assertFalse("Run request should no longer exist as it should have been removed",
            context.hasRun(oldRequest.getUuid()));
}

From source file:com.rmn.qa.AutomationRunContextTest.java

License:Open Source License

@Test
// Tests that a run with slots does not get removed
public void testActiveSession() {
    String uuid = "uuid";
    AutomationRunRequest request = new AutomationRunRequest(uuid, 10, "firefox", "10", Platform.LINUX,
            AutomationUtils.modifyDate(new Date(), -1, Calendar.HOUR));
    AutomationRunContext context = AutomationContext.getContext();
    context.addRun(request);//from w ww  .  j  a  va2 s .  c  o  m

    Assert.assertTrue("Run should exist", context.hasRun(request.getUuid()));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    CapabilityMatcher matcher = new AutomationCapabilityMatcher();
    proxy.setCapabilityMatcher(matcher);
    proxySet.add(proxy);
    Map<String, Object> config = new HashMap<>();
    config.put(AutomationConstants.UUID, uuid);
    proxy.setConfig(config);
    List<TestSlot> testSlots = new ArrayList<>();
    TestSlot testSlot = new TestSlot(proxy, null, null, config);
    proxy.setTestSlots(testSlots);
    testSlot.getNewSession(config);
    testSlots.add(testSlot);
    proxySet.add(proxy);
    context.cleanUpRunRequests(proxySet);
    Assert.assertTrue("Run request should still exist as there were active sessions",
            context.hasRun(request.getUuid()));
}

From source file:com.rmn.qa.AutomationRunContextTest.java

License:Open Source License

@Test
// Tests that a run with slots does not get removed
public void testNoSessions() {
    String uuid = "uuid";
    AutomationRunRequest request = new AutomationRunRequest(uuid, 10, "firefox", "10", Platform.LINUX,
            AutomationUtils.modifyDate(new Date(), -1, Calendar.HOUR));
    AutomationRunContext context = AutomationContext.getContext();
    context.addRun(request);/*from   ww  w .j a v a  2 s.c  o m*/

    Assert.assertTrue("Run should exist", context.hasRun(request.getUuid()));
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    CapabilityMatcher matcher = new AutomationCapabilityMatcher();
    proxy.setCapabilityMatcher(matcher);
    proxySet.add(proxy);
    Map<String, Object> config = new HashMap<>();
    config.put(AutomationConstants.UUID, uuid);
    proxy.setConfig(config);
    List<TestSlot> testSlots = new ArrayList<>();
    TestSlot testSlot = new TestSlot(proxy, null, null, config);
    proxy.setTestSlots(testSlots);
    testSlots.add(testSlot);
    proxySet.add(proxy);
    context.cleanUpRunRequests(proxySet);
    Assert.assertFalse("Run request should not exist as there were no active sessions",
            context.hasRun(request.getUuid()));
}

From source file:com.rmn.qa.AutomationRunContextTest.java

License:Open Source License

@Test
// Tests that for an old run, the in progress tests are counted
public void testOldRunInProgress() {
    String uuid = "testUuid";
    AutomationRunContext runContext = new AutomationRunContext();
    runContext.setTotalNodeCount(10);/*from w  w w.j av  a2 s .  c  om*/
    ProxySet proxySet = new ProxySet(false);
    MockRemoteProxy proxy = new MockRemoteProxy();
    proxy.setCapabilityMatcher(new AutomationCapabilityMatcher());
    Map<String, Object> capabilities = new HashMap<>();
    capabilities.put(CapabilityType.PLATFORM, "linux");
    capabilities.put(CapabilityType.BROWSER_NAME, "chrome");
    capabilities.put(AutomationConstants.UUID, uuid);
    AutomationRunRequest request = new AutomationRunRequest(uuid, 10, "chrome", "23", Platform.LINUX,
            AutomationUtils.modifyDate(new Date(), -5, Calendar.MINUTE));
    runContext.addRun(request);
    TestSlot testSlot = new TestSlot(proxy, SeleniumProtocol.WebDriver, null, capabilities);
    testSlot.getNewSession(capabilities);
    int inProgressTests = 5;
    proxy.setMultipleTestSlots(testSlot, inProgressTests);
    proxySet.add(proxy);
    int freeThreads = runContext.getTotalThreadsAvailable(proxySet);
    Assert.assertEquals("Free threads should reflect in progress test count", inProgressTests, freeThreads);
}

From source file:com.rmn.qa.AutomationRunRequestTest.java

License:Open Source License

@Test
// Tests that two run request objects match each other
public void testMatchesOtherRunRequest() {
    String uuid = "testUuid";
    String browser = "firefox";
    String browserVersion = "20";
    Platform os = Platform.LINUX;
    AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, os);
    AutomationRunRequest second = new AutomationRunRequest(uuid, null, browser, browserVersion, os);
    Assert.assertTrue("Run requests should match", first.matchesCapabilities(second));
}

From source file:com.rmn.qa.AutomationRunRequestTest.java

License:Open Source License

@Test
// Tests that two run request objects do match each other due to mismatching browsers
public void testMatchesOtherRunRequestBadBrowser() {
    String uuid = "testUuid";
    String browser = "firefox";
    String browserVersion = "20";
    Platform os = Platform.LINUX;
    AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, os);
    AutomationRunRequest second = new AutomationRunRequest(uuid, null, "badBrowser", browserVersion, os);
    Assert.assertFalse("Run requests should NOT match due to browser", first.matchesCapabilities(second));
}

From source file:com.rmn.qa.AutomationRunRequestTest.java

License:Open Source License

@Test
// Tests that two run request objects do match each other due to mismatching browser versions
public void testMatchesOtherRunRequestBadBrowserVersion() {
    String uuid = "testUuid";
    String browser = "firefox";
    String browserVersion = "20";
    Platform os = Platform.LINUX;
    AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, os);
    AutomationRunRequest second = new AutomationRunRequest(uuid, null, browser, "12432", os);
    Assert.assertFalse("Run requests should NOT match due to browser version",
            first.matchesCapabilities(second));
}

From source file:com.rmn.qa.AutomationRunRequestTest.java

License:Open Source License

@Test
// Tests that two run request objects do match each other due to mismatching OS
public void testMatchesOtherRunRequestBadOs() {
    String uuid = "testUuid";
    String browser = "firefox";
    String browserVersion = "20";
    Platform os = Platform.LINUX;
    AutomationRunRequest first = new AutomationRunRequest(uuid, null, browser, browserVersion, os);
    AutomationRunRequest second = new AutomationRunRequest(uuid, null, browser, browserVersion, Platform.MAC);
    Assert.assertFalse("Run requests should NOT match due to browser", first.matchesCapabilities(second));
}