Add the missing Android and iOS settings by mykola-mokhnach · Pull Request #1120 · appium/java-client · GitHub
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
20 changes: 16 additions & 4 deletions src/main/java/io/appium/java_client/Setting.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,59 +30,71 @@ interface HasAndroidSettings extends HasSettings {
* by the system), in an attempt to make things less confusing or faster.
*
* @param compress ignores unimportant views if true, doesn't ignore otherwise.
* @return self instance for chaining
*/
default void ignoreUnimportantViews(Boolean compress) {
default HasAndroidSettings ignoreUnimportantViews(Boolean compress) {
setSetting(Setting.IGNORE_UNIMPORTANT_VIEWS, compress);
return this;
}

/**
* invoke {@code setWaitForIdleTimeout} in {@code com.android.uiautomator.core.Configurator}.
*
* @param timeout A negative value would reset to its default value. Minimum time unit
* resolution is one millisecond
* @return self instance for chaining
*/
default void configuratorSetWaitForIdleTimeout(Duration timeout) {
default HasAndroidSettings configuratorSetWaitForIdleTimeout(Duration timeout) {
setSetting(Setting.WAIT_FOR_IDLE_TIMEOUT, timeout.toMillis());
return this;
}

/**
* invoke {@code setWaitForSelectorTimeout} in {@code com.android.uiautomator.core.Configurator}.
*
* @param timeout A negative value would reset to its default value. Minimum time unit
* resolution is one millisecond
* @return self instance for chaining
*/
default void configuratorSetWaitForSelectorTimeout(Duration timeout) {
default HasAndroidSettings configuratorSetWaitForSelectorTimeout(Duration timeout) {
setSetting(Setting.WAIT_FOR_SELECTOR_TIMEOUT, timeout.toMillis());
return this;
}

/**
* invoke {@code setScrollAcknowledgmentTimeout} in {@code com.android.uiautomator.core.Configurator}.
*
* @param timeout A negative value would reset to its default value. Minimum time unit
* resolution is one millisecond
* @return self instance for chaining
*/
default void configuratorSetScrollAcknowledgmentTimeout(Duration timeout) {
default HasAndroidSettings configuratorSetScrollAcknowledgmentTimeout(Duration timeout) {
setSetting(Setting.WAIT_SCROLL_ACKNOWLEDGMENT_TIMEOUT, timeout.toMillis());
return this;
}

/**
* invoke {@code configuratorSetKeyInjectionDelay} in {@code com.android.uiautomator.core.Configurator}.
*
* @param delay A negative value would reset to its default value. Minimum time unit
* resolution is one millisecond
* @return self instance for chaining
*/
default void configuratorSetKeyInjectionDelay(Duration delay) {
default HasAndroidSettings configuratorSetKeyInjectionDelay(Duration delay) {
setSetting(Setting.KEY_INJECTION_DELAY, delay.toMillis());
return this;
}

/**
* invoke {@code setActionAcknowledgmentTimeout} in {@code com.android.uiautomator.core.Configurator}.
*
* @param timeout A negative value would reset to its default value. Minimum time unit
* resolution is one millisecond
* @return self instance for chaining
*/
default void configuratorSetActionAcknowledgmentTimeout(Duration timeout) {
default HasAndroidSettings configuratorSetActionAcknowledgmentTimeout(Duration timeout) {
setSetting(Setting.WAIT_ACTION_ACKNOWLEDGMENT_TIMEOUT, timeout.toMillis());
return this;
}

/**
Expand All @@ -93,10 +105,64 @@ default void configuratorSetActionAcknowledgmentTimeout(Duration timeout) {
* XML parsing exceptions caused by XPath lookup.
* The Unicode to ASCII transliteration is based on
* JUnidecode library (https://github.com/gcardone/junidecode).
* Works for UIAutomator2 only.
*
* @param enabled Either true or false. The default value if false.
* @return self instance for chaining
*/
default void normalizeTagNames(boolean enabled) {
default HasAndroidSettings normalizeTagNames(boolean enabled) {
setSetting(Setting.NORMALIZE_TAG_NAMES, enabled);
return this;
}

/**
* Whether to return compact (standards-compliant) and faster responses in find element/s
* (the default setting). If set to false then the response may also contain other
* available element attributes.
*
* @param enabled Either true or false. The default value if true.
* @return self instance for chaining
*/
default HasAndroidSettings setShouldUseCompactResponses(boolean enabled) {
setSetting(Setting.SHOULD_USE_COMPACT_RESPONSES, enabled);
return this;
}

/**
* Which attributes should be returned if compact responses are disabled.
* It works only if shouldUseCompactResponses is false. Defaults to "type,label" string.
*
* @param attrNames The comma-separated list of fields to return with each element.
* @return self instance for chaining
*/
default HasAndroidSettings setElementResponseAttributes(String attrNames) {
setSetting(Setting.ELEMENT_RESPONSE_ATTRIBUTES, attrNames);
return this;
}

/**
* Set whether the source output/xpath search should consider all elements, visible and invisible.
* Disabling this setting speeds up source and xml search. Works for UIAutomator2 only.
*
* @param enabled Either true or false. The default value if false.
* @return self instance for chaining
*/
default HasAndroidSettings allowInvisibleElements(boolean enabled) {
setSetting(Setting.ALLOW_INVISIBLE_ELEMENTS, enabled);
return this;
}

/**
* Whether to enable or disable the notification listener.
* No toast notifications are going to be added into page source output if
* this setting is disabled.
* Works for UIAutomator2 only.
*
* @param enabled Either true or false. The default value if true.
* @return self instance for chaining
*/
default HasAndroidSettings enableNotificationListener(boolean enabled) {
setSetting(Setting.ENABLE_NOTIFICATION_LISTENER, enabled);
return this;
}
}
71 changes: 69 additions & 2 deletions src/main/java/io/appium/java_client/ios/HasIOSSettings.java