Hey, this is more of an FYI than a question, but maybe we could still discuss other methods that have worked for you.
Basically, Salesforce changed something in our sandboxes so that every login via the UI now requires you to input a verification code that’s sent by email. Naturally, this caused all our tests to fail.
Setting the IP address ranges used to work, but now it doesn’t. What we’ve now done is to use an external client app to generate a JWT, then we use that to open an already logged in browser and continue as normal.
Here are two resources I used to help me along the way:
- Setting Up OAuth 2.0 JWT Bearer Token Flow for Test Automation
- Build CI/CD pipeline using Gitlab for Salesforce - Apex Hours
The first one isn’t “totally correct” - some additional access permissions are required, as are some adjustments to get the browser working. I obviously can’t share the exact code we implemented, but hopefully this still helps anyone coming across the same issue.
- Create permission set for connected app
- Create connected app
- Use encrypted server.key.enc and decryption key as environment variable
- Generate JWT
- Use JWT to open logged in browser session
- Continue UI automation
![]()