diff --git a/README.md b/README.md index 2a18947d8..35e0b8ab1 100644 --- a/README.md +++ b/README.md @@ -7,75 +7,17 @@ This is the Java language binding for writing Appium Tests, conforms to [Mobile JSON Wire Protocol](https://github.com/SeleniumHQ/mobile-spec/blob/master/spec-draft.md) -[How to install it and to use it](https://github.com/appium/java-client/blob/master/docs/Installing-the-project.md) - [API docs](http://appium.github.io/java-client/) -###Structure### - -There is an abstract `io.appium.java_client.AppiumDriver` class which extends `org.openqa.selenium.remote.RemoteWebDriver` -from the Selenium Java Client. The `io.appium.java_client.AppiumDriver` class contains all methods shared by iOS and Android. -`io.appium.java_client.ios.IOSDriver` and `io.appium.java_client.android.AndroidDriver` both extend `io.appium.java_client.AppiumDriver` -and provide more methods, and specific implementations for some methods. - -In the same way, `io.appium.java_client.ios.IOSElement` and `io.appium.java_client.android.AndroidElement` both are subclasses of -`io.appium.java_client.MobileElement` - - -###Added functions### -More can be found in the docs, but here's a quick list of features which this project has added to the usual selenium binding. - - -- startActivity() -- resetApp() -- getAppStringMap() -- pressKeyCode() -- longPressKeyCode() -- longPressKey() -- currentActivity() -- getDeviceTime() -- pullFile() -- pushFile() -- pullFolder() -- replaceValue() -- hideKeyboard() -- runAppInBackground() -- performTouchAction() -- performMultiTouchAction() -- tap() -- swipe() -- pinch() -- zoom() -- isAppInstalled() -- installApp() -- removeApp() -- launchApp() -- closeApp() -- endTestCoverage() -- isLocked() -- shake() -- getSessionDetails() -- openNotifications() -- Context Switching: .context(), .getContextHandles(), getContext()) -- setConnection(), getConnection() -- ignoreUnimportantViews(), getSettings() -- toggleLocationServices() -- lockDevice() -- unlockDevice() - -Locators: -- findElementByAccessibilityId() -- findElementsByAccessibilityId() -- findElementByIosUIAutomation() -- findElementsByIosUIAutomation() -- findElementByAndroidUIAutomator() -- findElementsByAndroidUIAutomator() - -### Features and other interesting information### - -You can get it on [WIKI](https://github.com/appium/java-client/wiki) - -## Changelog# +###Features and other interesting information### + +[Tech stack](https://github.com/appium/java-client/blob/master/docs/Tech-stack.md) + +[How to install the project](https://github.com/appium/java-client/blob/master/docs/Installing-the-project.md) + +[WIKI](https://github.com/appium/java-client/wiki) + +##Changelog## *5.0.0 (under construction yet)* - **[MAJOR ENHANCEMENT]**: Migration to Java 8. Epic: [#399](https://github.com/appium/java-client/issues/399) - API with default implementation. PR [#470](https://github.com/appium/java-client/pull/470) @@ -156,7 +98,6 @@ You can get it on [WIKI](https://github.com/appium/java-client/wiki) - [ENHANCEMENT] Added the ability to set UiAutomator Congfigurator values. [#410](https://github.com/appium/java-client/pull/410). [#477](https://github.com/appium/java-client/pull/477). -- **[UPDATE]** to Selenium 3.0. [#489](https://github.com/appium/java-client/pull/489) - [ENHANCEMENT]. Additional methods which perform device rotation were implemented. [#489](https://github.com/appium/java-client/pull/489). [#439](https://github.com/appium/java-client/pull/439). But it works for iOS in XCUIT mode and for Android in UIAutomator2 mode only. The feature request: [#7131](https://github.com/appium/appium/issues/7131) - [ENHANCEMENT]. TouchID Implementation (iOS Sim Only). Details: [#509](https://github.com/appium/java-client/pull/509) - [ENHANCEMENT]. The ability to use port, ip and log file as server arguments was provided. Feature request: [#521](https://github.com/appium/java-client/issues/521). Fixes: [#522](https://github.com/appium/java-client/issues/522), [#524](https://github.com/appium/java-client/issues/524). @@ -183,6 +124,10 @@ You can get it on [WIKI](https://github.com/appium/java-client/wiki) - `IOSMobileCapabilityType#WEB_DRIVER_AGENT_URL` - `IOSMobileCapabilityType#KEYCHAIN_PATH` - `MobileCapabilityType#CLEAR_SYSTEM_FILES` +- **[UPDATE]** to Selenium 3.0.1. +- **[UPDATE]** to Spring Framework 4.3.5.RELEASE. +- **[UPDATE]** to AspectJ weaver 1.8.10. + *4.1.2* diff --git a/build.gradle b/build.gradle index 2e0991e1f..433e25b2c 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ apply plugin: 'checkstyle' apply plugin: 'signing' group 'io.appium' -version '5.0.0-SNAPSHOT' +version '5.0.0-BETA1' repositories { jcenter() @@ -50,19 +50,19 @@ compileJava { } dependencies { - compile('org.seleniumhq.selenium:selenium-java:3.0.0'){ + compile('org.seleniumhq.selenium:selenium-java:3.0.1'){ exclude module: 'cglib' exclude group: 'com.google.code.gson' } - compile 'com.google.code.gson:gson:2.7' + compile 'com.google.code.gson:gson:2.8.0' compile 'org.apache.httpcomponents:httpclient:4.5.2' - compile 'com.google.guava:guava:19.0' + compile 'com.google.guava:guava:20.0' compile 'cglib:cglib:3.2.4' compile 'commons-validator:commons-validator:1.5.1' - compile 'org.apache.commons:commons-lang3:3.4' + compile 'org.apache.commons:commons-lang3:3.5' compile 'commons-io:commons-io:2.5' - compile 'org.springframework:spring-context:4.3.2.RELEASE' - compile 'org.aspectj:aspectjweaver:1.8.9' + compile 'org.springframework:spring-context:4.3.5.RELEASE' + compile 'org.aspectj:aspectjweaver:1.8.10' testCompile 'junit:junit:4.12' } diff --git a/src/main/java/io/appium/java_client/PerformsActions.java b/src/main/java/io/appium/java_client/PerformsActions.java index cfdd0bf60..021425e6c 100644 --- a/src/main/java/io/appium/java_client/PerformsActions.java +++ b/src/main/java/io/appium/java_client/PerformsActions.java @@ -16,7 +16,7 @@ package io.appium.java_client; -public interface PerformsActions { +public interface PerformsActions> { T perform(); } diff --git a/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java b/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java index a04a682de..16ce2f3cd 100644 --- a/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java +++ b/src/main/java/io/appium/java_client/service/local/AppiumDriverLocalService.java @@ -48,6 +48,7 @@ public final class AppiumDriverLocalService extends DriverService { private final TimeUnit timeUnit; private final ReentrantLock lock = new ReentrantLock(true); //uses "fair" thread ordering policy private final ListOutputStream stream = new ListOutputStream().add(System.out); + private final URL url; @@ -64,6 +65,7 @@ public final class AppiumDriverLocalService extends DriverService { this.nodeJSEnvironment = nodeJSEnvironment; this.startupTimeout = startupTimeout; this.timeUnit = timeUnit; + this.url = new URL(String.format(URL_MASK, this.ipAddress, this.nodeJSPort)); } public static AppiumDriverLocalService buildDefaultService() { @@ -78,11 +80,7 @@ public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder * @return The base URL for the managed appium server. */ @Override public URL getUrl() { - try { - return new URL(String.format(URL_MASK, ipAddress, nodeJSPort)); - } catch (MalformedURLException e) { - throw new RuntimeException(e); - } + return url; } @Override public boolean isRunning() { @@ -101,6 +99,8 @@ public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder return true; } catch (UrlChecker.TimeoutException e) { return false; + } catch (MalformedURLException e) { + throw new AppiumServerHasNotBeenStartedLocallyException(e.getMessage(), e); } } finally { lock.unlock(); @@ -108,15 +108,9 @@ public static AppiumDriverLocalService buildService(AppiumServiceBuilder builder } - private void ping(long time, TimeUnit timeUnit) throws UrlChecker.TimeoutException { - URL url = getUrl(); - try { - URL status = new URL(url.toString() + "/status"); - new UrlChecker().waitUntilAvailable(time, timeUnit, status); - } catch (MalformedURLException e) { - throw new RuntimeException( - "There is something wrong with the URL " + url.toString().toString() + "/status"); - } + private void ping(long time, TimeUnit timeUnit) throws UrlChecker.TimeoutException, MalformedURLException { + URL status = new URL(url.toString() + "/status"); + new UrlChecker().waitUntilAvailable(time, timeUnit, status); } /** diff --git a/src/test/java/io/appium/java_client/localserver/ThreadSafetyTest.java b/src/test/java/io/appium/java_client/localserver/ThreadSafetyTest.java index 21ccd9d9b..f4ea4ebe8 100644 --- a/src/test/java/io/appium/java_client/localserver/ThreadSafetyTest.java +++ b/src/test/java/io/appium/java_client/localserver/ThreadSafetyTest.java @@ -4,26 +4,27 @@ import static org.junit.Assert.assertTrue; import io.appium.java_client.service.local.AppiumDriverLocalService; +import io.appium.java_client.service.local.AppiumServerHasNotBeenStartedLocallyException; import org.junit.Test; public class ThreadSafetyTest { private final AppiumDriverLocalService service = AppiumDriverLocalService.buildDefaultService(); private final Action run = new Action() { - @Override Object perform() { + @Override protected Object perform() { service.start(); return "OK"; } }; private final Action run2 = run.clone(); private final Action isRunning = new Action() { - @Override Object perform() { + @Override protected Object perform() { return service.isRunning(); } }; private final Action isRunning2 = isRunning.clone(); private final Action stop = new Action() { - @Override Object perform() { + @Override protected Object perform() { service.stop(); return "OK"; } @@ -198,13 +199,13 @@ public class ThreadSafetyTest { private abstract static class Action implements Cloneable { - abstract Object perform(); + protected abstract Object perform(); public Action clone() { try { return (Action) super.clone(); } catch (Throwable t) { - throw new RuntimeException(t); + throw new AppiumServerHasNotBeenStartedLocallyException(t.getMessage(), t); } } } diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/GenericTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/GenericTest.java index c55dfd702..7c06ba2a5 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/GenericTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/GenericTest.java @@ -28,7 +28,7 @@ static class MockWebDriver implements WebDriver { @Override public void get(String url) { - + System.out.print(url); } @Override @@ -58,12 +58,12 @@ public String getPageSource() { @Override public void close() { - + System.out.print("Closed"); } @Override public void quit() { - + System.out.print("Died"); } @Override diff --git a/src/test/java/io/appium/java_client/pagefactory_tests/SelendroidModeTest.java b/src/test/java/io/appium/java_client/pagefactory_tests/SelendroidModeTest.java index fe6e501a9..a6ac38e70 100644 --- a/src/test/java/io/appium/java_client/pagefactory_tests/SelendroidModeTest.java +++ b/src/test/java/io/appium/java_client/pagefactory_tests/SelendroidModeTest.java @@ -186,6 +186,9 @@ public class SelendroidModeTest { @Test public void findBySelendroidLinkTextTest() { assertEquals("Accessibility", textLink.getText()); + } + @Test public void findBySelendroidPartialLinkTextTest() { + assertEquals("Accessibility", textPartialLink.getText()); } }