Bypass Google CAPTCHA during Automated Testing

@inz.slawomir
I can’t find the manual/guide I used to implement it. I think I read several documents and combined the knowledge from each. Here is what worked for me…

Prerequisites:

  • An email account within your organization that the testing team can manage. They will need to keep track of two passwords at most: 1) the password they use to log in to their email inbox and 2) the Auth0 password assigned to them in the following steps.
  • Assumes you already have a client-facing application configured in Auth0.
  • Assumes your app is using the Auth0 Universal Login and hasn’t tampered with the allowedConnections in the lock-widget customization settings (Lock Configuration Options).

Steps:

  1. The admin needs to be signed in to the Auth0 management dashboard (https://manage.auth0.com/)
  2. Navigate to User Management > Users
  3. Create a new user with the tester’s email account from prerequisites. Give them a hard-to-guess password since the test user will likely be given elevated privileges. For more info on password policy in Auth0, see Password Strength in Auth0 Database Connections.
  4. Under Applications, navigate to your application’s Connections settings
  5. Toggle the Username-Password-Authentication ON.
    • Optional: Disable signups under Authentication > Database > Username-Password-Authentication settings to prevent unwanted bots/spammers from creating accounts. With signups disabled, users can still signup via Social login (e.g., Google OAuth2), which is known as Just-in-Time (JIT) account creation, but won’t be able to provision their own username/password accounts.
  6. Log in to your application with the new test user account. You will be prompted for Authorization Approval the first time you log in with a new account. You should accept the request.
  7. Now, you have a username/password combo that can be used in your E2E tests.

I have included some screenshots that can serve as a reference.