Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error while running cypress on Jenkins - some dependencies missing #2792

Closed
euZebe opened this issue Nov 16, 2018 · 5 comments
Closed

Comments

@euZebe
Copy link

euZebe commented Nov 16, 2018

Current behavior:

I am trying to launch my cypress tests from Jenkins, using docker image cypress/base:8. Here are a few lines of my log and the error I get on cypress run instruction:

> Running shell script
+ docker inspect -f . cypress/base:8
[...] // checkout code, install node modules 
> start-server-and-test start:dev http://localhost:4000 cypress:run
[...] // application is starting
> cypress run
It looks like this is your first time using Cypress: 3.1.1
�[?25l[15:25:16]  Verifying Cypress can run /home/node/.cache/Cypress/3.1.1/Cypress [started]
[15:25:16]  Verifying Cypress can run /home/node/.cache/Cypress/3.1.1/Cypress [failed]
�[?25hCypress 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.
----------
Command failed: /home/node/.cache/Cypress/3.1.1/Cypress/Cypress --smoke-test --ping=836
----------
Platform: linux (Debian - 8.11)
Cypress Version: 3.1.1

What is that --smoke-test option ?
Anyone, any idea why it could fail ?

@dario-colombo
Copy link

you need to npm install cypress before start:dev,
the dockerimage cypress/base:8 does not have cypres installed afik,

@euZebe
Copy link
Author

euZebe commented Nov 20, 2018

Well, I do it ; here is my jenkinsfile:

pipeline {
    agent none
    stages {
        stage('Checkout and Execute Tests ') {
            agent { docker { image 'cypress/base:8' } }
            steps {
                checkout(...)
                sh("npm ci")
                sh("npm run ci-e2e")
            }
        }
    }
    options {
        buildDiscarder(logRotator(numToKeepStr:"5"))
        timeout(time: 1, unit: "HOURS")
    }
}

with package.json containing

scripts: {   "ci-e2e": "start-server-and-test start http://localhost:4000 cypress:run",` }

and

"devDependencies": {
    ...
    "cypress": "^3.1.1",
    ...
}

@euZebe
Copy link
Author

euZebe commented Dec 3, 2018

The problem came from our jenkins configuration ; DISPLAY environment property was set, which created some trouble with the following line:

isNeeded () {

@euZebe euZebe closed this as completed Dec 3, 2018
@pauldcomanici
Copy link

@euZebe you are a life saver.

I spent today about 10 hours until I found this, tried and it worked.

Now this should be documented directly in Cypress for other to know that this may be the issue.

cmd that I'm executing from jenkins is:

unset DISPLAY && DEBUG=cypress:* npm run test-e2e-ci

where test-e2e-ci is an npm script as: "test-e2e-ci": "cypress run"

@jennifer-shehane
Copy link
Member

Existing issue for DISPLAY env var is here. PRs are welcome! #4034

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants