Search in sources :

Example 6 with LocalAppiumLauncher

use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.

the class TestLocalAppiumLauncher method testNodeFoundInSystemPath.

/**
 * Test when node is found in system path
 * @throws IOException
 */
@Test(groups = { "ut" })
public void testNodeFoundInSystemPath() throws IOException {
    initValidAppiumInstallation();
    PowerMockito.mockStatic(OSCommand.class);
    when(OSCommand.executeCommandAndWait("node -v")).thenReturn("v6.2.1");
    LocalAppiumLauncher appium = new LocalAppiumLauncher();
    Assert.assertEquals(appium.getNodeVersion(), "v6.2.1");
}
Also used : LocalAppiumLauncher(com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 7 with LocalAppiumLauncher

use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.

the class TestLocalAppiumLauncher method testAppiumStartup.

@Test(groups = { "ut" })
public void testAppiumStartup() throws IOException {
    initValidAppiumInstallation();
    initValidNodeInstallation();
    when(OSCommand.executeCommand(contains("node_modules/appium/"))).thenReturn(nodeProcess);
    LocalAppiumLauncher appium = new LocalAppiumLauncher();
    appium.setAppiumPort(4723);
    appium.startAppiumWithoutWait();
    Assert.assertEquals(appium.getAppiumProcess(), nodeProcess);
}
Also used : LocalAppiumLauncher(com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 8 with LocalAppiumLauncher

use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.

the class TestLocalAppiumLauncher method testAppiumFoundInvalid.

/**
 * Test when appium_home path does not contain a right appiumConfig file
 * @throws IOException
 */
@Test(groups = { "ut" }, expectedExceptions = ConfigurationException.class)
public void testAppiumFoundInvalid() throws IOException {
    PowerMockito.mockStatic(FileUtils.class);
    PowerMockito.mockStatic(System.class);
    PowerMockito.mockStatic(OSCommand.class);
    when(System.getenv("APPIUM_HOME")).thenReturn("/opt/appium/");
    when(FileUtils.readFileToString(new File("/opt/appium/node_modules/appium/package.json"))).thenReturn("{\"name\":\"application\"}");
    new LocalAppiumLauncher();
}
Also used : LocalAppiumLauncher(com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher) File(java.io.File) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 9 with LocalAppiumLauncher

use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.

the class TestLocalAppiumLauncher method testAppiumStopWithoutStart.

@Test(groups = { "ut" }, expectedExceptions = ScenarioException.class)
public void testAppiumStopWithoutStart() throws IOException {
    initValidAppiumInstallation();
    initValidNodeInstallation();
    LocalAppiumLauncher appium = new LocalAppiumLauncher();
    appium.stopAppium();
}
Also used : LocalAppiumLauncher(com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 10 with LocalAppiumLauncher

use of com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher in project seleniumRobot by bhecquet.

the class TestLocalAppiumLauncher method testAppiumStop.

@Test(groups = { "ut" })
public void testAppiumStop() throws IOException {
    initValidAppiumInstallation();
    initValidNodeInstallation();
    when(OSCommand.executeCommand(contains("node_modules/appium/"))).thenReturn(nodeProcess);
    LocalAppiumLauncher appium = new LocalAppiumLauncher();
    appium.setAppiumPort(4723);
    appium.startAppiumWithoutWait();
    appium.stopAppium();
    Mockito.verify(nodeProcess).destroy();
}
Also used : LocalAppiumLauncher(com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher) Test(org.testng.annotations.Test) MockitoTest(com.seleniumtests.MockitoTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Aggregations

LocalAppiumLauncher (com.seleniumtests.browserfactory.mobile.LocalAppiumLauncher)10 Test (org.testng.annotations.Test)10 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)9 MockitoTest (com.seleniumtests.MockitoTest)8 ConfigurationException (com.seleniumtests.customexception.ConfigurationException)2 SkipException (org.testng.SkipException)2 GenericDriverTest (com.seleniumtests.GenericDriverTest)1 GenericTest (com.seleniumtests.GenericTest)1 MobileDevice (com.seleniumtests.browserfactory.mobile.MobileDevice)1 ReporterTest (com.seleniumtests.it.reporter.ReporterTest)1 AndroidDriver (io.appium.java_client.android.AndroidDriver)1 File (java.io.File)1 URL (java.net.URL)1 ArrayList (java.util.ArrayList)1 Capabilities (org.openqa.selenium.Capabilities)1 DesiredCapabilities (org.openqa.selenium.remote.DesiredCapabilities)1