Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addition to #545 #546

Merged
merged 10 commits into from
Dec 27, 2016
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ cache:
- $HOME/.gradle/wrapper/

script:
- ./gradlew clean build -x test
- ./gradlew clean build -x test -x signArchives
131 changes: 69 additions & 62 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'eclipse'
apply plugin: 'jacoco'
apply plugin: 'maven-publish'
apply plugin: 'checkstyle'
apply plugin: 'signing'

group 'io.appium'
version '5.0.0-SNAPSHOT'
Expand Down Expand Up @@ -122,78 +122,85 @@ tasks.withType(Checkstyle) {
exclude '**/org/openqa/selenium/**'
}

task javadocs(type: Javadoc) {
source = sourceSets.main.java
}

publishing {
publications {
mavenJava(MavenPublication) {
pom.withXml {
asNode().children().last() + {
resolveStrategy = Closure.DELEGATE_FIRST
name 'java-client'
description 'Java client for Appium Mobile Webdriver'
url 'http://appium.io'
developers {
developer {
name 'Jonah Stiennon'
email '[email protected]'
url 'https://github.com/jonahss'
id 'jonahss'
};
developer {
name 'Sergey Tikhomirov'
email '[email protected]'
url 'https://github.com/TikhomirovSergey'
id 'TikhomirovSergey'
};
developer {
name 'Srinivasan Sekar'
email '[email protected]'
url 'https://github.com/SrinivasanTarget'
id 'SrinivasanTarget'
};
}
licenses {
license {
name 'Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/appium/java-client'
connection 'scm:git:ssh://[email protected]/appium/java-client.git'
developerConnection 'scm:git:ssh://[email protected]/appium/java-client.git'
tag 'HEAD'
}
}
task javadocJar(type: Jar) {
classifier = 'javadoc'
from javadoc
}

task sourcesJar(type: Jar) {
classifier = 'sources'
from sourceSets.main.allSource
}

artifacts {
archives javadocJar, sourcesJar
}

signing {
sign configurations.archives
}

uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

repository(url: "https://oss.sonatype.org/service/local/staging/deploy/maven2/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
from components.java
artifact sourceJar {
classifier 'sources'

snapshotRepository(url: "https://oss.sonatype.org/content/repositories/snapshots/") {
authentication(userName: ossrhUsername, password: ossrhPassword)
}
artifact javadocJar {
classifier 'javadoc'

pom.project {
packaging 'jar'
name 'java-client'
description 'Java client for Appium Mobile Webdriver'
url 'http://appium.io'
developers {
developer {
name 'Jonah Stiennon'
email '[email protected]'
url 'https://github.com/jonahss'
id 'jonahss'
};
developer {
name 'Sergey Tikhomirov'
email '[email protected]'
url 'https://github.com/TikhomirovSergey'
id 'TikhomirovSergey'
};
developer {
name 'Srinivasan Sekar'
email '[email protected]'
url 'https://github.com/SrinivasanTarget'
id 'SrinivasanTarget'
};
}
licenses {
license {
name 'Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
distribution 'repo'
}
}
scm {
url 'https://github.com/appium/java-client'
connection 'scm:git:ssh://[email protected]/appium/java-client.git'
developerConnection 'scm:git:ssh://[email protected]/appium/java-client.git'
tag 'HEAD'
}
}
}
}
}

task sourceJar(type: Jar) {
from sourceSets.main.java
}

task javadocJar (type: Jar, dependsOn: javadoc) {
from javadoc
}

task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
description 'Generates the Gradle wrapper scripts.'
}

test {
useJUnit()
}
}
2 changes: 1 addition & 1 deletion google-style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="5"/>
<property name="allowedAbbreviationLength" value="8"/>
</module>
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
Expand Down
7 changes: 7 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
org.gradle.daemon=true

signing.keyId=YourKeyId
signing.password=YourPublicKeyPassword
signing.secretKeyRingFile=PathToYourKeyRingFile

ossrhUsername=your-jira-id
ossrhPassword=your-jira-password
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@

package io.appium.java_client;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;

import java.util.List;

public interface FindsByAccessibilityId<T extends WebElement> extends FindsByFluentSelector<T> {
/**
* @throws {@link org.openqa.selenium.WebDriverException} This method is not
* applicable with browser/webview UI.
* @throws {@link org.openqa.selenium.NoSuchElementException} when no one element is found
* @throws WebDriverException This method is not applicable with browser/webview UI.
* @throws NoSuchElementException when no one element is found
*/
default T findElementByAccessibilityId(String using) {
return findElement(MobileSelector.ACCESSIBILITY.toString(), using);
}

/**
* @throws {@link org.openqa.selenium.WebDriverException} This method is not
* applicable with browser/webview UI.
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
default List<T> findElementsByAccessibilityId(String using) {
return findElements(MobileSelector.ACCESSIBILITY.toString(), using);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,24 @@

package io.appium.java_client;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;

import java.util.List;

public interface FindsByAndroidUIAutomator<T extends WebElement> extends FindsByFluentSelector<T> {

/**
* @throws {@link org.openqa.selenium.WebDriverException} This method is not
* applicable with browser/webview UI.
* @throws {@link org.openqa.selenium.NoSuchElementException} when no one element is found
* @throws WebDriverException This method is not applicable with browser/webview UI.
* @throws NoSuchElementException when no one element is found
*/
default T findElementByAndroidUIAutomator(String using) {
return findElement(MobileSelector.ANDROID_UI_AUTOMATOR.toString(), using);
}

/**
* @throws {@link org.openqa.selenium.WebDriverException} This method is not
* applicable with browser/webview UI.
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
default List<T> findElementsByAndroidUIAutomator(String using) {
return findElements(MobileSelector.ANDROID_UI_AUTOMATOR.toString(), using);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@

package io.appium.java_client;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;

import java.util.List;

public interface FindsByIosUIAutomation<T extends WebElement> extends FindsByFluentSelector<T> {
/**
* @throws {@link org.openqa.selenium.WebDriverException}
* This method is not applicable with browser/webview UI.
* @throws {@link org.openqa.selenium.NoSuchElementException} when no one element is found
* @throws WebDriverException This method is not applicable with browser/webview UI.
* @throws NoSuchElementException when no one element is found
*/
default T findElementByIosUIAutomation(String using) {
return findElement(MobileSelector.IOS_UI_AUTOMATION.toString(), using);
}

/**
* @throws {@link org.openqa.selenium.WebDriverException}
* This method is not applicable with browser/webview UI.
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
default List<T> findElementsByIosUIAutomation(String using) {
return findElements(MobileSelector.IOS_UI_AUTOMATION.toString(), using);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

package io.appium.java_client;

import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriverException;
import org.openqa.selenium.WebElement;

import java.util.List;
Expand All @@ -28,9 +30,8 @@ public interface FindsByWindowsAutomation<T extends WebElement> extends FindsByF
*
* @param selector a Windows UIAutomation selector
* @return The first element that matches the given selector
* @throws {@link org.openqa.selenium.WebDriverException} This method is not
* applicable with browser/webview UI.
* @throws {@link org.openqa.selenium.NoSuchElementException} when no one element is found
* @throws WebDriverException This method is not applicable with browser/webview UI.
* @throws NoSuchElementException when no one element is found
*/
default T findElementByWindowsUIAutomation(String selector) {
return findElement(MobileSelector.WINDOWS_UI_AUTOMATION.toString(), selector);
Expand All @@ -41,8 +42,7 @@ default T findElementByWindowsUIAutomation(String selector) {
*
* @param selector a Windows UIAutomation selector
* @return a list of elements that match the given selector
* @throws {@link org.openqa.selenium.WebDriverException} This method is not
* applicable with browser/webview UI.
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
default List<T> findElementsByWindowsUIAutomation(String selector) {
return findElements(MobileSelector.WINDOWS_UI_AUTOMATION.toString(), selector);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import static io.appium.java_client.pagefactory.utils.WebDriverUnpackUtility
.unpackWebDriverFromSearchContext;

import com.google.common.collect.ImmutableList;

import io.appium.java_client.HasSessionDetails;
import io.appium.java_client.MobileElement;
import io.appium.java_client.TouchableElement;
Expand Down Expand Up @@ -58,22 +60,9 @@
*/
public class AppiumFieldDecorator implements FieldDecorator {

private static final List<Class<? extends WebElement>> availableElementClasses =
new ArrayList<Class<? extends WebElement>>() {
private static final long serialVersionUID = 1L;

{
add(WebElement.class);
add(RemoteWebElement.class);
add(MobileElement.class);
add(TouchableElement.class);
add(AndroidElement.class);
add(IOSElement.class);
add(WindowsElement.class);
}

};

private static final List<Class<? extends WebElement>> availableElementClasses = ImmutableList.of(WebElement.class,
RemoteWebElement.class, MobileElement.class, TouchableElement.class, AndroidElement.class,
IOSElement.class, WindowsElement.class);
public static long DEFAULT_IMPLICITLY_WAIT_TIMEOUT = 1;
public static TimeUnit DEFAULT_TIMEUNIT = TimeUnit.SECONDS;
private final WebDriver originalDriver;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ private static By buildMobileBy(LocatorGroupStrategy locatorGroupStrategy, Annot
}
}

if (isIOSXcuit()) {
iOSXCUITFindBy[] xCuitFindByArray = annotatedElement.getAnnotationsByType(iOSXCUITFindBy.class);
if (xCuitFindByArray != null && xCuitFindByArray.length > 0) {
return buildMobileBy(howToUseLocators != null ? howToUseLocators.iOSXCUITAutomation() : null,
xCuitFindByArray);
}
}

if (isIOS()) {
iOSFindBy[] iOSFindByArray = annotatedElement.getAnnotationsByType(iOSFindBy.class);
//should be kept for some time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,11 @@
* or the searching by all possible locators.
*/
LocatorGroupStrategy windowsAutomation() default LocatorGroupStrategy.CHAIN;

/**
* @return the strategy which defines how to use locators which are described by
* the {@link iOSXCUITFindBy} annotation. These annotations can define the chained searching
* or the searching by all possible locators.
*/
LocatorGroupStrategy iOSXCUITAutomation() default LocatorGroupStrategy.CHAIN;
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.appium.java_client.pagefactory.bys.builder;

import static io.appium.java_client.remote.AutomationName.IOS_XCUI_TEST;
import static io.appium.java_client.remote.AutomationName.SELENDROID;
import static io.appium.java_client.remote.MobilePlatform.ANDROID;
import static io.appium.java_client.remote.MobilePlatform.IOS;
Expand Down Expand Up @@ -180,6 +181,10 @@ protected boolean isIOS() {
return IOS.equalsIgnoreCase(platform);
}

protected boolean isIOSXcuit() {
return isIOS() && IOS_XCUI_TEST.equalsIgnoreCase(automation);
}

protected boolean isWindows() {
return WINDOWS.equalsIgnoreCase(platform);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ enum Strategies {
return MobileBy
.windowsAutomation(getValue(annotation, this));
}
},
BY_NS_PREDICATE("iOSNsPredicate") {
@Override By getBy(Annotation annotation) {
return MobileBy
.iOSNsPredicateString(getValue(annotation, this));
}
};

private final String valueName;
Expand Down
Loading