cypress: CI jobs freezing in Gitlab but running perfectly on local Mac

Current behavior:

I have some Cypress scripts that run to completion every time on my local Mac environment in both headed and headless Chrome. Cypress is working perfectly as expected locally. The problem I am having is adding this to our CI process in Gitlab. I have quoted the .gitlab-ci.yml file below.

The process just hangs once it reaches the testing phase and times out after the 60 minute limit. We are getting the desired behaviour of the 3 tests scripts running in parallel on separate instances but all of them hang and timeout. Even as a single thread on once instance we see the same hanging behaviour.

I suspect there are some missing dependencies for running Cypress on this OS? The build itself runs without errors (with quiet flags removed) and the processes freezes as shown in the screenshot.

Screenshot 2020-03-26 at 14 35 30

Desired behavior:

Tests should run to completion in our Gitlab CI step and should complete without an error code to indicate that the push is acceptable.

Test code to reproduce

image: node:10.4.1-stretch

stages:
  - test

before_script:
  - echo "deb http://mirrors.kernel.org/ubuntu/ xenial main" | tee -a /etc/apt/sources.list
  - echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections
  - apt-get -qq update && apt-get install -y --no-install-recommends apt-utils > /dev/null
  - apt-get -qq install -y --allow-unauthenticated libpng12-0 > /dev/null
  - apt-get -qq install -y python-pip python-dev > /dev/null
  - pip install -q --upgrade awscli
  - npm install --quiet

cache:
  untracked: true
  key: global
  paths:
    - node_modules
    - .npm

.cypress_build_script: &cypress_build_script |
  apt-get -qq install -y libgtk2.0-0 libnotify4 libgtk-3-0 libnotify-dev libgconf2-4 libgconf-2-4 libnss3 libxss1 libasound2 libxtst6 xauth xvfb > /dev/null
  wget -q https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 
  apt -qq install -y --allow-unauthenticated ./google-chrome-stable_current_amd64.deb > /dev/null
  npm install -g --quiet wait-on
  npx cypress cache path
  npx cypress cache list
  PROXY=true npm run setup:development
  npm run build:dll
  npm start & wait-on http://localhost:4000

cypress_test_mdlu:
  stage: test
  script:  
    - *cypress_build_script
    - npm run cypress:run -- --spec \"cypress/integration/Smoke Tests/MDLU/*.spec.js\" --headless --browser chrome

cypress_test_dlu:
  stage: test
  script:  
    - *cypress_build_script
    - npm run cypress:run -- --spec \"cypress/integration/Smoke Tests/DLU/*.spec.js\" --headless --browser chrome

cypress_test_slu:
  stage: test
  script:  
    - *cypress_build_script
    - npm run cypress:run -- --spec \"cypress/integration/Smoke Tests/SLU/*.spec.js\" --headless --browser chrome

Versions

Cypress: 4.2.0 Browser: Chrome 80 (headless)
OS: Debian 9

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 1
  • Comments: 26 (1 by maintainers)

Most upvoted comments

Same here

Thanks @0xIslamTaha

I can confirm that this particular article resolved the problem:

https://stackoverflow.com/questions/57334452/can-i-increase-shared-memory-after-launching-a-docker-session

I add these two lines to the start of my build script:

mount -o remount,size=2G /dev/shm df -h /dev/shm

This issue can be closed.

@0xIslamTaha It works to me.

Before add --shm-size=2GB , sometimes run cypress will freeze by docker run between case1 finish or case 2 finish(there are 3 big cases in a spec).

After add --shm-size=2GB , it can’t reproduce.

we faced the same nasty bug and we managed to solve it by adding shm_size: 2GB to the cypress service inside the docker composer. If u are using docker run ... instead of docker-composer then u can do something like docker run --shm_size=2GB .....