Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strong password autofill appears in iOS simulator

Our UI test suites are showing some unexpected behaviour where our Create Password screen intermittently auto-completes both the username and password - this results in the test being failed.

The process is something like:

  • Tap in the first create password field
  • Enter a password
  • Tap in the confirm password field
  • Enter the same password

This last step fails because the passwords in both fields have been auto-completed.

enter image description here

This happens for about one in every ten to twenty test executions.

Our understanding is that the password auto-fill should never be seen in any simulator, so it's very confusing to see this at all. Is there something that we can do to extra disable autofill, or otherwise prevent this from happening?

like image 619
Estel Avatar asked Mar 27 '19 13:03

Estel


People also ask

How do I stop Apple from suggesting strong passwords?

Prevent iPhone from automatically filling in passwordsGo to Settings > Passwords > AutoFill Passwords, then turn off AutoFill Passwords.


3 Answers

Had the same problem. What was useful for me is going to settings of the simulator -> Passwords -> Turn On and then Turn OFF AutoFill passwords.

like image 115
Денис Грищенко Avatar answered Oct 21 '22 05:10

Денис Грищенко


going to settings of the simulator -> Passwords -> Turn On and then Turn OFF AutoFill passwords.

enter image description here

type any password

enter image description here

enter image description here

like image 27
Same7Farouk Avatar answered Oct 21 '22 06:10

Same7Farouk


Not sure if it was like that since the beginning but setting isSecureTextEntry = true is enough to trigger that bug as well (at least in Xcode 12.2).

Therefore, the work-around which worked for me was:

let field = UITextField()
if #available(iOS 11.0, *) {
    #if targetEnvironment(simulator)
    // Do Not enable '.password' or '.newPassword' or 'isSecureTextEntry' text content type on simulator as it ends up with annoying behaviour:
    // 'Strong Password' yellow glitch preventing from editing field.
    print("Simulator! not setting password-like text content type")
    #else
    field.textContentType = .password
    field.isSecureTextEntry = true
    #endif
}
field.placeholder = "Password"
like image 5
Lukasz Avatar answered Oct 21 '22 04:10

Lukasz