I'm currently using CircleCI to run my Cypress test suite against a single environment. The CircleCI config specifies the following:
docker:
- image: cypress/base:10
parallelism: 16
steps:
- *quick_attach
- restore_cache:
key: dependency-cache-{{ checksum "yarn.lock" }}-v2
- run:
name: Run Cypress Tests
command: >
CYPRESS_BRANCH=$CIRCLE_BRANCH
CYPRESS_SOURCE=CircleCI
CYPRESS_RECORD_KEY=$CYPRESS_RECORD_KEY
/bin/bash ./scripts/cypress_run_circleci_all.sh
Inside cypress_run_circleci_all.sh, I have a hashmap and loop over it.
#!/bin/bash
set -e
declare -A environments
environments[dev]="https://dev.mydomain.com"
environments[qa]="https://qa.mydomain.com"
## loop through the all environments
for env_name in ${!environments[@]}
do
TAGS="all-envs-test,${env_name}"
CYPRESS_baseUrl=${environments[$env_name]} \
yarn cypress:run:desktop --record \
--group Desktop \
--parallel \
--tag \"$TAGS\" || true
echo "sleeping 60s"
sleep 60
done
Everything works as expected for the first environment, but the second environment always finishes very quickly. I'm guessing there's something about running multiple cypress commands as part of the parallel command that's breaking things, but I'm unsure what.
Any suggestions on what I'm doing wrong, and what I could do to acheive what I want (running cypress tests sequentially against multiple environments, with each run against an environment running in parallel).