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

Typing Secrets Securely

When typing sensitive information like passwords, use the secret: true option to prevent the value from being logged or stored:
When secret: true is set, the typed text appears as **** in all logs, recordings, and dashcam output.

Storing Secrets in GitHub

Store sensitive credentials as GitHub repository secrets so they’re never exposed 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