Skip to content
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

Support TouchID functionality #958

Closed
fedeerbes opened this issue Sep 28, 2018 · 7 comments
Closed

Support TouchID functionality #958

fedeerbes opened this issue Sep 28, 2018 · 7 comments

Comments

@fedeerbes
Copy link

Description

I want to know if there is a way to test TouchID, currently i'm using Detox as e2e framwork, and i have touchID logic in my app. It would be nice simulate success and failure and interactions with system alerts binding to the process.

@LeoNatan
Copy link
Contributor

LeoNatan commented Oct 3, 2018

Hello,

Starting with version 0.6.0, AppleSimulatorUtils fully supports the simulator biometric system. You can enable or disable enrollment, as well as approve or fail authentication attempts using face or finger.

Now the matter of implementing it in Detox. While not a hard task at all, it will take time, and we are currently busy with other tasks. If you would like to contribute a PR implementing this functionality, we will be very happy to assist.

In the mean time, as a workaround, you can call applesimutils directly with the appropriate commands. Search the issues (open and closed) for examples of how to do that. You will need to obtain the current simulator ID from Detox, which is also possible.

@fedeerbes
Copy link
Author

Thank @LeoNatan appreciate it. I don't have much time free in the future, but maybe i can work on an PR for this. Thanks for the help

@LeoNatan
Copy link
Contributor

LeoNatan commented Oct 3, 2018

Thank you

@LeoNatan LeoNatan closed this as completed Oct 3, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Oct 6, 2018
@wix wix unlocked this conversation Jul 17, 2019
@abunsen
Copy link
Contributor

abunsen commented Jul 18, 2019

Claiming this - will start work on it now.

@LeoNatan LeoNatan reopened this Jul 18, 2019
@LeoNatan
Copy link
Contributor

@abunsen Fantastic, thank you!
I've reopened the issue, and we can discuss here if you need help.

@abunsen
Copy link
Contributor

abunsen commented Jul 22, 2019

So I believe all that needs to be done is a few functions need to be added to detox/src/devices/ios/AppleSimUtils.js, this is what I was thinking:

async matchBiometric(udid, matchType) {
    if (!['face', 'finger'].include(matchType)) {
      return;
    }
    const statusLogs = {
      trying: `Trying to match ${matchType}...`,
      successful: `Matched ${matchType}!`
    };

    await this._execAppleSimUtils({ args: `--byId ${udid} --${matchType}}` }, statusLogs, 1);
  }

  async unmatchBiometric(udid, matchType) {
    if (!['Face', 'Finger'].include(matchType)) {
      return;
    }
    const statusLogs = {
      trying: `Trying to match ${matchType}...`,
      successful: `Matched ${matchType}!`
    };

    await this._execAppleSimUtils({ args: `--byId ${udid} --unmatch${matchType}}` }, statusLogs, 1);
  }

  async setBiometricEnrollment(udid, toggle) {
    let yesOrNo = toggle ? 'YES' : 'NO'
    const statusLogs = {
      trying: `Turning ${toggle ? 'on' : 'off'} biometric enrollment`,
      successful: toggle ? 'Activated!' : 'Deactivated!'
    };
    await this._execAppleSimUtils({ args: `--byId ${udid} --biometricEnrollment ${yesOrNo}` }, statusLogs, 1);
  }

Then tests need to be added in detox/src/devices/Device.test.js. Does that sound about right @LeoNatan?

@abunsen
Copy link
Contributor

abunsen commented Jul 23, 2019

This is now supported on iOS only, here are the docs: https://github.com/wix/Detox/blob/master/docs/APIRef.DeviceObjectAPI.md#devicesetbiometricenrollmentbool-ios-only

@lock lock bot locked as resolved and limited conversation to collaborators Jul 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants