KaneCheshire / BiometricAutomationDemo

Dependency free iOS biometric automation example.
61 stars 7 forks source link

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

Closed theblixguy closed 5 years ago

theblixguy commented 5 years ago

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!

KaneCheshire commented 5 years ago

Easily fixed at least. Hadn't thought of that since I chucked the demo together with a Touch ID simulator. Good catch!

KaneCheshire commented 5 years ago

Fixed :) although the tests need to be tweaked to handle the permissions alert

KaneCheshire commented 5 years ago

Just an update to say I’ve modified the tests to handle the Face ID permissions prompt (and learnt some more in the process!)

theblixguy commented 5 years ago

Nice! I also noticed that you have to enroll before you call app.launch() otherwise canEvaluatePolicy() returns false if you try enrolling after the app has launched. Not sure if this is a bug or expected behaviour!

KaneCheshire commented 5 years ago

Hmm not sure, you’ll definitely need to for this demo because all of the UI is set up at launch time, so enabling biometrics after the app has launched wont have an effect. It shouldn’t be a problem in an app that adapts as things change after launch though.