Skip to content

Added toggleEnrollTouchID to commands#402

Merged
dpgraham merged 1 commit intomasterfrom
dpgraham-touch-id-enrollment-endpoint
Mar 24, 2017
Merged

Added toggleEnrollTouchID to commands#402
dpgraham merged 1 commit intomasterfrom
dpgraham-touch-id-enrollment-endpoint

Conversation

@dpgraham
Copy link
Copy Markdown
Contributor

  • Added unit tests that verify that enrollTouchID is called when it is a Simulator and that it is not called on real devices
  • Added a sample IOS app that uses TouchID to directory: test/assets
  • Added e2e tests that use the sample app to test calls to enroll/unroll and /wda/touch_id
  • Added desired cap that allows touchId enroll allowTouchIdEnroll
  • If cap is true, allow calls to toggleTouchIdEnroll
  • If false, calling toggleTouchIdEnroll throws exception
  • Added tests that check that it throws exception if allowTouchIdEnroll not true and tries enrolling

@dpgraham dpgraham self-assigned this Mar 21, 2017
@dpgraham dpgraham requested a review from imurchie March 21, 2017 18:27
@dpgraham
Copy link
Copy Markdown
Contributor Author

@imurchie It's not as heavy as it looks, most of the files are assets from an ios app that was added to test/assets

@dpgraham
Copy link
Copy Markdown
Contributor Author

dpgraham commented Mar 21, 2017

FYI, the Travis failure is happening because it's using a method that hasn't been published to admc/wd yet. Once that is published, I can restart the test and it will probably pass.

@dpgraham
Copy link
Copy Markdown
Contributor Author

@imurchie Do you have a chance to review this?

Copy link
Copy Markdown
Contributor

@imurchie imurchie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of small style comments. Otherwise looks good.

If you don't want this to get stale, you could monkeypatch the wd object with the method, and then make a ticket to undo it when someone gets around to updating and publishing a new wd package.

Comment thread lib/commands/general.js Outdated
return await this.proxyCommand('/wda/touch_id', 'POST', params);
if (this.isSimulator()) {
return await this.proxyCommand('/wda/touch_id', 'POST', {match});
} else {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather this be reversed, so we get out in the conditional, and then work outside of it.

if (!this.isSimulator()) {
  throw new errors.UnknownError('Touch ID simulation not supported on real devices');
}
return await this.proxyCommand('/wda/touch_id', 'POST', {match});

Comment thread lib/commands/general.js
* Toggle enrollment of touchId (Simuulator only)
*/
commands.toggleEnrollTouchId = async function () {
if (!this.opts.allowTouchIdEnroll) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing here. Also I'm not a big fan of the mixed conditional, if only because it makes the code harder to reason about. We have two errors conditions, and then the real deal.

if (!this.opts.allowTouchIdEnroll) {
  throw new errors.UnknownError(`Must set desired capability 'allowTouchIdEnroll = true' to enroll touchId`);
}
if (!this.isSimulator()) {
  throw new errors.UnknownError('Touch ID simulation not supported on real devices');
}
await this.opts.device.enrollTouchID();

@dpgraham dpgraham force-pushed the dpgraham-touch-id-enrollment-endpoint branch 4 times, most recently from 0453b14 to 9eb3e76 Compare March 24, 2017 20:22
* Added unit tests that verify that enrollTouchID is called when it is a Simulator and that it is not called on real devices
* Added a sample IOS app that uses TouchID to directory: `test/assets`
* Added e2e tests that use the sample app to test calls to enroll/unroll and `/wda/touch_id`
* Added desired cap that allows touchId enroll `allowTouchIdEnroll`
* If cap is true, allow calls to toggleTouchIdEnroll
* If false, calling toggleTouchIdEnroll throws exception
* Added tests that check that it throws exception if `allowTouchIdEnroll` not true and tries enrolling
@dpgraham dpgraham force-pushed the dpgraham-touch-id-enrollment-endpoint branch from 691ea22 to 3736e59 Compare March 24, 2017 22:06
@dpgraham dpgraham merged commit 903fcab into master Mar 24, 2017
@dpgraham dpgraham deleted the dpgraham-touch-id-enrollment-endpoint branch March 24, 2017 22:08
@dpgraham
Copy link
Copy Markdown
Contributor Author

Published to v2.24.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants