use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.
the class TestLocalAppiumLauncher method testAppiumRandomPort.
@Test(groups = { "ut" })
public void testAppiumRandomPort() throws IOException {
initValidAppiumInstallation();
initValidNodeInstallation();
LocalAppiumLauncher appium1 = new LocalAppiumLauncher();
LocalAppiumLauncher appium2 = new LocalAppiumLauncher();
Assert.assertNotEquals(appium1.getAppiumPort(), appium2.getAppiumPort());
}
use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.
the class TestLocalAppiumLauncher method testAppiumStartup.
@Test(groups = { "it" })
public void testAppiumStartup() {
try {
LocalAppiumLauncher appium = new LocalAppiumLauncher();
appium.startAppium();
appium.stopAppium();
} catch (ConfigurationException e) {
throw new SkipException("Test skipped, appium not correctly configured", e);
}
}
use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.
the class TestWebUiDriver method testLocalAndroidDriver.
@Test(groups = { "it" })
public void testLocalAndroidDriver() throws Exception {
whenNew(AdbWrapper.class).withNoArguments().thenReturn(adbWrapper);
List<MobileDevice> deviceList = new ArrayList<>();
deviceList.add(new MobileDevice("IPhone 6", "0000", "ios", "10.2", new ArrayList<>()));
deviceList.add(new MobileDevice("Nexus 5", "1234", "android", "5.0", new ArrayList<>()));
deviceList.add(new MobileDevice("Nexus 7", "1235", "android", "6.0", new ArrayList<>()));
when(adbWrapper.getDeviceList()).thenReturn(deviceList);
whenNew(AndroidDriver.class).withAnyArguments().thenReturn(androidDriver);
when(androidDriver.manage()).thenReturn(driverOptions);
when(androidDriver.getCapabilities()).thenReturn(DesiredCapabilities.chrome());
when(driverOptions.timeouts()).thenReturn(timeouts);
SeleniumTestsContextManager.getThreadContext().setRunMode("local");
SeleniumTestsContextManager.getThreadContext().setPlatform("android");
SeleniumTestsContextManager.getThreadContext().setMobilePlatformVersion("5.0");
SeleniumTestsContextManager.getThreadContext().setTestType(TestType.APPIUM_APP_ANDROID);
PowerMockito.mockStatic(AppiumLauncherFactory.class);
LocalAppiumLauncher appiumLauncher;
try {
appiumLauncher = spy(new LocalAppiumLauncher());
when(AppiumLauncherFactory.getInstance()).thenReturn(appiumLauncher);
WebUIDriver.getWebDriver(true);
} catch (ConfigurationException e) {
throw new SkipException("Test skipped, appium not correctly configured", e);
}
PowerMockito.verifyNew(AndroidDriver.class).withArguments(any(URL.class), any(Capabilities.class));
verify(appiumLauncher).stopAppium();
}
use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.
the class TestLocalAppiumLauncher method testAppiumFound.
/**
* Test when appium_home exist, version found
* @throws IOException
*/
@Test(groups = { "ut" })
public void testAppiumFound() throws IOException {
initValidAppiumInstallation();
initValidNodeInstallation();
LocalAppiumLauncher appium = new LocalAppiumLauncher();
Assert.assertEquals(appium.getAppiumVersion(), "1.4.13");
}
use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.
the class TestLocalAppiumLauncher method testNodeFoundInAppiumPath.
/**
* !!! THIS METHOD is ignored as PowerMock cannot mock nio.Paths class !!!
*
* Test when node is found in appium path
* @throws IOException
*/
@Test(groups = { "ut" }, enabled = false)
public void testNodeFoundInAppiumPath() throws IOException {
initValidAppiumInstallation();
PowerMockito.mockStatic(OSCommand.class);
when(OSCommand.executeCommandAndWait("/opt/appium/node -v")).thenReturn("v6.2.1");
PowerMockito.mockStatic(Paths.class);
when(Paths.get("/opt/appium/", "node")).thenReturn(nodePath);
when(nodePath.toFile()).thenReturn(nodeFile);
when(nodeFile.exists()).thenReturn(true);
LocalAppiumLauncher appium = new LocalAppiumLauncher();
Assert.assertEquals(appium.getNodeVersion(), "v6.2.1");
}
Aggregations