Search in sources :

Example 11 with TestSetup

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

the class TestSetupTest method setupBrowserDetailsDeviceNameTest.

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

Example 12 with TestSetup

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

the class TestSetupTest method setupBrowserCapabilityIpadTest.

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

Example 13 with TestSetup

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

the class TestSetupTest method setupBrowserDetailsDevicePlatformTest.

@Test
public void setupBrowserDetailsDevicePlatformTest() {
    TestSetup setup = new TestSetup();
    setup.setupBrowserDetails(null);
    DesiredCapabilities capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is(CapabilityType.PLATFORM));
    Assert.assertNull(capability.getCapability(CapabilityType.PLATFORM));
    setup.setupBrowserDetails(new HashMap<>());
    capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is(CapabilityType.PLATFORM));
    Assert.assertNull(capability.getCapability(CapabilityType.PLATFORM));
    Map<String, String> browserDetails = new HashMap<>();
    browserDetails.put("browserName", "CHROME");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertFalse(capability.is(CapabilityType.PLATFORM));
    Assert.assertNull(capability.getCapability(CapabilityType.PLATFORM));
    browserDetails.put("devicePlatform", "Windows 10");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getPlatform().toString(), "WIN10");
    Assert.assertEquals(capability.getCapability(CapabilityType.PLATFORM).toString(), "WIN10");
    browserDetails.put("devicePlatform", "Linux");
    setup.setupBrowserDetails(browserDetails);
    capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getPlatform().toString(), "LINUX");
    Assert.assertEquals(capability.getCapability(CapabilityType.PLATFORM).toString(), "LINUX");
}
Also used : TestSetup(com.coveros.selenified.utilities.TestSetup) HashMap(java.util.HashMap) DesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities) Test(org.testng.annotations.Test)

Example 14 with TestSetup

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

the class TestSetupTest method setupBrowserCapabilityAndroidTest.

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

Example 15 with TestSetup

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

the class TestSetupTest method setupBrowserCapabilityOperaTest.

@Test
public void setupBrowserCapabilityOperaTest() throws InvalidBrowserException {
    TestSetup setup = new TestSetup();
    setup.setupBrowserCapability(Browser.OPERA);
    DesiredCapabilities capability = setup.getDesiredCapabilities();
    Assert.assertEquals(capability.getBrowserName(), "operablink");
    Assert.assertEquals(capability.getCapability(CapabilityType.BROWSER_NAME), "operablink");
}
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