Search in sources :

Example 16 with TestSetup

use of com.coveros.selenified.utilities.TestSetup in project selenified by Coveros.

the class TestSetupTest method setupBrowserDetailsDeviceOrientationTest.

@Test
public void setupBrowserDetailsDeviceOrientationTest() {
    TestSetup setup = new TestSetup();
    setup.setupBrowserDetails(null);
    DesiredCapabilities capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is("device-orientation"));
    Assert.assertNull(capability.getCapability("device-orientation"));
    setup.setupBrowserDetails(new HashMap<>());
    capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is("device-orientation"));
    Assert.assertNull(capability.getCapability("device-orientation"));
    Map<String, String> browserDetails = new HashMap<>();
    browserDetails.put("browserName", "CHROME");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is("device-orientation"));
    Assert.assertNull(capability.getCapability("device-orientation"));
    browserDetails.put("deviceOrientation", "Landscape");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getCapability("device-orientation"), "Landscape");
}
Also used : TestSetup(com.coveros.selenified.utilities.TestSetup) HashMap(java.util.HashMap) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) Test(org.testng.annotations.Test)

Example 17 with TestSetup

use of com.coveros.selenified.utilities.TestSetup in project selenified by Coveros.

the class TestSetupTest method setupBrowserCapabilityIllegalBrowserTest.

@Test(expectedExceptions = InvalidBrowserException.class)
public void setupBrowserCapabilityIllegalBrowserTest() throws InvalidBrowserException {
    TestSetup setup = new TestSetup();
    setup.setupBrowserCapability(Browser.NONE);
}
Also used : TestSetup(com.coveros.selenified.utilities.TestSetup) Test(org.testng.annotations.Test)

Example 18 with TestSetup

use of com.coveros.selenified.utilities.TestSetup in project selenified by Coveros.

the class TestSetupTest method setupBrowserDetailsBrowserVersionTest.

@Test
public void setupBrowserDetailsBrowserVersionTest() {
    TestSetup setup = new TestSetup();
    setup.setupBrowserDetails(null);
    DesiredCapabilities capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is(CapabilityType.VERSION));
    Assert.assertNull(capability.getCapability(CapabilityType.VERSION));
    setup.setupBrowserDetails(new HashMap<>());
    capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is(CapabilityType.VERSION));
    Assert.assertNull(capability.getCapability(CapabilityType.VERSION));
    Map<String, String> browserDetails = new HashMap<>();
    browserDetails.put("browserName", "CHROME");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is(CapabilityType.VERSION));
    Assert.assertNull(capability.getCapability(CapabilityType.VERSION));
    browserDetails.put("browserVersion", "50");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getVersion(), "50");
    Assert.assertEquals(capability.getCapability(CapabilityType.VERSION), "50");
    browserDetails.put("browserVersion", "49.1.1");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getVersion(), "49.1.1");
    Assert.assertEquals(capability.getCapability(CapabilityType.VERSION), "49.1.1");
    browserDetails.put("browserVersion", "latest");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getVersion(), "latest");
    Assert.assertEquals(capability.getCapability(CapabilityType.VERSION), "latest");
}
Also used : TestSetup(com.coveros.selenified.utilities.TestSetup) HashMap(java.util.HashMap) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) Test(org.testng.annotations.Test)

Example 19 with TestSetup

use of com.coveros.selenified.utilities.TestSetup in project selenified by Coveros.

the class TestSetupTest method setupBrowserCapabilityPhantomJSTest.

@Test
public void setupBrowserCapabilityPhantomJSTest() throws InvalidBrowserException {
    TestSetup setup = new TestSetup();
    setup.setupBrowserCapability(Browser.PHANTOMJS);
    DesiredCapabilities capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getBrowserName(), "phantomjs");
    Assert.assertEquals(capability.getCapability(CapabilityType.BROWSER_NAME), "phantomjs");
}
Also used : TestSetup(com.coveros.selenified.utilities.TestSetup) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) Test(org.testng.annotations.Test)

Example 20 with TestSetup

use of com.coveros.selenified.utilities.TestSetup in project selenified by Coveros.

the class TestSetupTest method setupBrowserCapabilitySafariTest.

@Test
public void setupBrowserCapabilitySafariTest() throws InvalidBrowserException {
    TestSetup setup = new TestSetup();
    setup.setupBrowserCapability(Browser.SAFARI);
    DesiredCapabilities capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getBrowserName(), "safari");
    Assert.assertEquals(capability.getCapability(CapabilityType.BROWSER_NAME), "safari");
}
Also used : TestSetup(com.coveros.selenified.utilities.TestSetup) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) Test(org.testng.annotations.Test)

Aggregations

TestSetup (com.coveros.selenified.utilities.TestSetup)20 Test (org.testng.annotations.Test)20 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)17 HashMap (java.util.HashMap)7 Proxy (org.openqa.selenium.Proxy)1