Cypress parallel + CircleCI parllelism: only one machine runs all test cases, the other machines do not run any cases

Viewed 518

I want to use cypress parallelization feature with CircleCI.

I've setup necessary steps but here's the problem:

Only one CI machine runs all test cases, the other machines do not run a single test case.

Here's my CircleCI config:

jobs:
  cypress:
    parallelism: 4
    steps:
      # some steps
      - run:
          name: Install and Run Cypress - E2E Testing suit
          command: |
            npm install cypress
            node_modules/.bin/cypress run --record --key SOME_KEY --browser chrome --config-file cypress-ci.json --parallel --group "cypress"
      # other steps

Here's the output of machine instance that runs all test cases:

$ node_modules/.bin/cypress run --record --key SOME_KEY --browser chrome --config-file cypress-ci.json --parallel --group cypress
It looks like this is your first time using Cypress: 8.7.0




Opening Cypress...
You've exceeded the limit of test results under your free billing plan this month. 

To continue getting the full benefits of your current plan, please visit your billing to upgrade.

https://on.cypress.io/set-up-billing

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:    8.7.0                                                                              │
  │ Browser:    Chrome 87 (headless)                                                               │
  │ Specs:      12 found (_Server/testSessions.js, AccountsPage/buySubscription.js, CheckoutPage/u │
  │             sersWithPendingStaticCoupon.js, OffersPage/sevenDaysTrialWithPayment.js, OtherPage │
  │             s/coursesPage.js, OtherPages/landingPage.js, PromotionFlow/ExistingUsers/discountO │
  │             fferWithPay...)                                                                    │
  │ Params:     Tag: false, Group: cypress, Parallel: true                                         │
  │ Run URL:    https://dashboard.cypress.io/projects/gj2uoh/runs/383                              │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


────────────────────────────────────────────────────────────────────────────────────────────────────
                                                                                                    
  Running:  OtherPages/landingPage.js                                                      (1 of 12)
  Estimated: 86 minutes, 58 seconds


  PageCheck
    ✓ Verify Navbar on 1920,1080 screen (80923ms)
    ✓ Verify Hero Section on 1920,1080 screen (56629ms)
    ✓ Verify Start Journey Section on 1920,1080 screen (230291ms)
    ✓ Verify Explore Section on 1920,1080 screen (33154ms)

Here's the output of machine instance that does not run any case:

$ node_modules/.bin/cypress run --record --key SOME_KEY --browser chrome --config-file cypress-ci.json --parallel --group cypress
It looks like this is your first time using Cypress: 8.7.0




Opening Cypress...
You've exceeded the limit of test results under your free billing plan this month. 

To continue getting the full benefits of your current plan, please visit your billing to upgrade.

https://on.cypress.io/set-up-billing

====================================================================================================

  (Run Starting)

  ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
  │ Cypress:    8.7.0                                                                              │
  │ Browser:    Chrome 87 (headless)                                                               │
  │ Specs:      12 found (_Server/testSessions.js, AccountsPage/buySubscription.js, CheckoutPage/u │
  │             sersWithPendingStaticCoupon.js, OffersPage/sevenDaysTrialWithPayment.js, OtherPage │
  │             s/coursesPage.js, OtherPages/landingPage.js, PromotionFlow/ExistingUsers/discountO │
  │             fferWithPay...)                                                                    │
  │ Params:     Tag: false, Group: cypress, Parallel: true                                         │
  │ Run URL:    https://dashboard.cypress.io/projects/gj2uoh/runs/383                              │
  └────────────────────────────────────────────────────────────────────────────────────────────────┘


====================================================================================================

  (Run Finished)
Done in 8.01s.
CircleCI received exit code 0

How can I change cypress command or circle ci config to enable proper load-balancing?

1 Answers

I would suggest you read the Cypress CI guide at https://on.cypress.io/ci and especially the page about CircleCI https://docs.cypress.io/guides/continuous-integration/circleci In your case you probably need to do cypress run --record --parallel, and that should be enough. You should also check out https://github.com/bahmutov/cypress-workshop-ci because Cypress CircleCI orb (https://github.com/cypress-io/circleci-orb) is really good and can abstract you from all the details (full disclosure, I wrote the orb)

Related