-
-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add WebDriverAgent-related options of XCUITest driver (#1554)
- Loading branch information
1 parent
523d643
commit 29797ce
Showing
23 changed files
with
1,126 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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 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
5 changes: 5 additions & 0 deletions
5
src/main/java/io/appium/java_client/ios/options/simulator/PasteboardSyncState.java
This file contains 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,5 @@ | ||
package io.appium.java_client.ios.options.simulator; | ||
|
||
public enum PasteboardSyncState { | ||
ON, OFF, SYSTEM | ||
} |
61 changes: 61 additions & 0 deletions
61
...a/io/appium/java_client/ios/options/simulator/SupportsCalendarAccessAuthorizedOption.java
This file contains 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,61 @@ | ||
/* | ||
* 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.simulator; | ||
|
||
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 SupportsCalendarAccessAuthorizedOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String CALENDAR_ACCESS_AUTHORIZED_OPTION = "calendarAccessAuthorized"; | ||
|
||
/** | ||
* Enable calendar access on IOS Simulator. | ||
* | ||
* @return self instance for chaining. | ||
*/ | ||
default T calendarAccessAuthorized() { | ||
return amend(CALENDAR_ACCESS_AUTHORIZED_OPTION, true); | ||
} | ||
|
||
/** | ||
* Set this to true if you want to enable calendar access on IOS Simulator | ||
* with given bundleId. Set to false, if you want to disable calendar access | ||
* on IOS Simulator with given bundleId. If not set, the calendar | ||
* authorization status will not be set. | ||
* | ||
* @param value Whether to enable calendar access on IOS Simulator. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setCalendarAccessAuthorized(boolean value) { | ||
return amend(CALENDAR_ACCESS_AUTHORIZED_OPTION, value); | ||
} | ||
|
||
/** | ||
* Get whether to enable calendar access on IOS Simulator. | ||
* | ||
* @return True or false. | ||
*/ | ||
default Optional<Boolean> doesCalendarAccessAuthorized() { | ||
return Optional.ofNullable(toSafeBoolean(getCapability(CALENDAR_ACCESS_AUTHORIZED_OPTION))); | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
src/main/java/io/appium/java_client/ios/options/simulator/SupportsCalendarFormatOption.java
This file contains 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,47 @@ | ||
/* | ||
* 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.simulator; | ||
|
||
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 SupportsCalendarFormatOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String CALENDAR_FORMAT_OPTION = "calendarFormat"; | ||
|
||
/** | ||
* Set calendar format for the iOS Simulator. | ||
* | ||
* @param format Calendar format to set for the iOS Simulator. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setCalendarFormat(String format) { | ||
return amend(CALENDAR_FORMAT_OPTION, format); | ||
} | ||
|
||
/** | ||
* Get calendar format to set for the iOS Simulator. | ||
* | ||
* @return Calendar format. | ||
*/ | ||
default Optional<String> getCalendarFormat() { | ||
return Optional.ofNullable((String) getCapability(CALENDAR_FORMAT_OPTION)); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...va/io/appium/java_client/ios/options/simulator/SupportsConnectHardwareKeyboardOption.java
This file contains 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,63 @@ | ||
/* | ||
* 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.simulator; | ||
|
||
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 SupportsConnectHardwareKeyboardOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String CONNECT_HARDWARE_KEYBOARD_OPTION = "connectHardwareKeyboard"; | ||
|
||
/** | ||
* Enforce connecting of hardware keyboard to Simulator. | ||
* | ||
* @return self instance for chaining. | ||
*/ | ||
default T connectHardwareKeyboard() { | ||
return amend(CONNECT_HARDWARE_KEYBOARD_OPTION, true); | ||
} | ||
|
||
/** | ||
* Set this option to true in order to enable hardware keyboard in Simulator. | ||
* The preference works only when Appium launches a simulator instance with | ||
* this value. It is set to false by default, because this helps to workaround | ||
* some XCTest bugs. connectHardwareKeyboard: true makes | ||
* forceSimulatorSoftwareKeyboardPresence: false if no explicit value is set | ||
* for forceSimulatorSoftwareKeyboardPresence capability since Appium 1.22.0. | ||
* | ||
* @param value Whether to connect hardware keyboard to Simulator. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setConnectHardwareKeyboard(boolean value) { | ||
return amend(CONNECT_HARDWARE_KEYBOARD_OPTION, value); | ||
} | ||
|
||
/** | ||
* Get whether to connect hardware keyboard to Simulator. | ||
* | ||
* @return True or false. | ||
*/ | ||
default Optional<Boolean> doesConnectHardwareKeyboard() { | ||
return Optional.ofNullable(toSafeBoolean(getCapability(CONNECT_HARDWARE_KEYBOARD_OPTION))); | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
src/main/java/io/appium/java_client/ios/options/simulator/SupportsCustomSslCertOption.java
This file contains 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.simulator; | ||
|
||
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 SupportsCustomSslCertOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String CUSTOM_SSLCERT_OPTION = "customSSLCert"; | ||
|
||
/** | ||
* Adds a root SSL certificate to IOS Simulator. | ||
* The certificate content must be provided in PEM format. | ||
* | ||
* @param cert Certificate content in PEM format. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setCustomSSLCert(String cert) { | ||
return amend(CUSTOM_SSLCERT_OPTION, cert); | ||
} | ||
|
||
/** | ||
* Get the SSL certificate content. | ||
* | ||
* @return Certificate content. | ||
*/ | ||
default Optional<String> setCustomSSLCert() { | ||
return Optional.ofNullable((String) getCapability(CUSTOM_SSLCERT_OPTION)); | ||
} | ||
} |
59 changes: 59 additions & 0 deletions
59
...appium/java_client/ios/options/simulator/SupportsEnforceFreshSimulatorCreationOption.java
This file contains 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.simulator; | ||
|
||
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 SupportsEnforceFreshSimulatorCreationOption<T extends BaseOptions<T>> extends | ||
Capabilities, CanSetCapability<T> { | ||
String ENFORCE_FRESH_SIMULATOR_CREATION_OPTION = "enforceFreshSimulatorCreation"; | ||
|
||
/** | ||
* Enforce creation of a new simulator for each new test session. | ||
* | ||
* @return self instance for chaining. | ||
*/ | ||
default T enforceFreshSimulatorCreation() { | ||
return amend(ENFORCE_FRESH_SIMULATOR_CREATION_OPTION, true); | ||
} | ||
|
||
/** | ||
* Creates a new simulator in session creation and deletes it in session deletion. | ||
* Defaults to false. | ||
* | ||
* @param value Whether to create a new simulator for each new test session. | ||
* @return self instance for chaining. | ||
*/ | ||
default T setEnforceFreshSimulatorCreation(boolean value) { | ||
return amend(ENFORCE_FRESH_SIMULATOR_CREATION_OPTION, value); | ||
} | ||
|
||
/** | ||
* Get whether to create a new simulator for each new test session. | ||
* | ||
* @return True or false. | ||
*/ | ||
default Optional<Boolean> doesEnforceFreshSimulatorCreation() { | ||
return Optional.ofNullable(toSafeBoolean(getCapability(ENFORCE_FRESH_SIMULATOR_CREATION_OPTION))); | ||
} | ||
} |
Oops, something went wrong.