Search in sources :

Example 31 with TestSession

use of org.openqa.grid.internal.TestSession in project zalenium by zalando.

the class DockerSeleniumRemoteProxyTest method videoRecordingIsDisabledViaCapability.

@Test
public void videoRecordingIsDisabledViaCapability() {
    Map<String, Object> requestedCapability = getCapabilitySupportedByDockerSelenium();
    requestedCapability.put("recordVideo", false);
    TestSession newSession = proxy.getNewSession(requestedCapability);
    Assert.assertNotNull(newSession);
    Assert.assertEquals(proxy.isVideoRecordingEnabled(), false);
}
Also used : TestSession(org.openqa.grid.internal.TestSession) Test(org.junit.Test)

Example 32 with TestSession

use of org.openqa.grid.internal.TestSession in project zalenium by zalando.

the class DockerSeleniumRemoteProxyTest method noSessionIsCreatedWhenCapabilitiesAreNotSupported.

@Test
public void noSessionIsCreatedWhenCapabilitiesAreNotSupported() {
    // Non supported capabilities
    Map<String, Object> requestedCapability = new HashMap<>();
    requestedCapability.put(CapabilityType.BROWSER_NAME, BrowserType.IE);
    requestedCapability.put(CapabilityType.PLATFORM_NAME, Platform.WIN10);
    TestSession newSession = proxy.getNewSession(requestedCapability);
    Assert.assertNull(newSession);
}
Also used : HashMap(java.util.HashMap) TestSession(org.openqa.grid.internal.TestSession) Test(org.junit.Test)

Example 33 with TestSession

use of org.openqa.grid.internal.TestSession in project zalenium by zalando.

the class DockerSeleniumRemoteProxyTest method noSessionIsCreatedWithSpecialTimeZone.

@Test
public void noSessionIsCreatedWithSpecialTimeZone() {
    // Non supported capabilities
    TimeZone timeZone = TimeZone.getTimeZone("America/Montreal");
    Map<String, Object> requestedCapability = getCapabilitySupportedByDockerSelenium();
    requestedCapability.put("tz", timeZone.getID());
    TestSession newSession = proxy.getNewSession(requestedCapability);
    Assert.assertNull(newSession);
}
Also used : TimeZone(java.util.TimeZone) TestSession(org.openqa.grid.internal.TestSession) Test(org.junit.Test)

Example 34 with TestSession

use of org.openqa.grid.internal.TestSession in project zalenium by zalando.

the class DockerSeleniumRemoteProxyTest method dockerSeleniumOnlyRunsOneTestPerContainer.

@Test
public void dockerSeleniumOnlyRunsOneTestPerContainer() {
    // Supported desired capability for the test session
    Map<String, Object> requestedCapability = getCapabilitySupportedByDockerSelenium();
    // Not tests have been executed.
    Assert.assertEquals(0, proxy.getAmountOfExecutedTests());
    TestSession newSession = proxy.getNewSession(requestedCapability);
    Assert.assertNotNull(newSession);
    // One test is/has been executed and the session amount limit was reached.
    Assert.assertEquals(1, proxy.getAmountOfExecutedTests());
    Assert.assertTrue(proxy.isTestSessionLimitReached());
}
Also used : TestSession(org.openqa.grid.internal.TestSession) Test(org.junit.Test)

Example 35 with TestSession

use of org.openqa.grid.internal.TestSession in project zalenium by zalando.

the class DockerSeleniumRemoteProxyTest method noSessionIsCreatedWithSpecialScreenSize.

@Test
public void noSessionIsCreatedWithSpecialScreenSize() {
    // Non supported capabilities
    Dimension customScreenSize = new Dimension(1280, 760);
    Map<String, Object> requestedCapability = getCapabilitySupportedByDockerSelenium();
    String screenResolution = String.format("%sx%s", customScreenSize.getWidth(), customScreenSize.getHeight());
    requestedCapability.put("screenResolution", screenResolution);
    TestSession newSession = proxy.getNewSession(requestedCapability);
    Assert.assertNull(newSession);
}
Also used : TestSession(org.openqa.grid.internal.TestSession) Dimension(org.openqa.selenium.Dimension) Test(org.junit.Test)

Aggregations

TestSession (org.openqa.grid.internal.TestSession)49 Test (org.junit.Test)43 HashMap (java.util.HashMap)32 HttpServletResponse (javax.servlet.http.HttpServletResponse)17 WebDriverRequest (org.openqa.grid.web.servlet.handler.WebDriverRequest)17 ExternalSessionKey (org.openqa.grid.internal.ExternalSessionKey)11 JsonObject (com.google.gson.JsonObject)9 CommonProxyUtilities (de.zalando.ep.zalenium.util.CommonProxyUtilities)6 Environment (de.zalando.ep.zalenium.util.Environment)6 ServletOutputStream (javax.servlet.ServletOutputStream)6 TestInformation (de.zalando.ep.zalenium.dashboard.TestInformation)4 Mockito.anyString (org.mockito.Mockito.anyString)4 Dimension (org.openqa.selenium.Dimension)4 RegistrationRequest (org.openqa.grid.common.RegistrationRequest)3 JsonElement (com.google.gson.JsonElement)2 DockerSeleniumRemoteProxy (de.zalando.ep.zalenium.proxy.DockerSeleniumRemoteProxy)2 ProcessedCapabilities (de.zalando.ep.zalenium.util.ProcessedCapabilities)2 TimeZone (java.util.TimeZone)2 ObjectName (javax.management.ObjectName)2 JMXHelper (org.openqa.selenium.remote.server.jmx.JMXHelper)2