-
-
Notifications
You must be signed in to change notification settings - Fork 768
chore: Start adding XCUITest driver options #1551
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
Merged
mykola-mokhnach
merged 1 commit into
appium:master
from
mykola-mokhnach:xcuitest_options
Oct 26, 2021
Merged
Changes from all commits
Commits
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
58 changes: 58 additions & 0 deletions
58
src/main/java/io/appium/java_client/ios/options/app/SupportsAppInstallStrategyOption.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,58 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.ios.options.app; | ||
|
||
import io.appium.java_client.remote.options.BaseOptions; | ||
import io.appium.java_client.remote.options.CanSetCapability; | ||
import org.openqa.selenium.Capabilities; | ||
|
||
import java.util.Optional; | ||
|
||
public interface SupportsAppInstallStrategyOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String APP_INSTALL_STRATEGY_OPTION = "appInstallStrategy"; | ||
|
||
/** | ||
* Select application installation strategy for real devices. The following | ||
* strategies are supported: | ||
* | ||
* serial (default) - pushes app files to the device in a sequential order; | ||
* this is the least performant strategy, although the most reliable; | ||
* | ||
* parallel - pushes app files simultaneously; this is usually the | ||
* most performant strategy, but sometimes could not be very stable; | ||
* | ||
* ios-deploy - tells the driver to use a third-party tool ios-deploy to | ||
* install the app; obviously the tool must be installed separately | ||
* first and must be present in PATH before it could be used. | ||
* | ||
* @param strategy App installation strategy. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setAppInstallStrategy(String strategy) { | ||
return amend(APP_INSTALL_STRATEGY_OPTION, strategy); | ||
} | ||
|
||
/** | ||
* Get the app install strategy. | ||
* | ||
* @return App installation strategy. | ||
*/ | ||
default Optional<String> getAppInstallStrategy() { | ||
return Optional.ofNullable((String) getCapability(APP_INSTALL_STRATEGY_OPTION)); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
src/main/java/io/appium/java_client/ios/options/app/SupportsAppPushTimeoutOption.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,52 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.ios.options.app; | ||
|
||
import io.appium.java_client.internal.CapabilityHelpers; | ||
import io.appium.java_client.remote.options.BaseOptions; | ||
import io.appium.java_client.remote.options.CanSetCapability; | ||
import org.openqa.selenium.Capabilities; | ||
|
||
import java.time.Duration; | ||
import java.util.Optional; | ||
|
||
public interface SupportsAppPushTimeoutOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String APP_PUSH_TIMEOUT_OPTION = "appPushTimeout"; | ||
|
||
/** | ||
* The timeout for application upload. | ||
* Works for real devices only. The default value is 30000ms. | ||
* | ||
* @param timeout App push timeout. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setAppPushTimeout(Duration timeout) { | ||
return amend(APP_PUSH_TIMEOUT_OPTION, timeout.toMillis()); | ||
} | ||
|
||
/** | ||
* Get maximum timeout for application upload. | ||
* | ||
* @return Timeout value. | ||
*/ | ||
default Optional<Duration> getAppPushTimeout() { | ||
return Optional.ofNullable( | ||
CapabilityHelpers.toDuration(getCapability(APP_PUSH_TIMEOUT_OPTION)) | ||
); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/io/appium/java_client/ios/options/app/SupportsBundleIdOption.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,50 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.ios.options.app; | ||
|
||
import io.appium.java_client.remote.options.BaseOptions; | ||
import io.appium.java_client.remote.options.CanSetCapability; | ||
import org.openqa.selenium.Capabilities; | ||
|
||
import java.util.Optional; | ||
|
||
public interface SupportsBundleIdOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String BUNDLE_ID_OPTION = "bundleId"; | ||
|
||
/** | ||
* Bundle identifier of the app under test, for example com.mycompany.myapp. | ||
* The capability value is calculated automatically if app is provided. | ||
* If neither app nor bundleId capability is provided then XCUITest driver | ||
* starts from the Home screen. | ||
* | ||
* @param identifier App identifier. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setBundleId(String identifier) { | ||
return amend(BUNDLE_ID_OPTION, identifier); | ||
} | ||
|
||
/** | ||
* Get the app bundle identifier. | ||
* | ||
* @return Identifier value. | ||
*/ | ||
default Optional<String> getBundleId() { | ||
return Optional.ofNullable((String) getCapability(BUNDLE_ID_OPTION)); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/appium/java_client/ios/options/app/SupportsLocalizableStringsDirOption.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,48 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.ios.options.app; | ||
|
||
import io.appium.java_client.remote.options.BaseOptions; | ||
import io.appium.java_client.remote.options.CanSetCapability; | ||
import org.openqa.selenium.Capabilities; | ||
|
||
import java.util.Optional; | ||
|
||
public interface SupportsLocalizableStringsDirOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String LOCALIZABLE_STRINGS_DIR_OPTION = "localizableStringsDir"; | ||
|
||
/** | ||
* Where to look for localizable strings in the application bundle. | ||
* Defaults to en.lproj. | ||
* | ||
* @param folder The resource folder name where the main locale strings are stored. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setLocalizableStringsDir(String folder) { | ||
return amend(LOCALIZABLE_STRINGS_DIR_OPTION, folder); | ||
} | ||
|
||
/** | ||
* Get the resource folder name where the main locale strings are stored. | ||
* | ||
* @return Folder name. | ||
*/ | ||
default Optional<String> getLocalizableStringsDir() { | ||
return Optional.ofNullable((String) getCapability(LOCALIZABLE_STRINGS_DIR_OPTION)); | ||
} | ||
} |
52 changes: 52 additions & 0 deletions
52
.../appium/java_client/ios/options/general/SupportsIncludeDeviceCapsToSessionInfoOption.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,52 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.ios.options.general; | ||
|
||
import io.appium.java_client.remote.options.BaseOptions; | ||
import io.appium.java_client.remote.options.CanSetCapability; | ||
import org.openqa.selenium.Capabilities; | ||
|
||
import java.util.Optional; | ||
|
||
import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; | ||
|
||
public interface SupportsIncludeDeviceCapsToSessionInfoOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String INCLUDE_DEVICE_CAPS_TO_SESSION_INFO_OPTION = "includeDeviceCapsToSessionInfo"; | ||
|
||
/** | ||
* Whether to include screen information as the result of Get Session Capabilities. | ||
* It includes pixelRatio, statBarHeight and viewportRect, but | ||
* it causes an extra API call to WDA which may increase the response time. | ||
* Defaults to true. | ||
* | ||
* @param value Whether to include screen information as the result of Get Session Capabilities. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setIncludeDeviceCapsToSessionInfo(boolean value) { | ||
return amend(INCLUDE_DEVICE_CAPS_TO_SESSION_INFO_OPTION, value); | ||
} | ||
|
||
/** | ||
* Get whether to include screen information as the result of Get Session Capabilities. | ||
* | ||
* @return True or false. | ||
*/ | ||
default Optional<Boolean> doesIncludeDeviceCapsToSessionInfo() { | ||
return Optional.ofNullable(toSafeBoolean(getCapability(INCLUDE_DEVICE_CAPS_TO_SESSION_INFO_OPTION))); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...in/java/io/appium/java_client/ios/options/general/SupportsResetLocationServiceOption.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,59 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* See the NOTICE file distributed with this work for additional | ||
* information regarding copyright ownership. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.appium.java_client.ios.options.general; | ||
|
||
import io.appium.java_client.remote.options.BaseOptions; | ||
import io.appium.java_client.remote.options.CanSetCapability; | ||
import org.openqa.selenium.Capabilities; | ||
|
||
import java.util.Optional; | ||
|
||
import static io.appium.java_client.internal.CapabilityHelpers.toSafeBoolean; | ||
|
||
public interface SupportsResetLocationServiceOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String RESET_LOCATION_SERVICE_OPTION = "resetLocationService"; | ||
|
||
/** | ||
* Set to reset the location service in the session deletion on real device. | ||
* | ||
* @return self instance for chaining. | ||
*/ | ||
default T resetLocationService() { | ||
return amend(RESET_LOCATION_SERVICE_OPTION, true); | ||
} | ||
|
||
/** | ||
* Whether reset the location service in the session deletion on real device. | ||
* Defaults to false. | ||
* | ||
* @param value Whether to reset the location service in the session deletion on real device. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setResetLocationService(boolean value) { | ||
return amend(RESET_LOCATION_SERVICE_OPTION, value); | ||
} | ||
|
||
/** | ||
* Get whether to reset the location service in the session deletion on real device. | ||
* | ||
* @return True or false. | ||
*/ | ||
default Optional<Boolean> doesResetLocationService() { | ||
return Optional.ofNullable(toSafeBoolean(getCapability(RESET_LOCATION_SERVICE_OPTION))); | ||
} | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.