针对多种环境的 CircleCI 并行 Cypress

CircleCI parallel Cypress against multiple environments

我目前正在使用 CircleCI 运行 我的赛普拉斯测试套件针对单一环境。 CircleCI 配置指定以下内容:

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

在 cypress_run_circleci_all.sh 中,我有一个 hashmap 并对其进行循环。

#!/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

第一个环境一切正常,但第二个环境总是很快完成。我猜 运行 将多个 cypress 命令作为并行命令的一部分会破坏一些东西,但我不确定是什么。

任何关于我做错了什么的建议,以及我可以做些什么来实现我想要的(运行ning cypress 针对多个环境依次进行测试,每个 运行 针对一个环境 运行并联)。

Cypress Real World App is a payment application to demonstrate real-world usage of Cypress testing methods, patterns, and workflows. It contains a CircleCI config to run tests against Windows and Linux and uses the ci-build-id parameter for the Cypress CircleCI Orb to link the builds in the Cypress Dashboard