Skip to content

Commit 1991a8a

Browse files
Fix codestyle issues
1 parent ff6e00d commit 1991a8a

File tree

10 files changed

+28
-17
lines changed

10 files changed

+28
-17
lines changed

src/main/java/io/appium/java_client/android/AndroidDriver.java

+5
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,11 @@ public AndroidBatteryInfo getBatteryInfo() {
199199
"script", "mobile: batteryInfo", "args", Collections.emptyList())).getValue());
200200
}
201201

202+
/**
203+
* Returns capabilities that were provided on instantiation.
204+
*
205+
* @return given {@link Capabilities}
206+
*/
202207
public Capabilities getCapabilities() {
203208
MutableCapabilities capabilities = (MutableCapabilities) super.getCapabilities();
204209
capabilities.setCapability(PLATFORM_NAME, ANDROID_PLATFORM);

src/main/java/io/appium/java_client/ios/IOSDriver.java

+5
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ private class InnerTargetLocator extends RemoteTargetLocator {
203203
}
204204
}
205205

206+
/**
207+
* Returns capabilities that were provided on instantiation.
208+
*
209+
* @return given {@link Capabilities}
210+
*/
206211
public Capabilities getCapabilities() {
207212
MutableCapabilities capabilities = (MutableCapabilities) super.getCapabilities();
208213
capabilities.setCapability(PLATFORM_NAME, IOS_PLATFORM);

src/test/java/io/appium/java_client/appium/element/generation/ios/IOSElementGenerationTest.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ public void whenIOSNativeAppIsLaunched() {
7474
IOSElement.class));
7575
}
7676

77-
@Test @Ignore public void whenIOSHybridAppIsLaunched() {
77+
@Ignore
78+
@Test public void whenIOSHybridAppIsLaunched() {
7879
assertTrue(check(serverAppCapabilitiesSupplier,
7980
appFileSupplierFunction.apply(webViewApp),
8081
(by, aClass) -> {

src/test/java/io/appium/java_client/ios/AppIOSTest.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ public class AppIOSTest extends BaseIOSTest {
1818

1919
@BeforeClass
2020
public static void beforeClass() throws UnknownHostException, MalformedURLException {
21-
String ipAddress = startAppiumServer();
22-
2321
if (service == null || !service.isRunning()) {
2422
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
2523
}
@@ -34,6 +32,6 @@ public static void beforeClass() throws UnknownHostException, MalformedURLExcept
3432
//sometimes environment has performance problems
3533
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
3634
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
37-
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
35+
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
3836
}
3937
}

src/test/java/io/appium/java_client/ios/BaseIOSTest.java

+6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ public class BaseIOSTest {
2929
protected static IOSDriver<IOSElement> driver;
3030
protected static final int PORT = 4723;
3131

32+
/**
33+
* Starts a local server.
34+
*
35+
* @return ip of a local host
36+
* @throws UnknownHostException when it is impossible to get ip address of a local host
37+
*/
3238
public static String startAppiumServer() throws UnknownHostException {
3339
service = new AppiumServiceBuilder().usingPort(PORT).build();
3440
service.start();

src/test/java/io/appium/java_client/ios/BaseIOSWebViewTest.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
public class BaseIOSWebViewTest extends BaseIOSTest {
3131

3232
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
33-
String ipAddress = startAppiumServer();
34-
3533
if (service == null || !service.isRunning()) {
3634
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
3735
}
@@ -45,7 +43,7 @@ public class BaseIOSWebViewTest extends BaseIOSTest {
4543
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
4644
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 8");
4745
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
48-
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
46+
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
4947
}
5048

5149
protected void findAndSwitchToWebView() throws InterruptedException {

src/test/java/io/appium/java_client/ios/BaseSafariTest.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@
3030
public class BaseSafariTest extends BaseIOSTest {
3131

3232
@BeforeClass public static void beforeClass() throws UnknownHostException, MalformedURLException {
33-
String ipAddress = startAppiumServer();
34-
3533
if (service == null || !service.isRunning()) {
3634
throw new AppiumServerHasNotBeenStartedLocallyException("An appium server node is not started!");
3735
}
@@ -43,6 +41,6 @@ public class BaseSafariTest extends BaseIOSTest {
4341
//sometimes environment has performance problems
4442
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
4543
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 8");
46-
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
44+
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
4745
}
4846
}

src/test/java/io/appium/java_client/ios/IOSDriverTest.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
import static org.junit.Assert.assertTrue;
2929
import static org.junit.Assert.fail;
3030

31-
import io.appium.java_client.appmanagement.ApplicationState;
3231
import io.appium.java_client.MobileElement;
32+
import io.appium.java_client.appmanagement.ApplicationState;
3333
import io.appium.java_client.remote.HideKeyboardStrategy;
3434
import io.appium.java_client.remote.MobileCapabilityType;
3535
import org.junit.Ignore;
@@ -62,7 +62,8 @@ public void getDeviceTimeTest() {
6262
driver.hideKeyboard(HideKeyboardStrategy.PRESS_KEY, "Done");
6363
}
6464

65-
@Test @Ignore public void geolocationTest() {
65+
@Ignore
66+
@Test public void geolocationTest() {
6667
Location location = new Location(45, 45, 100);
6768
try {
6869
driver.setLocation(location);
@@ -132,7 +133,8 @@ public void getDeviceTimeTest() {
132133
driver.launchApp();
133134
}
134135

135-
@Test @Ignore public void touchIdTest() {
136+
@Ignore
137+
@Test public void touchIdTest() {
136138
driver.toggleTouchIDEnrollment(true);
137139
driver.performTouchID(true);
138140
driver.performTouchID(false);

src/test/java/io/appium/java_client/ios/UICatalogIOSTest.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ public class UICatalogIOSTest extends BaseIOSTest {
1616

1717
@BeforeClass
1818
public static void beforeClass() throws UnknownHostException, MalformedURLException {
19-
String ipAddress = startAppiumServer();
20-
2119
if (service == null || !service.isRunning()) {
2220
throw new AppiumServerHasNotBeenStartedLocallyException(
2321
"An appium server node is not started!");
@@ -32,6 +30,6 @@ public static void beforeClass() throws UnknownHostException, MalformedURLExcept
3230
//sometimes environment has performance problems
3331
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
3432
capabilities.setCapability(MobileCapabilityType.APP, app.getAbsolutePath());
35-
driver = new IOSDriver<>(new URL("http://" + ipAddress + ":" + PORT + "/wd/hub"), capabilities);
33+
driver = new IOSDriver<>(new URL("http://" + startAppiumServer() + ":" + PORT + "/wd/hub"), capabilities);
3634
}
3735
}

src/test/java/io/appium/java_client/service/local/StartingAppLocallyTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
import static io.github.bonigarcia.wdm.WebDriverManager.chromedriver;
2020
import static org.junit.Assert.assertEquals;
2121
import static org.junit.Assert.assertNotEquals;
22-
import static org.junit.Assert.assertTrue;
2322
import static org.junit.Assert.assertNotNull;
23+
import static org.junit.Assert.assertTrue;
2424

2525
import io.appium.java_client.android.AndroidDriver;
2626
import io.appium.java_client.ios.IOSDriver;

0 commit comments

Comments
 (0)