Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 3 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,12 @@ tasks.withType(JacocoReport) {
jacocoTestReport.dependsOn test

checkstyle {
toolVersion = '7.0'
toolVersion = '8.7'
configFile = file("$projectDir/google-style.xml")
showViolations = true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

}

dependencies {
checkstyle( 'com.puppycrawl.tools:checkstyle:7.0' )
}

tasks.withType(Checkstyle) {
ignoreFailures = false
configFile = file("$projectDir/google-style.xml")
exclude '**/org/openqa/selenium/**'
}
checkstyleMain.excludes = ['**/org/openqa/selenium/**']

task javadocJar(type: Jar) {
classifier = 'javadoc'
Expand Down
33 changes: 15 additions & 18 deletions google-style.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://www.puppycrawl.com/dtds/configuration_1_3.dtd">
"-//Puppy Crawl//DTD Check Configuration 1.3//EN"
"http://checkstyle.sourceforge.net/dtds/configuration_1_3.dtd">

<!-- Originally designed by:-->
<!--
Expand Down Expand Up @@ -46,19 +46,16 @@
<property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
</module>
<module name="AvoidStarImport">
<property name="severity" value="warning"/>
</module>
<property name="severity" value="warning"/>
</module>
<module name="OneTopLevelClass"/>
<module name="NoLineWrap"/>
<module name="EmptyBlock">
<property name="option" value="TEXT"/>
<property name="tokens" value="LITERAL_TRY, LITERAL_FINALLY, LITERAL_IF, LITERAL_ELSE, LITERAL_SWITCH"/>
</module>
<module name="NeedBraces"/>
<module name="LeftCurly">
<property name="maxLineLength" value="100"/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was it intentionally removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, it was deprecated for a long time and finally it was removed in Checkstyle 8.2: checkstyle/checkstyle#3671

</module>
<module name="RightCurly"/>
<module name="LeftCurly" />
<module name="RightCurly">
<property name="option" value="alone"/>
<property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO, STATIC_INIT, INSTANCE_INIT"/>
Expand Down Expand Up @@ -97,7 +94,7 @@
value="Package name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="TypeName">
<property name="format" value="^([*iOSFindBy*]||[*iOSXCUITFind*])||([A-Z][a-zA-Z0-9])*$"/>
<property name="format" value="^([*iOSFindBy*]||[*iOSXCUITFind*])||([A-Z][a-zA-Z0-9])*$"/>
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
Expand Down Expand Up @@ -166,7 +163,7 @@
<property name="specialImportsRegExp" value="com.google"/>
<property name="sortImportsInGroupAlphabetically" value="true"/>
<property name="customImportOrderRules" value="STATIC###SPECIAL_IMPORTS###THIRD_PARTY_PACKAGE###STANDARD_JAVA_PACKAGE"/>
<property name="severity" value="warning"/>
<property name="severity" value="warning"/>
</module>
<module name="MethodParamPad"/>
<module name="OperatorWrap">
Expand All @@ -182,19 +179,19 @@
</module>
<module name="NonEmptyAtclauseDescription"/>
<module name="JavadocTagContinuationIndentation">
<property name="severity" value="warning"/>
</module>
<property name="severity" value="warning"/>
</module>
<module name="SummaryJavadoc">
<property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/>
<property name="severity" value="warning"/>
<property name="severity" value="warning"/>
</module>
<module name="JavadocParagraph">
<property name="severity" value="warning"/>
</module>
<property name="severity" value="warning"/>
</module>
<module name="AtclauseOrder">
<property name="tagOrder" value="@param, @return, @throws, @deprecated"/>
<property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/>
<property name="severity" value="warning"/>
<property name="severity" value="warning"/>
</module>
<module name="JavadocMethod">
<property name="scope" value="public"/>
Expand All @@ -215,8 +212,8 @@
</module>
<module name="EmptyCatchBlock">
<property name="exceptionVariableName" value="expected"/>

</module>
<module name="CommentsIndentation"/>
</module>
</module>
</module>
21 changes: 12 additions & 9 deletions src/main/java/io/appium/java_client/AppiumDriver.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,14 @@
import java.util.Set;

/**
* @param <T> the required type of class which implement {@link org.openqa.selenium.WebElement}.
* Default Appium driver implementation.
*
* @param <T> the required type of class which implement {@link WebElement}.
* Instances of the defined type will be returned via findElement* and findElements*
* Warning (!!!). Allowed types:
* {@link org.openqa.selenium.WebElement}
* {@link org.openqa.selenium.remote.RemoteWebElement}
* {@link io.appium.java_client.MobileElement} and its subclasses that designed
* specifically
* for each target mobile OS (still Android and iOS)
* {@link WebElement}, {@link org.openqa.selenium.remote.RemoteWebElement},
* {@link MobileElement} and its subclasses that designed
* specifically for each target mobile OS (still Android and iOS)
*/
@SuppressWarnings("unchecked")
public class AppiumDriver<T extends WebElement>
Expand All @@ -73,11 +73,12 @@ public class AppiumDriver<T extends WebElement>
private ExecuteMethod executeMethod;

/**
* @param executor is an instance of {@link org.openqa.selenium.remote.HttpCommandExecutor}
* Creates a new instance based on command {@code executor} and {@code capabilities}.
*
* @param executor is an instance of {@link HttpCommandExecutor}
* or class that extends it. Default commands or another vendor-specific
* commands may be specified there.
* @param capabilities take a look
* at {@link org.openqa.selenium.Capabilities}
* @param capabilities take a look at {@link Capabilities}
*/
public AppiumDriver(HttpCommandExecutor executor, Capabilities capabilities) {
super(executor, capabilities);
Expand Down Expand Up @@ -129,6 +130,8 @@ public AppiumDriver(Capabilities desiredCapabilities) {
}

/**
* Changes platform name and returns new capabilities.
*
* @param originalCapabilities the given {@link Capabilities}.
* @param newPlatform a {@link MobileCapabilityType#PLATFORM_NAME} value which has
* to be set up
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/io/appium/java_client/AppiumFluentWait.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,17 @@ public Duration getInterval() {
}

/**
* The input value to pass to the evaluated conditions.
*
* @param input The input value to pass to the evaluated conditions.
*/
public AppiumFluentWait(T input) {
super(input);
}

/**
* Creates wait object based on {@code input} value, {@code clock} and {@code sleeper}.
*
* @param input The input value to pass to the evaluated conditions.
* @param clock The clock to use when measuring the timeout.
* @param sleeper Used to put the thread to sleep between evaluation loops.
Expand Down Expand Up @@ -211,10 +215,9 @@ public AppiumFluentWait<T> withPollingStrategy(Function<IterationInfo, Duration>
* <ol>
* <li>the function returns neither null nor false,</li>
* <li>the function throws an unignored exception,</li>
* <li>the timeout expires,
* <li>
* <li>the timeout expires,</li>
* <li>the current thread is interrupted</li>
* </ol>
* </ol>.
*
* @param isTrue the parameter to pass to the expected condition
* @param <V> The function's expected return type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,27 +71,35 @@ public DefaultGenericMobileDriver(CommandExecutor executor, Capabilities desired
}

/**
* @throws WebDriverException his method doesn't work against native app UI.
* Finds a single element by link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public T findElementByLinkText(String using) throws WebDriverException {
return (T) super.findElementByLinkText(using);
}

/**
* Finds many elements by link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public List findElementsByLinkText(String using) throws WebDriverException {
return super.findElementsByLinkText(using);
}

/**
* @throws WebDriverException his method doesn't work against native app UI.
* Finds a single element by partial link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public T findElementByPartialLinkText(String using) throws WebDriverException {
return (T) super.findElementByPartialLinkText(using);
}

/**
* Finds many elements by partial link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public List findElementsByPartialLinkText(String using) throws WebDriverException {
Expand Down Expand Up @@ -123,13 +131,17 @@ public List findElementsByClassName(String using) {
}

/**
* @throws WebDriverException his method doesn't work against native app UI.
* Finds a single element by CSS selector.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public T findElementByCssSelector(String using) throws WebDriverException {
return (T) super.findElementByCssSelector(using);
}

/**
* Finds many elements by CSS selector.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public List findElementsByCssSelector(String using) throws WebDriverException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,27 +74,35 @@ abstract class DefaultGenericMobileElement<T extends WebElement> extends RemoteW
}

/**
* @throws WebDriverException his method doesn't work against native app UI.
* Finds a single element by link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public T findElementByLinkText(String using) throws WebDriverException {
return (T) super.findElementByLinkText(using);
}

/**
* Finds many elements by link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public List findElementsByLinkText(String using) throws WebDriverException {
return super.findElementsByLinkText(using);
}

/**
* @throws WebDriverException his method doesn't work against native app UI.
* Finds a single element by partial link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public T findElementByPartialLinkText(String using) throws WebDriverException {
return (T) super.findElementByPartialLinkText(using);
}

/**
* Finds many elements by partial link text.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public List findElementsByPartialLinkText(String using) throws WebDriverException {
Expand Down Expand Up @@ -126,13 +134,17 @@ public List findElementsByClassName(String using) {
}

/**
* @throws WebDriverException his method doesn't work against native app UI.
* Finds a single element by CSS selector.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public T findElementByCssSelector(String using) throws WebDriverException {
return (T) super.findElementByCssSelector(using);
}

/**
* Finds many elements by CSS selector.
*
* @throws WebDriverException This method doesn't work against native app UI.
*/
public List findElementsByCssSelector(String using) throws WebDriverException {
Expand All @@ -148,13 +160,17 @@ public List findElementsByXPath(String using) {
}

/**
* {@inheritDoc}
*
* @throws WebDriverException because it may not work against native app UI.
*/
public void submit() throws WebDriverException {
super.submit();
}

/**
* {@inheritDoc}
*
* @throws WebDriverException because it may not work against native app UI.
*/
public String getCssValue(String propertyName) throws WebDriverException {
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/io/appium/java_client/ErrorCodesMobile.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ public Class<? extends WebDriverException> getExceptionType(int statusCode) {
}

/**
* Returns the exception type that corresponds to the given {@code message}or {@code null} if
* there are no matching mobile exceptions.
*
* @param message message An error message returned by Appium server
* @return The exception type that corresponds to the provided error message or {@code null} if
* there are no matching mobile exceptions.
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/io/appium/java_client/FindsByAccessibilityId.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@

public interface FindsByAccessibilityId<T extends WebElement> extends FindsByFluentSelector<T> {
/**
* Method performs the searching for a single element by accessibility ID selector
* and value of the given selector.
*
* @param using an accessibility ID selector
* @return The first element that matches the given selector
*
* @throws WebDriverException This method is not applicable with browser/webview UI.
* @throws NoSuchElementException when no one element is found
*/
Expand All @@ -32,6 +38,12 @@ default T findElementByAccessibilityId(String using) {
}

/**
* Method performs the searching for a list of elements by accessibility ID selector
* and value of the given selector.
*
* @param using an accessibility ID selector
* @return a list of elements that match the given selector
*
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
default List<T> findElementsByAccessibilityId(String using) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
public interface FindsByAndroidUIAutomator<T extends WebElement> extends FindsByFluentSelector<T> {

/**
* Method performs the searching for a single element by Android UIAutomator selector
* and value of the given selector.
*
* @param using an Android UIAutomator selector
* @return The first element that matches the given selector
*
* @throws WebDriverException This method is not applicable with browser/webview UI.
* @throws NoSuchElementException when no one element is found
*/
Expand All @@ -33,6 +39,12 @@ default T findElementByAndroidUIAutomator(String using) {
}

/**
* Method performs the searching for a list of elements by Android UIAutomator selector
* and value of the given selector.
*
* @param using an Android UIAutomator selector
* @return a list of elements that match the given selector
*
* @throws WebDriverException This method is not applicable with browser/webview UI.
*/
default List<T> findElementsByAndroidUIAutomator(String using) {
Expand Down
Loading