Environment Config

How to change the operating system platform.

To configure the operating system, simply supply the os param to the GitHub action. The current available operating systems are windows and mac.

Mac execution is only available to Enterprise customers.

Prerun files

Note that prerun files are executed on these machines themselves. You must use powershell on Windows and bash on mac.

Testing multiple browsers and operating systems

The following example will run the same test using 4 different configurations by utilizing the GitHub matrix strategy.

name: Test action
on:
  pull_request:
    types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled]

jobs:
  test-action:
    name: Test action
    runs-on: ubuntu-latest
    strategy:
      matrix:
        os: [windows, mac]
        browser: [chrome, firefox]
    steps:
      - name: Set up Node.js
        uses: actions/setup-node@v3
        with:
          node-version: '16'

      - name: Install Dashcam Chrome
        run: |
          npm init -y
          npm install dashcam-chrome

      - uses: replayableio/testdriver-action@main
        with:
          version: v4.0.0
          prompt: |
            1. open youtube
            2. find a cat video
            3. quit the browser
            4. /summarize
          os: ${{ matrix.os }}
          prerun: |
            if [ "${{ matrix.browser }}" == "chrome" ]; then
              if [ "${{ matrix.os }}" == "windows" ]; then
                # Install Google Chrome on Windows
                $ProgressPreference = 'SilentlyContinue'
                Invoke-WebRequest -Uri "https://dl.google.com/chrome/install/latest/chrome_installer.exe" -OutFile "$env:TEMP\chrome_installer.exe"
                Start-Process -FilePath "$env:TEMP\chrome_installer.exe" -ArgumentList "/silent", "/install" -Wait
              else
                # Install Google Chrome on macOS
                brew install --cask google-chrome
              fi
            else
              if [ "${{ matrix.os }}" == "windows" ]; then
                # Install Firefox on Windows
                $ProgressPreference = 'SilentlyContinue'
                Invoke-WebRequest -Uri "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=en-US" -OutFile "$env:TEMP\firefox_installer.exe"
                Start-Process -FilePath "$env:TEMP\firefox_installer.exe" -ArgumentList "/S" -Wait
              else
                # Install Firefox on macOS
                brew install --cask firefox
              fi
            fi
            if [ "${{ matrix.browser }}" == "chrome" ]; then
              if [ "${{ matrix.os }}" == "windows" ]; then
                Start-Process "C:/Program Files/Google/Chrome/Application/chrome.exe" -ArgumentList "--start-maximized","--load-extension=$(pwd)/node_modules/dashcam-chrome/build" &
              else
                /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --start-maximized --load-extension=$(pwd)/node_modules/dashcam-chrome/build &
              fi
            else
              if [ "${{ matrix.os }}" == "windows" ]; then
                Start-Process "C:/Program Files/Mozilla Firefox/firefox.exe" -ArgumentList "--start-maximized" &
              else
                /Applications/Firefox.app/Contents/MacOS/firefox --start-maximized &
              fi
            fi
          key: ${{ secrets.TESTDRIVER_API_KEY }}
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          FORCE_COLOR: "3"

Last updated