use of com.seleniumtests.browserfactory.mobile.ExistingAppiumLauncher in project seleniumRobot by bhecquet.
the class TestExistingAppiumLauncher method testAppiumStartup.
@Test(groups = { "it" }, enabled = false)
public void testAppiumStartup() {
try {
ExistingAppiumLauncher appium = new ExistingAppiumLauncher("http://localhost:4723/wd/hub/");
appium.startAppium();
appium.stopAppium();
} catch (ConfigurationException e) {
throw new SkipException("Test skipped, appium not correctly configured", e);
}
}
use of com.seleniumtests.browserfactory.mobile.ExistingAppiumLauncher in project seleniumRobot by bhecquet.
the class TestWebUiDriver method testLocaliOSDriverWithRemoteAppiumServer.
@Test(groups = { "it" })
public void testLocaliOSDriverWithRemoteAppiumServer() throws Exception {
whenNew(InstrumentsWrapper.class).withNoArguments().thenReturn(instrumentsWrapper);
List<MobileDevice> deviceList = new ArrayList<>();
when(instrumentsWrapper.parseIosDevices()).thenReturn(deviceList);
whenNew(IOSDriver.class).withAnyArguments().thenReturn(iosDriver);
when(iosDriver.manage()).thenReturn(driverOptions);
when(iosDriver.getCapabilities()).thenReturn(DesiredCapabilities.chrome());
when(driverOptions.timeouts()).thenReturn(timeouts);
SeleniumTestsContextManager.getThreadContext().setRunMode("local");
SeleniumTestsContextManager.getThreadContext().setAppiumServerUrl("http://localhost:4321/wd/hub/");
SeleniumTestsContextManager.getThreadContext().setDeviceId("123456");
SeleniumTestsContextManager.getThreadContext().setPlatform("ios");
SeleniumTestsContextManager.getThreadContext().setMobilePlatformVersion("13.0");
SeleniumTestsContextManager.getThreadContext().setTestType(TestType.APPIUM_APP_IOS);
createServerMock("GET", "/wd/hub/sessions", 200, "{}");
PowerMockito.mockStatic(AppiumLauncherFactory.class);
ExistingAppiumLauncher appiumLauncher;
appiumLauncher = spy(new ExistingAppiumLauncher("http://localhost:4321/wd/hub/"));
when(AppiumLauncherFactory.getInstance()).thenReturn(appiumLauncher);
WebUIDriver.getWebDriver(true);
PowerMockito.verifyNew(IOSDriver.class).withArguments(any(URL.class), any(Capabilities.class));
WebUIDriver.cleanUp();
verify(appiumLauncher).stopAppium();
}
use of com.seleniumtests.browserfactory.mobile.ExistingAppiumLauncher in project seleniumRobot by bhecquet.
the class TestWebUiDriver method testLocalAndroidDriverWithRemoteAppiumServer.
/**
* Test we can connect to a remote appium server (no local devices)
* @throws Exception
*/
@Test(groups = { "it" })
public void testLocalAndroidDriverWithRemoteAppiumServer() throws Exception {
whenNew(AdbWrapper.class).withNoArguments().thenReturn(adbWrapper);
List<MobileDevice> deviceList = 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().setAppiumServerUrl("http://localhost:4321/wd/hub/");
SeleniumTestsContextManager.getThreadContext().setDeviceId("emulator-5556");
SeleniumTestsContextManager.getThreadContext().setPlatform("android");
SeleniumTestsContextManager.getThreadContext().setMobilePlatformVersion("5.0");
SeleniumTestsContextManager.getThreadContext().setTestType(TestType.APPIUM_APP_ANDROID);
createServerMock("GET", "/wd/hub/sessions", 200, "{}");
PowerMockito.mockStatic(AppiumLauncherFactory.class);
ExistingAppiumLauncher appiumLauncher;
appiumLauncher = spy(new ExistingAppiumLauncher("http://localhost:4321/wd/hub/"));
when(AppiumLauncherFactory.getInstance()).thenReturn(appiumLauncher);
WebUIDriver.getWebDriver(true);
PowerMockito.verifyNew(AndroidDriver.class).withArguments(any(URL.class), any(Capabilities.class));
WebUIDriver.cleanUp();
verify(appiumLauncher).stopAppium();
}
use of com.seleniumtests.browserfactory.mobile.ExistingAppiumLauncher in project seleniumRobot by bhecquet.
the class TestWebUiDriver method testLocalAndroidDriverWithRemoteAppiumServerAndNoDeviceId.
/**
* Test we get an error when using remote appium and no deviceId is provided
* @throws Exception
*/
@Test(groups = { "it" }, expectedExceptions = ConfigurationException.class)
public void testLocalAndroidDriverWithRemoteAppiumServerAndNoDeviceId() throws Exception {
try {
whenNew(AdbWrapper.class).withNoArguments().thenReturn(adbWrapper);
List<MobileDevice> deviceList = 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().setAppiumServerUrl("http://localhost:4321/wd/hub/");
SeleniumTestsContextManager.getThreadContext().setPlatform("android");
SeleniumTestsContextManager.getThreadContext().setMobilePlatformVersion("5.0");
SeleniumTestsContextManager.getThreadContext().setTestType(TestType.APPIUM_APP_ANDROID);
createServerMock("GET", "/wd/hub/sessions", 200, "{}");
PowerMockito.mockStatic(AppiumLauncherFactory.class);
ExistingAppiumLauncher appiumLauncher;
appiumLauncher = spy(new ExistingAppiumLauncher("http://localhost:4321/wd/hub/"));
when(AppiumLauncherFactory.getInstance()).thenReturn(appiumLauncher);
WebUIDriver.getWebDriver(true);
} finally {
WebUIDriver.cleanUp();
}
}
Aggregations