Run Behat tests on Platform.sh env

I’m trying to get a behat test to work, so we use the P.sh pr env for our behat tests.

I am able to SSH into the P.sh env but as soon as I run the command vendor/bin/behat it tries to run it in the GitHub container not the P.sh env.

This is the code:

name: Behat tests

on: push
env:
  PLATFORMSH_CLI_TOKEN: ${{ secrets.PLATFORMSH_CLI_TOKEN }}
  PR_NUMBER: ${{ github.event.number }}

jobs:
  behat:
    name: Setup and run the behat tests
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Setup PHP
        uses: shivammathur/setup-php@v2
        with:
          php-version: '7.4'
      - name: Download Platform CLI
        run: curl -fsS https://platform.sh/cli/installer | php
      - name: Add .ssh folder
        run: |
          mkdir ~/.ssh
      - name: Add Psh to trusted keys
        run: |
          ssh-keyscan 'ssh.uk-1.platform.sh' >> ~/.ssh/known_hosts
          ssh-keyscan 'git.uk-1.platform.sh' >> ~/.ssh/known_hosts
      - name: Test CLI
        run: |
          ~/.platformsh/bin/platform ssh --project=PROJECTID --environment=pr-13
          vendor/bin/behat

What you put into a run step is a script that will run on the runner. If you want to run something on a remote host using SSH you need to provide those commands to the SSH command. With regular SSH that looks something like this:

ssh host.example.com "run-this --option"

I’m not familiar with the platform command you’re using, so I can’t say how to do it there.