Background
You might want to authorize/login with Google in your tests, but doing so in your an automated web browser can have issues may be blocked by Google (as they might think this is bot traffic). This method exists to login in a way that won’t trigger such a response by Google.otpSecret.context.authWithGoogle(options)
Signs in a Google test account and applies the authenticated session to the current browser context. After this resolves, subsequent pages in the context are fully authenticated — no need to drive the login UI manually.
authWithGoogle stand-alone (pass your own context) if you import it directly:Options
Setting up a Google test account
Before usingauthWithGoogle, you need a Google account with 2FA configured using an authenticator app. The key requirement is obtaining the OTP secret — the 32-character base32 string Google provides during authenticator setup.
Get your Google secret
Generate the verification code
Finish in Google
Store the secret
GOOGLE_TEST_OTP_SECRET) for use in your tests.Detailed walkthrough
Step-by-step with screenshots
Step-by-step with screenshots
Access Google Account Settings
Navigate to Security Settings

Scroll to 'How you sign in to Google' and click 'Authenticator'

Click 'Add Authenticator' (or 'Change Authenticator App')

Access OTP Secret
- Click ‘Can’t scan QR code’
- This will reveal the OTP secret in text format
otpSecret with the authWithGoogle SDK method

Verify OTP setup using Stably's Util
Paste the OTP secret into the Stably OTP Util
Copy the generated OTP
Finish authenticator setup in Google

Enable 2FA and validate second steps
Use this Google OAuth account in your tests with the generated OTP secret