-
-
Notifications
You must be signed in to change notification settings - Fork 764
The addition to #738 #741
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
TikhomirovSergey
merged 5 commits into
appium:master
from
TikhomirovSergey:titusfortner-explicit
Oct 2, 2017
Merged
The addition to #738 #741
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a6df515
rename DEFAULT_IMPLICITLY_WAIT_TIMEOUT to DEFAULT_TIMEOUT
titusfortner a971cc8
do not zero out implicit wait during location call
titusfortner 7307777
The addition to #738
TikhomirovSergey 938ec64
Code style issues which were found by reviewer were fixed
TikhomirovSergey 2419dca
Code style issues which were found by reviewer were fixed
TikhomirovSergey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,20 +62,20 @@ public class AppiumFieldDecorator implements FieldDecorator { | |
private static final List<Class<? extends WebElement>> availableElementClasses = ImmutableList.of(WebElement.class, | ||
RemoteWebElement.class, MobileElement.class, AndroidElement.class, | ||
IOSElement.class, WindowsElement.class); | ||
public static long DEFAULT_IMPLICITLY_WAIT_TIMEOUT = 1; | ||
public static long DEFAULT_TIMEOUT = 1; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can deprecate the constant of TimeUnit type if we use Duration type for DEFAULT_TIMEOUT |
||
public static TimeUnit DEFAULT_TIMEUNIT = TimeUnit.SECONDS; | ||
private final WebDriver originalDriver; | ||
private final DefaultFieldDecorator defaultElementFieldDecoracor; | ||
private final AppiumElementLocatorFactory widgetLocatorFactory; | ||
private final String platform; | ||
private final String automation; | ||
private final TimeOutDuration timeOutDuration; | ||
private final TimeOutDuration duration; | ||
private final HasSessionDetails hasSessionDetails; | ||
|
||
|
||
public AppiumFieldDecorator(SearchContext context, long implicitlyWaitTimeOut, | ||
public AppiumFieldDecorator(SearchContext context, long timeout, | ||
TimeUnit timeUnit) { | ||
this(context, new TimeOutDuration(implicitlyWaitTimeOut, timeUnit)); | ||
this(context, new TimeOutDuration(timeout, timeUnit)); | ||
} | ||
|
||
/** | ||
|
@@ -84,9 +84,9 @@ public AppiumFieldDecorator(SearchContext context, long implicitlyWaitTimeOut, | |
* or {@link org.openqa.selenium.WebElement} or | ||
* {@link io.appium.java_client.pagefactory.Widget} or some other user's | ||
* extension/implementation. | ||
* @param timeOutDuration is a desired duration of the waiting for an element presence. | ||
* @param duration is a desired duration of the waiting for an element presence. | ||
*/ | ||
public AppiumFieldDecorator(SearchContext context, TimeOutDuration timeOutDuration) { | ||
public AppiumFieldDecorator(SearchContext context, TimeOutDuration duration) { | ||
this.originalDriver = unpackWebDriverFromSearchContext(context); | ||
if (originalDriver == null | ||
|| !HasSessionDetails.class.isAssignableFrom(originalDriver.getClass())) { | ||
|
@@ -99,10 +99,10 @@ public AppiumFieldDecorator(SearchContext context, TimeOutDuration timeOutDurati | |
automation = hasSessionDetails.getAutomationName(); | ||
} | ||
|
||
this.timeOutDuration = timeOutDuration; | ||
this.duration = duration; | ||
|
||
defaultElementFieldDecoracor = new DefaultFieldDecorator( | ||
new AppiumElementLocatorFactory(context, timeOutDuration, originalDriver, | ||
new AppiumElementLocatorFactory(context, duration, | ||
new DefaultElementByBuilder(platform, automation))) { | ||
@Override | ||
protected WebElement proxyForLocator(ClassLoader ignored, ElementLocator locator) { | ||
|
@@ -139,12 +139,11 @@ protected List<WebElement> proxyForListLocator(ClassLoader ignored, | |
}; | ||
|
||
widgetLocatorFactory = | ||
new AppiumElementLocatorFactory(context, timeOutDuration, originalDriver, | ||
new WidgetByBuilder(platform, automation)); | ||
new AppiumElementLocatorFactory(context, duration, new WidgetByBuilder(platform, automation)); | ||
} | ||
|
||
public AppiumFieldDecorator(SearchContext context) { | ||
this(context, DEFAULT_IMPLICITLY_WAIT_TIMEOUT, DEFAULT_TIMEUNIT); | ||
this(context, DEFAULT_TIMEOUT, DEFAULT_TIMEUNIT); | ||
} | ||
|
||
/** | ||
|
@@ -204,14 +203,14 @@ private Object decorateWidget(Field field) { | |
if (isAlist) { | ||
return getEnhancedProxy(ArrayList.class, | ||
new WidgetListInterceptor(locator, originalDriver, map, widgetType, | ||
timeOutDuration)); | ||
duration)); | ||
} | ||
|
||
Constructor<? extends Widget> constructor = | ||
WidgetConstructorUtil.findConvenientConstructor(widgetType); | ||
return getEnhancedProxy(widgetType, new Class[] {constructor.getParameterTypes()[0]}, | ||
new Object[] {proxyForAnElement(locator)}, | ||
new WidgetInterceptor(locator, originalDriver, null, map, timeOutDuration)); | ||
new WidgetInterceptor(locator, originalDriver, null, map, duration)); | ||
} | ||
|
||
private WebElement proxyForAnElement(ElementLocator locator) { | ||
|
30 changes: 30 additions & 0 deletions
30
src/test/java/io/appium/java_client/ChromeDriverPathUtil.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package io.appium.java_client; | ||
|
||
import static java.nio.file.FileSystems.getDefault; | ||
import static org.openqa.selenium.Platform.MAC; | ||
import static org.openqa.selenium.Platform.WINDOWS; | ||
import static org.openqa.selenium.Platform.getCurrent; | ||
|
||
import org.openqa.selenium.Platform; | ||
|
||
import java.io.File; | ||
import java.nio.file.Path; | ||
|
||
public final class ChromeDriverPathUtil { | ||
private static final Path ROOT_TEST_PATH = getDefault().getPath("src") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ❤️ |
||
.resolve("test").resolve("java").resolve("io").resolve("appium").resolve("java_client"); | ||
|
||
/** | ||
* @return the choromedriver file which depends on platform. | ||
*/ | ||
public static File getChromeDriver() { | ||
Platform current = getCurrent(); | ||
if (current.is(WINDOWS)) { | ||
return ROOT_TEST_PATH.resolve("chromedriver.exe").toFile(); | ||
} else if (current.is(MAC)) { | ||
return ROOT_TEST_PATH.resolve("chromedriver_mac").toFile(); | ||
} | ||
|
||
return ROOT_TEST_PATH.resolve("chromedriver_linux").toFile(); | ||
} | ||
} |
Binary file not shown.
Binary file renamed
BIN
+10.3 MB
...ava_client/pagefactory_tests/chromedriver → ...va/io/appium/java_client/chromedriver_mac
100755 → 100644
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The method can be marked as Nullable