From 6bdf9f78fa1f92479df616252259c91ab0c47a5b Mon Sep 17 00:00:00 2001 From: Sergey Tikhomirov Date: Sat, 2 Sep 2017 01:41:35 +0300 Subject: [PATCH 1/3] #714 FIX - Update to Selenium 3.5.3 - phantomJSdriver and htmlunit-drive were excluded - eclipse compiler was updated to 4.6.1 --- build.gradle | 10 +++++++--- .../java_client/pagefactory/AppiumElementLocator.java | 3 +-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 8b7d83c09..8f8f5b4e2 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ apply plugin: 'signing' apply plugin: 'maven-publish' group 'io.appium' -version '5.0.1' +version '5.0.2' repositories { jcenter() @@ -38,7 +38,7 @@ configurations { } dependencies { - ecj 'org.eclipse.jdt.core.compiler:ecj:4.5.1' + ecj 'org.eclipse.jdt.core.compiler:ecj:4.6.1' } compileJava { @@ -54,7 +54,7 @@ compileJava { ] } -ext.seleniumVersion = '[3.5.2,3.5.2]' +ext.seleniumVersion = '[3.5.3,3.5.3]' dependencies { compile ("org.seleniumhq.selenium:selenium-java:${seleniumVersion}") { @@ -62,6 +62,10 @@ dependencies { exclude module: 'cglib' exclude group: 'com.google.code.gson' + exclude module: 'phantomjsdriver' + exclude module: 'htmlunit-driver' + exclude group: 'net.sourceforge.htmlunit' + } compile ("org.seleniumhq.selenium:selenium-support:${seleniumVersion}") { force = true diff --git a/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocator.java b/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocator.java index 6ce4e3b1b..61c526476 100644 --- a/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocator.java +++ b/src/main/java/io/appium/java_client/pagefactory/AppiumElementLocator.java @@ -21,8 +21,6 @@ import static io.appium.java_client.pagefactory.ThrowableUtil.isStaleElementReferenceException; -import com.google.common.base.Function; - import io.appium.java_client.pagefactory.locator.CacheableLocator; import org.openqa.selenium.By; @@ -38,6 +36,7 @@ import java.util.ArrayList; import java.util.List; import java.util.concurrent.TimeUnit; +import java.util.function.Function; import java.util.function.Supplier; class AppiumElementLocator implements CacheableLocator { From 168d9d8cc068fb6417a1481237412efd02408574 Mon Sep 17 00:00:00 2001 From: Sergey Tikhomirov Date: Sat, 2 Sep 2017 12:17:30 +0300 Subject: [PATCH 2/3] #714 FIX - test improvement --- .../android/OpenNotificationsTest.java | 20 ++++++++----------- .../java_client/ios/IOSElementTest.java | 15 +++++--------- 2 files changed, 13 insertions(+), 22 deletions(-) diff --git a/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java b/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java index a0aaaf2fc..ff37129a6 100644 --- a/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java +++ b/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java @@ -1,12 +1,11 @@ package io.appium.java_client.android; import static org.junit.Assert.assertNotEquals; +import static org.openqa.selenium.By.id; -import com.google.common.base.Function; import org.junit.Test; -import org.openqa.selenium.WebDriver; import org.openqa.selenium.support.ui.WebDriverWait; import java.util.List; @@ -17,18 +16,15 @@ public void openNotification() throws Exception { driver.closeApp(); driver.openNotifications(); WebDriverWait wait = new WebDriverWait(driver, 20); - assertNotEquals(0, wait.until(new Function>() { - @Override - public List apply(WebDriver input) { - List result = driver - .findElementsById("com.android.systemui:id/carrier_label"); + assertNotEquals(0, wait.until(input -> { + List result = input + .findElements(id("com.android.systemui:id/carrier_label")); - if (result.size() == 0) { - return null; - } - - return result; + if (result.size() == 0) { + return null; } + + return result; }).size()); } } diff --git a/src/test/java/io/appium/java_client/ios/IOSElementTest.java b/src/test/java/io/appium/java_client/ios/IOSElementTest.java index b3305d720..9c3cf1692 100644 --- a/src/test/java/io/appium/java_client/ios/IOSElementTest.java +++ b/src/test/java/io/appium/java_client/ios/IOSElementTest.java @@ -5,13 +5,11 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; -import com.google.common.base.Function; import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runners.MethodSorters; import org.openqa.selenium.By; -import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.ui.WebDriverWait; @@ -32,15 +30,12 @@ public class IOSElementTest extends UICatalogIOSTest { WebDriverWait wait = new WebDriverWait(driver, 20); - IOSElement slider = (IOSElement) wait.until(new Function>() { - @Override - public List apply(WebDriver input) { - List result = input.findElements(By.className("UIASlider")); - if (result.size() == 0) { - return null; - } - return result; + IOSElement slider = (IOSElement) wait.until(input -> { + List result = input.findElements(By.className("UIASlider")); + if (result.size() == 0) { + return null; } + return result; }).get(1); slider.setValue("0%"); assertEquals("0%", slider.getAttribute("value")); From feb1efb6c344011c721ef3de21fb703f5875864d Mon Sep 17 00:00:00 2001 From: Sergey Tikhomirov Date: Sat, 2 Sep 2017 22:02:59 +0300 Subject: [PATCH 3/3] OpenNotificationsTest was improved --- .../appium/java_client/android/OpenNotificationsTest.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java b/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java index ff37129a6..31254026e 100644 --- a/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java +++ b/src/test/java/io/appium/java_client/android/OpenNotificationsTest.java @@ -20,11 +20,7 @@ public void openNotification() throws Exception { List result = input .findElements(id("com.android.systemui:id/carrier_label")); - if (result.size() == 0) { - return null; - } - - return result; + return result.isEmpty() ? null : result; }).size()); } }