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
4 changes: 4 additions & 0 deletions src/main/java/io/appium/java_client/MobileCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public class MobileCommand {
//iOS
protected static final String SHAKE;
protected static final String TOUCH_ID;
protected static final String TOUCH_ID_ENROLLMENT;
//Android
protected static final String CURRENT_ACTIVITY;
protected static final String END_TEST_COVERAGE;
Expand Down Expand Up @@ -103,6 +104,7 @@ public class MobileCommand {
LOCK = "lock";
SHAKE = "shake";
TOUCH_ID = "touchId";
TOUCH_ID_ENROLLMENT = "toggleEnrollTouchId";

CURRENT_ACTIVITY = "currentActivity";
END_TEST_COVERAGE = "endTestCoverage";
Expand Down Expand Up @@ -151,6 +153,8 @@ public class MobileCommand {
//iOS
commandRepository.put(SHAKE, postC("/session/:sessionId/appium/device/shake"));
commandRepository.put(TOUCH_ID, postC("/session/:sessionId/appium/simulator/touch_id"));
commandRepository.put(TOUCH_ID_ENROLLMENT,
postC("/session/:sessionId/appium/simulator/toggle_touch_id_enrollment"));
//Android
commandRepository.put(CURRENT_ACTIVITY,
getC("/session/:sessionId/appium/device/current_activity"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,14 @@ public class IOSMobileCommandHelper extends MobileCommand {
return new AbstractMap.SimpleEntry<>(
TOUCH_ID, prepareArguments("match", match));
}

/**
* This method forms a {@link java.util.Map} of parameters for the toggling touchId
* enrollment in simulator.
*
*/
public static Map.Entry<String, Map<String, ?>> toggleTouchIdEnrollmentCommand() {
return new AbstractMap.SimpleEntry<>(
TOUCH_ID_ENROLLMENT, ImmutableMap.<String, Object>of());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package io.appium.java_client.ios;

import static io.appium.java_client.ios.IOSMobileCommandHelper.touchIdCommand;
import static io.appium.java_client.ios.IOSMobileCommandHelper.toggleTouchIdEnrollmentCommand;

import io.appium.java_client.CommandExecutionHelper;
import io.appium.java_client.ExecutesMethod;
Expand All @@ -31,4 +32,12 @@ public interface PerformsTouchID extends ExecutesMethod {
default void performTouchID(boolean match) {
CommandExecutionHelper.execute(this, touchIdCommand(match));
}

/**
* Enrolls touchId in iOS Simulators.
*
*/
default void toggleTouchIDEnrollment() {
CommandExecutionHelper.execute(this, toggleTouchIdEnrollmentCommand());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public class AppXCUITTest extends BaseIOSTest {
capabilities.setCapability(MobileCapabilityType.BROWSER_NAME, "");
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, "10.1");
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME, "iPhone 6");
capabilities.setCapability(IOSMobileCapabilityType.ALLOW_TOUCHID_ENROLL, "true");
//sometimes environment has performance problems
capabilities.setCapability(IOSMobileCapabilityType.LAUNCH_TIMEOUT, 500000);
capabilities
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public class XCUIAutomationTest extends AppXCUITTest {

@Test public void testTouchId() {
try {
driver.toggleTouchIDEnrollment();
driver.performTouchID(true);
driver.performTouchID(false);
assertEquals(true, true);
Expand Down