Skip to main content
Protect sensitive information such as passwords, API keys, and tokens in your TestDriver tests.

Typing Secrets Securely

When you type sensitive information such as passwords, use the secret: true option. This stops TestDriver from a log or a store of the value:
When you set secret: true, the typed text shows as **** in all logs, recordings, and dashcam output.

Storing Secrets in GitHub

Store sensitive credentials as GitHub repository secrets. Then they are never in your code:
1

Navigate to Repository Settings

Go to your GitHub repository β†’ Settings β†’ Secrets and variables β†’ Actions
2

Add Repository Secrets

Click New repository secret and add your secrets:
  • TD_API_KEY - Your TestDriver API key
  • TD_USERNAME - Test account username
  • TD_PASSWORD - Test account password
3

Use in GitHub Actions

Reference secrets in your workflow file:
.github/workflows/test.yml

Local Development

For local development, store secrets in a .env file:
.env
Never commit .env files to version control. Add .env to your .gitignore file.

Complete Example

Here’s a full login test with proper secrets handling:
tests/login.test.js

Secrets Best Practices

  • Always use secret: true when typing passwords, tokens, or sensitive data
  • Use environment variables to keep secrets out of code
  • Store secrets in your CI provider (GitHub Actions, GitLab CI, etc.)
  • Never commit secrets to version control
  • Rotate secrets regularly to maintain security