Skip to content
testmode

Credentials and automatic login

Store a test login once and Testmode signs in before your steps run. Login URL, the sites a password may be typed on, scope, shared logins and parallel sessions.

A credential is a login for the app you test: a username and a password, stored once per project. Attach it to a test case, and the browser is already signed in when step 1 runs. Explorations and Self-driving can use credentials too, to reach pages behind a login.

  1. Open Settings > Credentials and click Add credential.

  2. Enter a Name people will recognize, such as Staging customer, and the Username and Password of the test account.

  3. If the login form is not on the environment’s URL, enter the Login URL, for example https://staging.example.com/login.

  4. Choose the Scope: Project-wide, or one environment only.

  5. Under Sites the password may be typed on, tick the environments this password is for (project-wide credentials only).

  6. Click Add credential.

Add login credential dialog for Staging customer, with a username, a hidden password, a Login URL on the staging site, Parallel browser sessions left at Unlimited, Scope Project-wide, and only the Staging environment ticked under Sites the password may be typed on.
A project-wide credential lists the project’s environments; tick the ones its password is for.

Creating and editing credentials needs the Editor role or above. Passwords are encrypted and never shown again, to anyone. To change one, edit the credential and type a new password; leave the field blank to keep the current one.

Field What it does
Name What people pick in the test case editor, an exploration and Self-driving’s settings.
Username and Password Typed into your app’s login form.
Login URL (optional) Where the login form is. Leave it blank to sign in on the environment’s URL.
Parallel browser sessions (optional) How many browsers may use this login at the same time. Blank means unlimited. Set it to 1 for apps that allow one active session per user.
Scope Project-wide, usable on any environment, or Environment only, usable on that environment alone. It can’t be changed later.
Sites the password may be typed on The sites where Testmode is allowed to type this password. See below.

Testmode types a password only on the sites approved by whoever last entered it. That keeps a password from being typed into a different site after someone edits an environment or a login URL.

  • A credential scoped to one environment may be typed on that environment’s site and its login URL’s site.
  • A project-wide credential may be typed on its login URL’s site and on the sites of the environments you tick. Ticking none means the login URL’s site only.
  • The approval is for the sites as they are now. When an environment moves to another domain, or you add an environment on a new site, edit the credential and enter the password again to approve it there. Without the password, the list of sites can only shrink.

A test that would need to type the password anywhere else fails at login and says why.

  • In a test case: choose it under Login credential in the test case editor. See Write a test case.
  • In an exploration: pick it under Login credential when you start one. See Start an exploration.
  • For Self-driving: pick it under Where it works in its settings. See Turn on Self-driving.
  • From the assistant: it can attach a credential to a test case it writes, by name. It never sees passwords.

Each test signs in with its own test case’s credential, in every run and plan.

When a step types a username and password itself, the editor offers Move to a saved login: the details move into a credential, which keeps the password out of the test and signs in before step 1.

An exploration can also use the project’s other logins on the same environment, such as a second customer or a guest, to check that one account can’t open another’s records.

A credential scoped to one environment works only there: a test that uses it on another environment fails at login.

Before step 1, Testmode:

  1. Opens the credential’s Login URL, or the environment’s URL.
  2. Finds the login form, dismissing a cookie banner and following a “Log in” link or a Next button when the form needs one.
  3. Types the username and password and submits the form.
  4. Checks that the login worked, then opens the test’s start page.

Signing in is never one of your steps: when a test starts, it is already logged in. A step that looks for a login form fails.

Tests that use the same credential share one login. The first test signs in and Testmode saves the session (its cookies and storage). The other tests start with that session, without signing in again, while their run card says “Waiting for the login on credential …”. Later runs reuse the saved login too, as long as your app still accepts it; when it doesn’t, the next test signs in afresh.

Two things follow from sharing:

  • A test that signs out ends the login for every test using it at that moment. Give such a test its own credential, or set Parallel browser sessions to 1.
  • After you change the username or password, a login made with the old ones is never saved. Once your app stops accepting the saved login, the next test signs in with the new details.

Click the trash icon on the credential. A credential that a queued or running test, or an exploration in progress, signs in with can’t be deleted until that work finishes. Test cases that used a deleted credential run without a login.