Skip to content

Commit

Permalink
Fix codestyle issues
Browse files Browse the repository at this point in the history
  • Loading branch information
TikhomirovSergey committed Jun 21, 2018
1 parent ff6e00d commit 1991a8a
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@ public AndroidBatteryInfo getBatteryInfo() {
"script", "mobile: batteryInfo", "args", Collections.emptyList())).getValue());
}

/**
* Returns capabilities that were provided on instantiation.
*
* @return given {@link Capabilities}
*/
public Capabilities getCapabilities() {
MutableCapabilities capabilities = (MutableCapabilities) super.getCapabilities();
capabilities.setCapability(PLATFORM_NAME, ANDROID_PLATFORM);
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/io/appium/java_client/ios/IOSDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ private class InnerTargetLocator extends RemoteTargetLocator {
}
}

/**
* Returns capabilities that were provided on instantiation.
*
* @return given {@link Capabilities}
*/
public Capabilities getCapabilities() {
MutableCapabilities capabilities = (MutableCapabilities) super.getCapabilities();
capabilities.setCapability(PLATFORM_NAME, IOS_PLATFORM);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public void whenIOSNativeAppIsLaunched() {
IOSElement.class));
}

@Test @Ignore public void whenIOSHybridAppIsLaunched() {
@Ignore
@Test public void whenIOSHybridAppIsLaunched() {
assertTrue(check(serverAppCapabilitiesSupplier,
appFileSupplierFunction.apply(webViewApp),
(by, aClass) -> {
Expand Down
4 changes: 1 addition & 3 deletions src/test/java/io/appium/java_client/ios/AppIOSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public class AppIOSTest extends BaseIOSTest {

@BeforeClass
public static void beforeClass() throws UnknownHostException, MalformedURLException {
String ipAddress = startAppiumServer();

if (service == null || !service.isRunning()) {
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
}
Expand All @@ -34,6 +32,6 @@ public static void beforeClass() throws UnknownHostException, MalformedURLExcept
//sometimes environment has performance problems
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
}
}
6 changes: 6 additions & 0 deletions src/test/java/io/appium/java_client/ios/BaseIOSTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ public class BaseIOSTest {
protected static IOSDriver<IOSElement> driver;
protected static final int PORT = 4723;

/**
* Starts a local server.
*
* @return ip of a local host
* @throws UnknownHostException when it is impossible to get ip address of a local host
*/
public static String startAppiumServer() throws UnknownHostException {
service = new AppiumServiceBuilder().usingPort(PORT).build();
service.start();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
public class BaseIOSWebViewTest extends BaseIOSTest {

@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
String ipAddress = startAppiumServer();

if (service == null || !service.isRunning()) {
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
}
Expand All @@ -45,7 +43,7 @@ public class BaseIOSWebViewTest extends BaseIOSTest {
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 8");
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
}

protected void findAndSwitchToWebView() throws InterruptedException {
Expand Down
4 changes: 1 addition & 3 deletions src/test/java/io/appium/java_client/ios/BaseSafariTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
public class BaseSafariTest extends BaseIOSTest {

@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
String ipAddress = startAppiumServer();

if (service == null || !service.isRunning()) {
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
}
Expand All @@ -43,6 +41,6 @@ public class BaseSafariTest extends BaseIOSTest {
//sometimes environment has performance problems
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 8");
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
}
}
8 changes: 5 additions & 3 deletions src/test/java/io/appium/java_client/ios/IOSDriverTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import io.appium.java_client.appmanagement.ApplicationState;
import io.appium.java_client.MobileElement;
import io.appium.java_client.appmanagement.ApplicationState;
import io.appium.java_client.remote.HideKeyboardStrategy;
import io.appium.java_client.remote.MobileCapabilityType;
import org.junit.Ignore;
Expand Down Expand Up @@ -62,7 +62,8 @@ public void getDeviceTimeTest() {
driver.hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");
}

@Test @Ignore public void geolocationTest() {
@Ignore
@Test public void geolocationTest() {
Location location = new Location(45, 45, 100);
try {
driver.setLocation(location);
Expand Down Expand Up @@ -132,7 +133,8 @@ public void getDeviceTimeTest() {
driver.launchApp();
}

@Test @Ignore public void touchIdTest() {
@Ignore
@Test public void touchIdTest() {
driver.toggleTouchIDEnrollment(true);
driver.performTouchID(true);
driver.performTouchID(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ public class UICatalogIOSTest extends BaseIOSTest {

@BeforeClass
public static void beforeClass() throws UnknownHostException, MalformedURLException {
String ipAddress = startAppiumServer();

if (service == null || !service.isRunning()) {
throw new AppiumServerHasNotBeenStartedLocallyException(
"An appium server node is not started!");
Expand All @@ -32,6 +30,6 @@ public static void beforeClass() throws UnknownHostException, MalformedURLExcept
//sometimes environment has performance problems
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import static io.github.bonigarcia.wdm.WebDriverManager.chromedriver;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;

import io.appium.java_client.android.AndroidDriver;
import io.appium.java_client.ios.IOSDriver;
Expand Down

0 comments on commit 1991a8a

Please sign in to comment.