Closed hvaandres closed 3 years ago
Have you tried using our provided docker images https://github.com/cypress-io/cypress-docker-images? They have all system dependencies installed. Running Cypress requires these outside dependencies be installed before you can run it. https://on.cypress.io/continuous-integration#Advanced-setup Most people find docker images to be helpful since installing directly is difficult, as you mentioned.
There's also a blog showing setup for Bitbucket here that may be helpful: https://www.cypress.io/blog/2018/08/30/setting-up-bitbucket-pipelines-with-proper-caching-of-npm-and-cypress/#header
Now, I solved this issue by using this configuration:
package.json:
"scripts": {
"jira:chrome": "cypress run --group 1x-chrome --record --headless --browser chrome",
"jira:firefox": "cypress run --group 1x-firefox --record --headless --browser firefox",
"jira:electron": "cypress run --group 1x-electron --record --headless --browser electron"
}
bitbucket-pipelines.yaml:
image: cypress/included:6.2.1
options:
max-time: 10
# job definition cross-browser testing
jira-chrome: &jira-chrome
name: JIRA Chrome tests
caches:
- node
- cypress
script:
- npx @bahmutov/print-env BITBUCKET
- npm run jira:chrome -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard]
artifacts:
# store any generates images and videos as artifacts
- cypress/screenshots/**
- cypress/videos/**
jira-firefox: &jira-firefox
name: JIRA Firefox tests
caches:
- node
- cypress
script:
- npx @bahmutov/print-env BITBUCKET
- npm run jira:firefox -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard]
artifacts:
# store any generates images and videos as artifacts
- cypress/screenshots/**
- cypress/videos/**
jira-electron: &jira-electron
name: JIRA Electron tests
caches:
- node
- cypress
script:
- npx @bahmutov/print-env BITBUCKET
- npm run jira:electron -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard]
artifacts:
# store any generates images and videos as artifacts
- cypress/screenshots/**
- cypress/videos/**
pipelines:
default:
- step:
name: Install dependencies
caches:
- npm
- cypress
- node
script:
- npm ci
- npx @bahmutov/print-env BITBUCKET
- parallel:
# cross-browser testing
- step:
<<: *jira-chrome
- step:
<<: *jira-firefox
- step:
<<: *jira-electron
definitions:
caches:
npm: $HOME/.npm
cypress: $HOME/.cache/Cypress
This will solve the issue. Thank you @jennifer-shehane you helped me a lot...!
I am hitting the same issue when trying to run Cypress tests in Jenkins. The tests pass locally but in CI while running in parallel this issue is seen consistently. Cypress version - 11.1.0 Node version - 16.18.0 Browser - Chrome 94
`If you are trying to pass multiple arguments, separate them with commas instead:
cypress run --spec arg1,arg2,arg3
The most common cause of this warning is using an unescaped glob pattern. If you are
trying to pass a glob pattern, escape it using quotes:
cypress run --spec "*/.spec.js"
It looks like this is your first time using Cypress: 11.1.0
[STARTED] Task without title.
[SUCCESS] Task without title.
Opening Cypress...
Your system is missing the dependency: Xvfb
Install Xvfb and run Cypress again.
Read our documentation on dependencies for more information:
https://on.cypress.io/required-dependencies
If you are using Docker, we provide containers with all required dependencies installed.
Error: Display :101 is already in use and the "reuse" option is false.
Platform: linux-x64 (Red Hat Linux - 8.7)
Cypress Version: 11.1.0`
Attempt - I tried using xvfb-run -a command as well but got the same error.
Now, I solved this issue by using this configuration:
package.json:
"scripts": { "jira:chrome": "cypress run --group 1x-chrome --record --headless --browser chrome", "jira:firefox": "cypress run --group 1x-firefox --record --headless --browser firefox", "jira:electron": "cypress run --group 1x-electron --record --headless --browser electron" }
bitbucket-pipelines.yaml:
image: cypress/included:6.2.1 options: max-time: 10 # job definition cross-browser testing jira-chrome: &jira-chrome name: JIRA Chrome tests caches: - node - cypress script: - npx @bahmutov/print-env BITBUCKET - npm run jira:chrome -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard] artifacts: # store any generates images and videos as artifacts - cypress/screenshots/** - cypress/videos/** jira-firefox: &jira-firefox name: JIRA Firefox tests caches: - node - cypress script: - npx @bahmutov/print-env BITBUCKET - npm run jira:firefox -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard] artifacts: # store any generates images and videos as artifacts - cypress/screenshots/** - cypress/videos/** jira-electron: &jira-electron name: JIRA Electron tests caches: - node - cypress script: - npx @bahmutov/print-env BITBUCKET - npm run jira:electron -- --ci-build-id $BITBUCKET_BUILD_NUMBER --key [Project_Key_From_Cypress_Dashboard] artifacts: # store any generates images and videos as artifacts - cypress/screenshots/** - cypress/videos/** pipelines: default: - step: name: Install dependencies caches: - npm - cypress - node script: - npm ci - npx @bahmutov/print-env BITBUCKET - parallel: # cross-browser testing - step: <<: *jira-chrome - step: <<: *jira-firefox - step: <<: *jira-electron definitions: caches: npm: $HOME/.npm cypress: $HOME/.cache/Cypress
This will solve the issue. Thank you @jennifer-shehane you helped me a lot...!
Instead of docker image,.....I tried sending --headless option but even then it failed....ANy other wat to resolve this...It worked ifne when runnign from azure pipelines but running from a azure self hosted Linux vm its giving this issue
Platform: linux-x64 (Debian - 12.2) Cypress Version: 13.4.0 ERROR: Job failed: exit code 1
how can solve this issue @jennifer-shehane
Looking into previous tickets, it seems that has to be installed from the NPM libraries which I'm not sure why is asking me to install this since I can't run Sudo under the pipeline.
This is my output:
What we should do to solve this issue?