Authentication is a critical part of any application. If you’re building tests that cover the parts of your app users actually care about, chances are you’ll need to log in. Whether it’s a simple email/password form or a more complex Google SSO flow, being able to authenticate reliably is key to building meaningful and trustworthy tests.In this guide, we’ll walk you through how to set up and use authentication in your tests using Stably.
A quicker alternative to the steps below is to use Stably’s AI agent to create the login actions. In the Add Step menu, simply select the AI Act option and instruct it to login using your test account variable (ie. “Login using the test_account credentials”)
Start recording your test as usual.
When the login screen appears:
Right-click the email field → choose Fill
In the modal, set the input type to Dynamic
Enter: `VARS.test_account.email`
Repeat the same steps for the password field using `VARS.test_account.password`
Click Login and continue recording the rest of your test.
From the Add Step or Add Operation menu, choose Login to Google
In the modal, select the test account you want to use from the dropdown
Click Select to confirm
Begin recording your test
When prompted in the login form, click Sign in with Google and the login flow should proceed automatically, since the Google account is already logged in thanks to the previous “Login with Google” action
If you’ve used Stably before, you might be familiar with the older auth steps — AI-powered steps that bundled all the logic into a single step.These legacy auth steps have now been deprecated.They’ve been replaced with more flexible, modular actions like “Login to Google”, which you can combine with regular Playwright actions (click, fill, etc.) and Stably environment variables to create reliable, customizable login flows.
Authentication can be complex — especially when anti-bot measures are in play. With Stably’s new modular login features and environment variable support, we aim to make testing auth flows as seamless and flexible as possible.
Need help with authentication? Don’t hesitate to reach out to our team at help@stably.ai