Giter Club home page Giter Club logo

biometricautomationdemo's Introduction

BiometricAutomationDemo

Dependency-free iOS Face ID and Touch ID automation example.

Zoom out

UI testing anything related to biometrics is really tough on iOS because there's no way to simulate/turn on biometrics on the Simulator from within UI tests, wihtout some sort of external dependency.

Until now.

This project serves as a demo project for a blog post I wrote about how we approached finding a solution, and eventually ended up with what you can find in this repo.

The demo

If you download or clone the repo, all you'll find is an Xcode project with a simple app and some UI tests.

Once you open the project you'll find four UI tests:

  • One for launching the app with biometrics disabled.
  • One for launching the app with biometrics enabled.
  • One for successfully authenticating with biometrics.
  • One for failing to authenticate with biometrics.

The UI in the app adapts based on what the state of biometrics are at launch, so you can easily see the UI tests in action.

Face ID vs Touch ID

Although Face ID and Touch ID APIs are largely the same, there are some things to consider when automating them.

For example, you don't need to ask the user's permission to use Touch ID but the first time you try to authenticate the user with Face ID a permissions prompt will appear.

The demo project handles this by checking for the existence of the permissions prompt before trying to approve it, since it will only show once for Face ID and never for Touch ID.

Another thing to be aware of us the differences in the UI between Touch ID and Face ID. Touch ID always has a visible cancel button, whereas Face ID doesn't.

Further reading

If you want to read how we structure our automation tests to be significantly easier to read and maintain, check out this series of posts.

Enjoy!

biometricautomationdemo's People

Contributors

kanecheshire avatar lvogelzang avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

biometricautomationdemo's Issues

UI tests crash because of missing NSFaceIDUsageDescription key in Info.plist

The UI tests are crashing because the NSFaceIDUsageDescription key hasn't been specified in the project's Info.plist (also it needs to be handled in the UI tests i.e. accepting the authorisation dialog).

I only realised this when writing UI tests for TABTestKit - I thought it may have something to do with the bridging header, but upon digging deeper into the stack trace, I noticed the text __CRASHING_DUE_TO_PRIVACY_VIOLATION__ and then it hit me - I forgot to include the NSFaceIDUsageDescription key! I checked this demo project and noticed it's missing it as well, so the UI tests will crash unless its fixed.

Surprisingly the tests pass in the end if you leave it for a minute: tearDown takes about 60 seconds and then the tests pass ๐Ÿค” Seems like a bug in Xcode, this shouldn't be happening!

Cancel button not tappable in Xcode 10.1

In Xcode 10.1, XCUI can't find the cancel button when failing biometric authentication.

I've checked in Xcode 10.2 beta and it's working fine, plus there's a workaround where you can press the home button (even on an iPhone X simulator) to dismiss the prompt:

XCUIDevice.shared.press(.home)

Creating an issue for visibility incase anyone else has run into this issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.