
Why UI Tests Need to Log In
Most of your product lives behind a login. If TestSprite can’t sign in, it can only explore and test whatever is reachable while signed out — a marketing page, a login screen, maybe a public pricing page. To test the dashboard, the settings, the checkout, the actual app, TestSprite needs a way in. You configure that once, up front. TestSprite then signs in the same way for every phase that touches your app — feature exploration, test generation, and every run afterward.Getting Started: “Sign-in required”
When you configure a Frontend (URLs) project, the auth section starts with two tabs, Sign-in required and No sign-in:Sign-in required: Choose this if parts of your product are behind a login. The TestSprite agent signs in with a test account to test those flows.
- Choose No sign-in if your app (or the part you want covered) is fully usable without an account. TestSprite explores and tests it anonymously.
- Choose Sign-in required and three login methods appear as cards, each matching a different way real users get into an app. Pick the one that fits yours.

Method 1 — Existing Test Account
You hand TestSprite a username and password for an account you already control. TestSprite signs in with them before exploring and before every run.
Configuration
Select Test account credentials
Enter the credentials
Continue
Best for
- Standard email/username + password logins
- A dedicated test account you keep in a known state
- Staging environments with seeded accounts
Limitations
- Doesn’t handle one-time codes on its own. If your login sends an email or SMS code after the password step, this method gets stuck at the code prompt — use Method 2 instead.
- Doesn’t handle social login. “Continue with Google” and similar can’t be driven with a username/password — use Method 3.
Method 2 — OTP (One-Time Password) Login
For apps that verify you with a one-time code — a signup or login that emails or texts a passcode. You provide nothing: TestSprite registers a dedicated test account whose email address and phone number it owns, so when your app sends a code, TestSprite receives it and enters it automatically.
How it works
How OTP (one-time password) login works — We sign up and log in on your site with a randomly generated TestSprite email address (and/or phone number), and enter the one-time passcodes it receives automatically.Because TestSprite owns the inbox and phone number, the whole loop — register → receive the code → enter the code → land signed in — happens without you handing over any credentials.
Configuration
Select OTP (one-time password) Login
Choose how your app verifies — Verify via
Create the project
Best for
- Passwordless logins
- Signups that require email verification before you can proceed
- Two-factor flows where a code is the second factor
Limitations
- One managed account per environment. The managed account is tied to the environment it was created in. To test with a second managed account, add another environment.
- OTP logins can’t run at the exact same moment. Because the managed inbox/phone would otherwise race for the same code, TestSprite serializes OTP logins within an environment — a second login waits for the first to finish and then reuses the session. In practice you won’t notice this beyond a brief wait; it’s why session reuse matters most for this method.
- Whether it succeeds depends on your signup/login flow. There’s no fixed list of supported sites — it works wherever TestSprite’s agent can drive the registration and code-entry steps. If a flow can’t be completed (unusual signup gates, extra required fields it can’t guess, aggressive bot protection), the login fails loudly rather than silently running signed out. See Troubleshooting.
Method 3 — Sign in with Google
For “Sign in with Google” logins — the kind TestSprite can’t (and shouldn’t) automate directly. Instead of automating the login, TestSprite opens a real browser, you sign in with Google yourself, and TestSprite records the resulting session so every future run starts already signed in.
How it works
When you finish creating the project (or click “Log in” from environment settings later), a live browser opens right inside the modal:Log in to your app — Sign in to your app in the live browser below (including “Sign in with Google”). When you’re done, click “I’ve finished logging in” and we’ll reuse this session for future test runs. You can skip this and add it later.You drive that browser exactly as you would your own — click “Continue with Google” and complete Google’s sign-in. When you’re in, you click I’ve finished logging in, and TestSprite captures the signed-in session (cookies and local storage) so it can replay it later without asking you to log in again.

Configuration
Select SSO (single sign-on)
Finish creating the project
Sign in yourself in the live browser
Click I've finished logging in
Best for
- Apps whose login is “Sign in with Google” (“Continue with Google”)
- Any flow where the sign-in is better completed by a human once than automated
Limitations
- Sessions expire. A captured session is good until it expires (your app’s own session lifetime is the ceiling). After that you re-log-in once — see Re-authenticating.
- It’s a one-time manual step per session. Unlike Methods 1 and 2, this needs a human at capture time. It’s the trade-off for supporting logins that can’t be safely automated.
Prerequisites
- Your environment has a public URL the live browser can reach. Local URLs (
localhost, private IPs) can’t be reached from TestSprite’s browser.
Reusing a Login Session
Logging in on every single test wastes time and, for OTP or manual login, can be disruptive. TestSprite can reuse a recent successful login across runs instead of signing in again each time.
Reuse Login Session — Skip logging in again if the last successful login is recent enough. Keep the window shorter than your site’s session lifetime.When on, set a Reuse window (in minutes). Within that window, runs start from the already-signed-in session; past it, TestSprite logs in fresh.
Multiple Test Accounts — Multiple Environments
Each account is one environment, and a project can have several environments. That’s how you cover different roles (admin vs. member) or different tenants (org A vs. org B): one environment per account.
Adding Another Environment
Open the project's Environments settings
Click Add Environment
Admin, Staging, Tenant B) and a Website URL, then configure its login exactly like the project’s first account: Sign-in required plus one of the three methods.Point tests at the right environment
Re-authenticating an Expired Session (Method 3)
Recorded Google/SSO sessions don’t last forever. When one expires, TestSprite tells you and runs fall back to signed-out until you refresh it.
Common Login Failures & Troubleshooting
My login sends a one-time code and Test account credentials gets stuck
My login sends a one-time code and Test account credentials gets stuck
My app uses 'Continue with Google' and login never completes
My app uses 'Continue with Google' and login never completes
I can't switch an existing project to OTP, or turn OTP off
I can't switch an existing project to OTP, or turn OTP off
Runs started failing after working fine — 'Sign in with Google' project
Runs started failing after working fine — 'Sign in with Google' project
The live browser won't open, or says the URL is unreachable
The live browser won't open, or says the URL is unreachable
localhost and private network addresses can’t be opened from TestSprite’s cloud browser. Point the environment at a public staging URL, or set up the MCP server to test locally.An OTP run waited a while before starting
An OTP run waited a while before starting