I want to activate 4 virtual machines for cypress cloud parallelization but with the mention that for each virtual machine I want to have a folder suite_${{virtual machine number}} so as not to confuse the tests between them.
I can't configure the yml file to find the tests in the path cypress/e2e/Tests/suite_${{virtual machine number}}/*.spec.ts
I have this code:
name: UP Automation regression
on:
push:
branches: [ paralellization ]
pull_request:
branches: [ paralellization ]
jobs:
run-automation-regression-tests:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
containers: [1, 2, 3, 4]
steps:
- run: git config --global url."https://ghp_****@github.com/".insteadOf https://github.com/
- name: Checkout
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set test spec path
run: echo "TEST_SPEC_PATH=cypress/e2e/Tests/suite_${{ matrix.containers }}" >> $GITHUB_ENV
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: electron
record: true
parallel: true
spec: ${{ env.TEST_SPEC_PATH }}
env:
# For recording and parallelization to work you must set your CYPRESS_RECORD_KEY
# in GitHub repo → Settings → Secrets → Actions
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
# Creating a token https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Since you are running on a windows machine (
windows-latest), this part will not actually work, even though the documentation suggests so:See this answer for more details, but in short, you need to change this to the following:
So really to just change
$GITHUB_ENVto$env:GITHUB_ENV. The first one would work for bash, but since these are executed on powershell instead due to the windows runner, the powershell syntax is required.There's a brief example about the different syntaxes found here.