Parallel Cypress tests on TeamCity build agents

We currently have a repo containing 24 integration/*.js files. We are successfully running Cypress tests via our TeamCity CI workflow, however, I am unable to get the tests to run in parallel.

We have the repo/tests wired up to an org in Along with the dashboard key, we are calling Cypress in a TeamCity build step via npm run with the following configs in our package.json scripts{} :

"cypress:run:qa": "cypress run -c --record --key xyxyxyx-xyxyx-xyxyx-xyxyx-xyxyxyxyxyxy --parallel --config baseUrl=\"\" --ci-build-id=%BUILD_ID_CYPRESS%"

The %BUILD_ID_CYPRESS% environment var being passed in above is a custom combination of the TeamCity build ID and number, to make it unique.

The package.json has the following dependencies listed as well:

"devDependencies": {
    "cypress": "^3.3.2",
    "cypress-plugin-retries": "^1.2.0"
  "dependencies": {
    "ldclient-electron": "^1.0.1",
    "ldclient-js": "^2.10.0",
    "ldclient-node": "^5.7.4"

The config file contents are:

  "projectId": "*redacted*",
  "baseUrl": "",
  "numTestsKeptInMemory": 50,
  "port": 3002,
  "reporter": "teamcity",
  "reporterOptions": null,
  "watchForFileChanges": true,
  "viewportWidth": 1280,
  "viewportHeight": 720,
  "defaultCommandTimeout": 30000,
  "execTimeout": 90000,
  "taskTimeout": 90000,
  "pageLoadTimeout": 60000,
  "requestTimeout": 60000,
  "responseTimeout": 60000,
  "screenshotsFolder": "cypress/screenshots",
  "trashAssetsBeforeRuns": true,
  "videoCompression": 32,
  "videosFolder": "cypress/videos",
  "video": true,
  "videoUploadOnPasses": false,
  "env": {
    "retryAttempts": "2",
    "*redacted URL Name*": ""



The TeamCity build log seems to indicate that the Cypress is passing along the cypress-specific parallel configs correctly:

[15:48:08]  [Step 8/11] ================================================================================
[15:48:08]  [Step 8/11] 
[15:48:08]  [Step 8/11]   (Run Starting)
[15:48:08]  [Step 8/11] 
[15:48:09]  [Step 8/11]   ┌────────────────────────────────────────────────────────────────────────────�
[15:48:09]  [Step 8/11]   │ Cypress:  3.4.0                                                            │
[15:48:09]  [Step 8/11]   │ Browser:  Electron 61 (headless)                                           │
[15:48:09]  [Step 8/11]   │ Specs:    24 found (**spec names redacted*** │
[15:48:09]  [Step 8/11]   │ Params:   Group: false, Parallel: true                                     │
[15:48:09]  [Step 8/11]   │ Run URL:*redactedProjID*/runs/26           │
[15:48:09]  [Step 8/11]   └────────────────────────────────────────────────────────────────────────────┘
[15:48:09]  [Step 8/11] 
[15:48:09]  [Step 8/11] 2019-07-23T15:48:10.502Z cypress:server:record before spec run { spec: undefined }
[15:48:09]  [Step 8/11] 2019-07-23T15:48:10.503Z cypress:server:api request to url: POST*redactedGUID*/instances with params: {"body":{"spec":null,"groupId":"win32-Electron-61-abcabcabc","machineId":"**RedactedMachineID","platform":{"osCpus":[{"model":"Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz","speed":2400,"times":{"user":*redacted*,"nice":0,"sys":*redacted*,"idle":*redacted*,"irq":*redacted*}},{"model":"Intel(R) Xeon(R) CPU E5-2676 v3 @ 2.40GHz","speed":2400,"times":{"user":*redacted*,"nice":0,"sys":*redacted*,"idle":8866723484,"irq":517593}}],"osName":"win32","osMemory":{"free":956882944,"total":4294557696},"osVersion":"6.3.9600","browserName":"Electron","browserVersion":"61.0.3163.100"}},"headers":{"x-route-version":"5","x-os-name":"win32","x-cypress-version":"3.4.0"}} and token: undefined
[15:48:09]  [Step 8/11] 2019-07-23T15:48:10.624Z cypress:server:api response { spec: 'cypress\\integration\\*redacted*.js', instanceId: '*redactedGUID*', claimedInstances: 1, totalInstances: 24, estimatedWallClockDuration: 675698 }

However, the same machineId is repeated through the log output of each subsequent test run and all run serially on the same TeamCity agent.

Is there anything additional from the TeamCity side that needs to be configured for parallelization here? 


Hi David,


I'm not familiar with cypress, but it seems you are just running a command line script. From TeamCity's side, this script will be executed as it would anywhere else, but with the environment on the TeamCity's build agent. If the environment where the script has an impact on cypress' execution, then you need to take into account that the process will be spawned with the user that is running the build agent on where it's being run. You can try logging in to the build agent machine, cd'ing into the work directory and trying to run it manually to see what's the result there.


Other than that, you might want to get in touch with cypress as well, as they might have a better insight on how to troubleshoot this issue.


I know this is an old topic but just wondering if anyone was able to accomplish parallel run with Cypress tests?


Please sign in to leave a comment.