Cypress: CircleCI - error while loading shared libraries

Created on 27 Dec 2018  Â·  13Comments  Â·  Source: cypress-io/cypress

when I try to run cypress tests in CircleCI via npm run cy:run, the following error is thrown:

npm run cy:run

> [email protected] cy:run /home/circleci/project
> cypress run

It looks like this is your first time using Cypress: 3.1.3

[12:33:54]  Verifying Cypress can run /home/circleci/.cache/Cypress/3.1.3/Cypress [started]
[12:33:54]  Verifying Cypress can run /home/circleci/.cache/Cypress/3.1.3/Cypress [failed]
Cypress failed to start.

This is usually caused by a missing library or dependency.

The error below should indicate which dependency is missing.

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.
----------

/home/circleci/.cache/Cypress/3.1.3/Cypress/Cypress: error while loading shared libraries: libXtst.so.6: cannot open shared object file: No such file or directory
----------

Platform: linux (Debian - 9.5)
Cypress Version: 3.1.3

as a workaround I install the missing dependencies manually (before I run cypress tests):

sudo apt-get update
sudo apt-get install libxtst6 libgconf-2-4 libnss3 libasound2
circle

Most helpful comment

Hello folks, sorry for hijacking this ticket, but is there any documentation available in 2020, about which docker image should I import (I'm not using orbs because of internal reasons) in order to run tests?

Use-case: git clone repo, npm install, then cypress run. I have tried various combinations and installing some ubuntu video dependencies, but there all stuck to

Cypress failed to start.

This is usually caused by a missing library or dependency.

The error below should indicate which dependency is missing.

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.

----------

/home/circleci/.cache/Cypress/5.5.0/Cypress/Cypress: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory

Any help will be really appreciated!

All 13 comments

Cypress provide docker images for circle with all deps

https://github.com/cypress-io/cypress-example-docker-circle/blob/master/circle.yml

@YOU54F, I tried that before. same error.

@udos please provide your full circleci file. We run literally hundreds of projects on Circle, and we recommend using Cypress docker images https://github.com/cypress-io/cypress-docker-images as a base, because they have all OS dependencies installed already.

The simplest way to run Cypress on Circle is via Cypress orb, see here: https://github.com/cypress-io/circleci-orb

@bahmutov, I tried orbs after I got "inspired" :) by your presentation https://www.youtube.com/watch?v=J-xbNtKgXfY (but I got stuck and switched to the old school way of doing it).

my .circleci/config.yml to get cypress doing something on circleci is this

version: 2.1

orbs:
  # source: https://circleci.com/orbs/registry/orb/cypress-io/cypress
  cypress: cypress-io/[email protected]

jobs:
  build-demo:
    docker:
      - image: circleci/python:3.6.6-stretch-node
        environment:
          DATABASE_URL: postgresql://root@localhost/circle_test?sslmode=disable
          DJANGO_SETTINGS_MODULE: trails_dj.settings
          DJANGO_DEBUG: 1
          DJANGO_ENABLE_SSL: 0
      - image: circleci/postgres:9.6.5-alpine-ram
        environment:
          POSTGRES_USER: root
          POSTGRES_DB: circle_test
          POSTGRES_PASSWORD: ""
      - image: cypress/base:8
        environment:
          # this enables colors in the output
          TERM: xterm
    steps:
      - checkout
      - restore_cache:
          key: deps-py-{{ .Branch }}-{{ checksum "requirements/all.txt" }}
      - restore_cache:
          key: deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
      - run:
          name: install python and npm dependencies
          command: |
            python3 -m venv venv
            echo 'activate virtual environment'
            . venv/bin/activate
            echo 'install pip requirements'
            pip install -r requirements/all.txt
            echo 'install npm dependencies'
            npm install
            echo 'bundle webpack dev'
            npm run build:dev
      - save_cache:
          key: deps-py-{{ .Branch }}-{{ checksum "requirements/all.txt" }}
          paths:
            - "venv"
            - "/usr/local/bin"
            - "/usr/local/lib/python3.6/site-packages"
      - save_cache:
          key: deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
          paths:
            - "node_modules"
            - ".cache/Cypress"
      - run:
          name: run unit tests with coverage report
          command: |
            . venv/bin/activate
            coverage run ./manage.py test accounts file maps route segment strava trails_dj
            coverage report -m
            coverage xml
      - run:
          name: run django migrations
          command: |
            . venv/bin/activate
            python manage.py migrate
      - run:
          name: run django server in background
          command: |
            . venv/bin/activate
            python manage.py runserver localhost:8000
          background: true
      - restore_cache:
          key: deps-py-{{ .Branch }}-{{ checksum "requirements/all.txt" }}
      - restore_cache:
          key: deps-npm-{{ .Branch }}-{{ checksum "package-lock.json" }}
      - run:
          name: run cypress tests
          command: |
            . venv/bin/activate
            sleep 5
            curl --retry-delay 5 --retry 15 --retry-connrefused http://localhost:8000
            npm run cy:run
      - store_test_results:
          path: multiple-results
      - store_artifacts:
          path: cypress/videos
      - store_artifacts:
          path: cypress/screenshots
workflows:
  version: 2
  build-deploy:
    jobs:
      - build-demo:
          filters:
            branches:
              only: circleci

@udos so it seems to me Cypress tests run in image circleci/python:3.6.6-stretch-node right? which does not have Cypress OS dependencies ...

@bahmutov yes. I need python to start django server to run cypress tests.

@udos I am afraid there is no getting around it then - you need the Cypress OS dependencies http://on.cypress.io/continuous-integration#Dependencies in the image that actually runs Cypress tests. Maybe there is a way in Circle to run your server in one image (the image with Python), and run Cypress tests in another image (cypress/base:8 in your case), but I don't know how one would configure this

@bahmutov, no worries. I was about to propose you what you wrote ;)
note: maybe as a CircleCI partner they could add this dependendencies to images they provide (to make cypress integration easier).

last (related) question: in this case orbs don't help either. they simplify things only for node.js based projects. correct?

Yes, we will propose adding these dependencies to Circle full images

And yes, orbs are not going to help with cases when you need different environments in Circle, or at least I don't know if they can help here

thanks. no worries. cypress is a great tool!

@bahmutov it seems Cypress prepared images for python/ruby/XXX + headless browser based testing. I am able to run cypress based e2e tests with circleci/{lang}:{version}-node-browsers type of an image.

Example: circleci/python:3.8-node-browsers

Excellent but these are circleci prepared images not by cypress

Sent from my iPhone

On Nov 17, 2019, at 15:32, Piotr Duda notifications@github.com wrote:


@bahmutov it seems Cypress prepared images for python/ruby/XXX + headless browser based testing. I am able to run cypress based e2e tests with circleci/{lang}:{version}-node-browsers type of an image.

Example: circleci/python:3.8-node-browsers

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or unsubscribe.

Hello folks, sorry for hijacking this ticket, but is there any documentation available in 2020, about which docker image should I import (I'm not using orbs because of internal reasons) in order to run tests?

Use-case: git clone repo, npm install, then cypress run. I have tried various combinations and installing some ubuntu video dependencies, but there all stuck to

Cypress failed to start.

This is usually caused by a missing library or dependency.

The error below should indicate which dependency is missing.

https://on.cypress.io/required-dependencies

If you are using Docker, we provide containers with all required dependencies installed.

----------

/home/circleci/.cache/Cypress/5.5.0/Cypress/Cypress: error while loading shared libraries: libXcomposite.so.1: cannot open shared object file: No such file or directory

Any help will be really appreciated!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

zbigniewkalinowski picture zbigniewkalinowski  Â·  3Comments

jennifer-shehane picture jennifer-shehane  Â·  3Comments

stormherz picture stormherz  Â·  3Comments

Francismb picture Francismb  Â·  3Comments

verheyenkoen picture verheyenkoen  Â·  3Comments