LogoLogo
  • Overview
    • Quickstart
    • FAQ
    • Overview
    • Pricing
    • Comparison
    • Discord
  • Pro Setup
    • Book a Demo
    • 30x30 Promotion
  • Guides
    • Generate a Test Suite
    • Local Agent Setup
    • Prompting
    • Getting an API Key
    • GitHub Actions
      • GitHub Action Setup
      • Prerun Scripts
      • Environment Config
      • Parallel Testing
      • Storing Secrets
      • Optimizing Performance
      • Action Output
      • Examples
        • Test Generation
        • Parallel Testing
        • Importing Tests
        • Desktop Apps
        • Secure Log In
    • Debugging Test Runs
    • Monitoring Performance
  • Reference
    • Test Steps
      • assert
      • exec
      • focus-application
      • hover-image
      • match-image
      • hover-text
      • if
      • press-keys
      • remember
      • run
      • scroll
      • scroll-until-image
      • scroll-until-text
      • type
      • wait
      • wait-for-image
      • wait-for-text
    • Interactive Commands
      • /assert
      • /undo
      • /save
      • /run
      • /generate
    • CLI
      • testdriverai init
      • testdriverai [file]
      • testdriverai run [file]
  • Security & Privacy
    • Agent
    • Action
    • Dashboard
  • FAQ
    • Screen Recording Permissions (Mac Only)
    • Status Page
Powered by GitBook
On this page
  • Replace the hardcoded secrets within your
  • Add the secrets to your GitHub repository
  • Supply the secrets to the

Was this helpful?

Export as PDF
  1. Guides
  2. GitHub Actions

Storing Secrets

How to securely store and use username, password, and other secrets within TestDriver

PreviousParallel TestingNextOptimizing Performance

Last updated 1 month ago

Was this helpful?

You'll likely want TestDriver to log in to your app as a test user, but you wouldn't want to expose that password to the world.

Thankfully TestDriver provides a way to securely use secrets. Secrets will be masked from all test output, including Debugging Test Runs logs.

Replace the hardcoded secrets within your Test Steps

Open your test file (.yml) in a code editor and replace your secrets with ${TD_YOUR_SECRET} .

TestDriver will only parse and mask secrets that begin with TD_ .

Here is an example of Test Stepswith the secret syntax.

version: 4.1.35
steps:
  - prompt: sign in with username and password
    commands:
      - command: focus-application
        name: Google Chrome
      - command: hover-text
        text: Email or phone
        description: email input field
        action: click
      - command: type
        text: ${TD_USERNAME}
      - command: hover-text
        text: Next
        description: next button after entering email
        action: click
      - command: hover-text
        text: Password
        description: password input field
        action: click
      - command: type
        text: ${TD_PASSWORD}

Add the secrets to your GitHub repository

First, configure the secrets within your GitHub repository.

Follow the guide here for detailed instructions on how to add a secrete to your GitHub repo or organization.

Supply the secrets to the GitHub Actions

When using the GitHub Actions to spawn tests, supply your TD_SECRET within the env: value provided to the GitHub action.

env:
    TD_USERNAME: ${{ secrets.TD_USERNAME }}
    TD_PASSWORD: ${{ secrets.TD_PASSWORD }}
permissions:
  actions: read
  contents: read
  statuses: write
  pull-requests: write
  
jobs:
  test:
    name: "TestDriver"
    runs-on: ubuntu-latest
    steps:
      - uses: testdriverai/action@main
        with:
          key: ${{ secrets.TESTDRIVER_API_KEY }}
          prompt: | 
            1. /run tests/signin.yml
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          FORCE_COLOR: "3"
          TD_USERNAME: ${{ secrets.TD_USERNAME }}
          TD_PASSWORD: ${{ secrets.TD_PASSWORD }}
Using secrets in GitHub Actions - GitHub DocsGitHub Docs
Logo