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

Prerun Scripts

How to provision the VM and build your app before running TestDriver

Prerun scripts are Bash commands executed on a TestDriver VM before each test within a CI/CD pipeline. Their primary purpose is to establish the state of a machine. This ensure it is consistent before every test execution.

You can configure prerun script to install necessary dependencies, build your application, set specific configurations, and more.

This crucial step helps to speed up the setup of an environment, prepare for a test suite to run, and prevent test failures due to environment inconsistencies and promote reproducible builds, ultimately enhancing the overall test suite's effectiveness.

Example

This is an example of how to download Arc Browser and use it instead of Chrome.

# permissions and other setup here

jobs:
  test:
    name: "TestDriver"
    runs-on: ubuntu-latest
    steps:    
    # Download an exe for this test
    - uses: testdriverai/action@main
      with:
        prerun: |
          Get-NetIPAddress -AddressFamily IPv6
          # URL for the Arc browser installer
          $installerUrl = "https://releases.arc.net/windows/ArcInstaller.exe"
          # Location to save the installer
          $installerPath = "$env:USERPROFILE\Downloads\ArcInstaller.exe"
          # Download the Arc browser installer
          Write-Host "Downloading Arc browser installer..."
          Invoke-WebRequest -Uri $installerUrl -OutFile $installerPath
          # Check if the download was successful
          if (Test-Path $installerPath) {
              Write-Host "Download successful. Running the installer..."
              Start-Process -FilePath $installerPath -ArgumentList '/silent' -Wait
              Start-Sleep -Seconds 10
          } else {
              Write-Host "Failed to download the Arc browser installer."
          }
PreviousGitHub Action SetupNextEnvironment Config

Last updated 1 month ago

Was this helpful?