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

Was this helpful?

Export as PDF
  1. Guides
  2. GitHub Actions
  3. Examples

Secure Log In

Secrets can be passed into the workflow to not expose sensitive credentials

This workflow defines TD_USERNAME and TD_PASSWORD in env: to existing repository secrets of the same name. These TD_USERNAME and TD_PASSWORD can then be used in any YAML passed into the workflow. Secrets must begin with TD_ in order for Testdriver to be able to see them.

Example YAML steps using secrets could look like:

steps:
  - prompt: input email ${TD_TEST_USERNAME} then press continue
    commands:
      - command: hover-text
        text: Email address
        description: email input field label
        action: click
      - command: type
        text: ${TD_USERNAME}
      - command: hover-text
        text: CONTINUE
        description: continue button below the email input
        action: click
  - prompt: input password ${TD_TEST_PASSWORD} then click continue
    commands:
      - command: hover-text
        text: Password
        description: password input field label
        action: click
      - command: type
        text: ${TD_PASSWORD}
      - command: hover-text
        text: CONTINUE
        description: continue button below the password input
        action: click

This workflow:

  • Runs on each push to the "main" branch & every day at midnight

  • Defines variables that point to repository secrets

  • Runs the test provided

name: TestDriver.ai

permissions:
  actions: read
  contents: read
  statuses: write
  pull-requests: write

on:
  push:
    branches: ["main"]
  pull_request:
  workflow_dispatch:
  schedule:
    - cron: "0 0 * * *"

jobs:
  test:
    name: "TestDriver"
    runs-on: ubuntu-latest
    steps:
      - name: Run TestDriver.ai Action
        uses: testdriverai/action@main
        with:
          key: ${{ secrets.TESTDRIVER_API_KEY }}
          prompt: |
            1. /run testdriver/test.yml
          prerun: |
            cd $env:TEMP
            npm init -y
            npm install dashcam-chrome
            Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized", "--load-extension=$(pwd)/node_modules/dashcam-chrome/build", "${{ env.WEBSITE_URL }}"
            exit
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          FORCE_COLOR: "3"
          WEBSITE_URL: "example.com"
          TD_USERNAME: ${{ secrets.TD_USERNAME }}
          TD_PASSWORD: ${{ secrets.TD_PASSWORD }}
PreviousDesktop AppsNextDebugging Test Runs

Last updated 1 month ago

Was this helpful?