Open damasofc opened 1 year ago
I recently managed it work for Azure DevOps, you can check my solution here.
@ivan-xue-prospa can you share your .yml file? I'm unable to get it to run
@ivan-xue-prospa can you share your .yml file? I'm unable to get it to run
I cannot share the whole YAML file, but you can check the following two tasks.
- pwsh: | $index = $(System.JobPositionInPhase) - 1 echo "##vso[task.setvariable variable=index;isOutput=true]$index" name: index displayName: "Get Job Index"
- pwsh: | npx cyress run -- --env split=true --browser chrome workingDirectory: "$(Build.Repository.LocalPath)/$(repo.repoName)/${{ parameters.testFolder }}" displayName: "Execute tests" env: SPLIT: 2 SPLIT_INDEX: $(index.index)
Thanks for the answer @ivan-xue-prospa
The thing is that I'm using bash but with this config I'm getting this error:
System.JobPositionInPhase - 1: syntax error: invalid arithmetic operator (error token is ".JobPositionInPhase - 1")
Check the index that starts with 1 https://github.com/bahmutov/cypress-split#index-starts-at-1
Thanks so much, I was able to set it up on azure devops, my problem was that I didn't add the parallel on the Job inside the .yml so I did this:
jobs:
- job: EndToEndTests
displayName: End To End Test Run
strategy:
parallel: 3
after adding strategy and parallel it works and then I used what @bahmutov said the SPLIT_INDEX1
- task: Bash@3
displayName: Run external tests against archive stage
inputs:
workingDirectory: .
targetType: inline
script: |
export SPLIT="$(AGENTS)"
export SPLIT_INDEX1="$(System.JobPositionInPhase)"
how can I make this to run on Azure devops?