- Read passwords and tokens from environment variables, never from the test file.
- Type them with
secret: trueso TestDriver doesn’t log or store them.
Type a secret
Pass{ secret: true } to type() for any sensitive value. Click the field first, then type:
tests/login.test.mjs
What secret: true hides
With secret: true, TestDriver replaces the text with ****:
- In the SDK’s console output.
- In the record of the action that TestDriver stores for the test run.
secret: true can’t hide what the screen shows. If the field displays its contents, the value appears in the Dashcam recording and in screenshots. Password fields usually mask what you type, but plain text fields don’t.
Store secrets locally
TestDriver loads a.env file in your project root automatically. Put your local credentials there:
.env
.env to .gitignore so it’s never committed:
.gitignore
Store secrets in CI
In GitHub Actions, store each credential as a repository secret:1
Open your repository's secrets
In GitHub, go to Settings > Secrets and variables > Actions.
2
Add each secret
Click New repository secret and add
TEST_USERNAME and TEST_PASSWORD.3
Pass them to the test step
Map the secrets to environment variables in your workflow:
.github/workflows/testdriver.yml
testdriverai/action step authenticates with GitHub OIDC. See Run in CI/CD for the full workflow.
Checklist
- Type passwords, tokens, and other sensitive values with
secret: true. - Read credentials from environment variables, not from the test file.
- Keep
.envout of version control. - Use test accounts with only the access your tests need.
Next steps
Use variables and test data
Drive tests with environment variables and fixtures.
type()
Every option for typing text.
Run in CI/CD
Authenticate and run tests in your pipeline.
Reuse code
Put your login steps in a shared helper.

