Code Monkey home page Code Monkey logo

Comments (34)

pablorivera avatar pablorivera commented on July 20, 2024 5

On Mac OSX works both, electron and chrome. I'm running it in the Docker container because I need it for CI. As it was not working I was testing it. In the Docker container electron works, but I need to run it with Chrome which doesn't work.

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024 1

Not sure why, can you see

  • if chrome prints its version chrome --version in your container
  • see debug info from cypress run using DEBUG=cypress:* environment variable
  • does built-in browser run?

from cypress-docker-images.

pablorivera avatar pablorivera commented on July 20, 2024

Thanks @bahmutov for your quick reply. Below is what I got:

person@17871949b208:/$ google-chrome
Failed to move to new namespace: PID namespaces supported, Network namespace supported, but failed: errno = Operation not permitted
Trace/breakpoint trap
person@17871949b208:/$ chrome --version
Google Chrome 62.0.3202.62
person@17871949b208:/$ cd apps/ci/
person@17871949b208:/apps/ci$ npm run cypress:debug
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle @~precypress:debug: @
npm info lifecycle @~cypress:debug: @

> @ cypress:debug /apps/ci
> DEBUG=cypress:* cypress run --browser chrome

  cypress:cli cli starts with arguments ["/usr/local/bin/node","/apps/ci/node_modules/.bin/cypress","run","--browser","chrome"] +0ms
  cypress:cli program parsing arguments +4ms
  cypress:cli running Cypress +6ms
  cypress:cli parsed cli options { browser: 'chrome' } +224ms
  cypress:cli verifying Cypress app +4ms
  cypress:cli path to info.json file /apps/ci/node_modules/cypress/dist/info.json +1ms
  cypress:cli { version: '1.0.3', verifiedVersion: '1.0.3' } +8ms
  cypress:cli installed version is 1.0.3 comparing to 1.0.3 +2ms
  cypress:cli checking if executable exists /apps/ci/node_modules/cypress/dist/Cypress/Cypress +0ms
  cypress:cli path to info.json file /apps/ci/node_modules/cypress/dist/info.json +2ms
  cypress:cli has verified version 1.0.3 +1ms
  cypress:cli run verification check? false +1ms
  cypress:cli processing run options +0ms
  cypress:cli --key is not set, looking up environment variable CYPRESS_RECORD_KEY +0ms
  cypress:cli run to spawn.start args ["--run-project","/apps/ci","--browser","chrome"] +1ms
  cypress:cli needs XVFB? true +1ms
  cypress:cli Starting XVFB +0ms
  cypress:cli spawning Cypress /apps/ci/node_modules/cypress/dist/Cypress/Cypress +49ms
  cypress:cli spawn args ["--run-project","/apps/ci","--browser","chrome"] +0ms
Warning: Cypress can only record videos when using the built in 'electron' browser.

You have set the browser to: 'chrome'

A video will not be recorded when using this browser.
  (Tests Starting)

Timed out waiting for the browser to connect. Retrying...

Timed out waiting for the browser to connect. Retrying again...

The browser never connected. Something is wrong. The tests cannot run. Aborting...

  (Tests Finished)

  - Tests:           0
  - Passes:          0
  - Failures:        1
  - Pending:         0
  - Duration:        0 seconds
  - Screenshots:     0
  - Video Recorded:  false
  - Cypress Version: 1.0.3


  (All Done)

  cypress:cli Stopping XVFB +2m

npm info lifecycle @~cypress:debug: Failed to exec cypress:debug script
npm ERR! Linux 4.9.49-moby
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "cypress:debug"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ cypress:debug: `DEBUG=cypress:* cypress run --browser chrome`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ cypress:debug script 'DEBUG=cypress:* cypress run --browser chrome'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     DEBUG=cypress:* cypress run --browser chrome
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /apps/ci/npm-debug.log

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

Weird, maybe the container is too memory limited for Chrome to run?

We are testing Cypress + Chrome browser in https://github.com/cypress-io/cypress-test-node-versions
For example here is a test run: https://circleci.com/gh/cypress-io/cypress-test-node-versions/1242

from cypress-docker-images.

pablorivera avatar pablorivera commented on July 20, 2024

I don't think that is the problem. It was 2GB so I tried setting it to 4GB but having the same issue. See below:

person@f9c18fbef023:/apps/ci$ free
             total       used       free     shared    buffers     cached
Mem:       4042392     369984    3672408     168268      45576     203404
-/+ buffers/cache:     121004    3921388
Swap:      1048572          0    1048572
person@f9c18fbef023:/apps/ci$ npm run cypress:debug
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle @~precypress:debug: @
npm info lifecycle @~cypress:debug: @

> @ cypress:debug /apps/ci
> DEBUG=cypress:* cypress run --browser chrome

  cypress:cli cli starts with arguments ["/usr/local/bin/node","/apps/ci/node_modules/.bin/cypress","run","--browser","chrome"] +0ms
  cypress:cli program parsing arguments +3ms
  cypress:cli running Cypress +3ms
  cypress:cli parsed cli options { browser: 'chrome' } +329ms
  cypress:cli verifying Cypress app +2ms
  cypress:cli path to info.json file /apps/ci/node_modules/cypress/dist/info.json +1ms
  cypress:cli { version: '1.0.3', verifiedVersion: '1.0.3' } +5ms
  cypress:cli installed version is 1.0.3 comparing to 1.0.3 +1ms
  cypress:cli checking if executable exists /apps/ci/node_modules/cypress/dist/Cypress/Cypress +0ms
  cypress:cli path to info.json file /apps/ci/node_modules/cypress/dist/info.json +2ms
  cypress:cli has verified version 1.0.3 +1ms
  cypress:cli run verification check? false +0ms
  cypress:cli processing run options +1ms
  cypress:cli --key is not set, looking up environment variable CYPRESS_RECORD_KEY +0ms
  cypress:cli run to spawn.start args ["--run-project","/apps/ci","--browser","chrome"] +0ms
  cypress:cli needs XVFB? true +1ms
  cypress:cli Starting XVFB +0ms
  cypress:cli spawning Cypress /apps/ci/node_modules/cypress/dist/Cypress/Cypress +65ms
  cypress:cli spawn args ["--run-project","/apps/ci","--browser","chrome"] +0ms
Warning: Cypress can only record videos when using the built in 'electron' browser.

You have set the browser to: 'chrome'

A video will not be recorded when using this browser.
  (Tests Starting)

Timed out waiting for the browser to connect. Retrying...

Timed out waiting for the browser to connect. Retrying again...

The browser never connected. Something is wrong. The tests cannot run. Aborting...

  (Tests Finished)

  - Tests:           0
  - Passes:          0
  - Failures:        1
  - Pending:         0
  - Duration:        0 seconds
  - Screenshots:     0
  - Video Recorded:  false
  - Cypress Version: 1.0.3


  (All Done)

  cypress:cli Stopping XVFB +2m

npm info lifecycle @~cypress:debug: Failed to exec cypress:debug script
npm ERR! Linux 4.9.49-moby
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "cypress:debug"
npm ERR! node v6.11.1
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ cypress:debug: `DEBUG=cypress:* cypress run --browser chrome`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ cypress:debug script 'DEBUG=cypress:* cypress run --browser chrome'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     DEBUG=cypress:* cypress run --browser chrome
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /apps/ci/npm-debug.log

from cypress-docker-images.

brian-mann avatar brian-mann commented on July 20, 2024

By any chance are you running this locally say in OSX where its using network filesystem instead of docker having its own dedicated one?

from cypress-docker-images.

pablorivera avatar pablorivera commented on July 20, 2024

I'm accessing to the container with docker-compose -f docker-compose.yml run ci bash
My docker-compose.yml content is

version: "2"
services:
  ci:
    build:
      context: ./
      dockerfile: containers/ci/Dockerfile
    stdin_open: true
    tty: true

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

from Mac OSX right?

from cypress-docker-images.

pablorivera avatar pablorivera commented on July 20, 2024

Yes, on Mac OSX but also in Bamboo CI

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

Ok, can I ask why don't you run Mac Cypress directly? Like why do you need to put it into local Docker container? You don't see the GUI...

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

and does Cypress run with built-in electron browser?

from cypress-docker-images.

dineshk-qa avatar dineshk-qa commented on July 20, 2024

Having same issue on Windows 10.
Local run is fine with both electron and chrome but running inside a local container:

  1. Electron - runs fine
  2. Chrome - throws Timed out waiting for the browser to connect. Retrying....
    Although I could run image with chrome --version and it spits Google Chrome 62.0.3202.62

from cypress-docker-images.

canakguen avatar canakguen commented on July 20, 2024

I have the exactly the same problem of cypress timing out. Running it on gitlab ci with the given chrome image. Are there any news about this topic?

I verified the following steps:

  • chrome --version prints Google Chrome 62.0.3202.62 as well
  • Memory is not limited, currently this test is executed on a 64GB root server with no competing tests being run at the same time
  • electron works just fine, chrome does not
  • This is how the CI file looks:
cypress-e2e-chrome:
  image: cypress/browsers:chrome62
  stage: test
  script:    
    - chrome --version
    - npm install --save-dev cypress
    - $(npm bin)/cypress run  --record --key a-beautiful-key --browser chrome
  artifacts:
    expire_in: 1 week
    paths:
    - cypress/screenshots
    - cypress/videos

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

No updates, let me update our GitLab CI example to see if it works

https://gitlab.com/cypress-io/cypress-example-docker-gitlab/issues/3

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

I invite everyone to take a look at Cypress running on GitLab CI (both electron and chrome browser). Maybe the simple test is too small and simple?

from cypress-docker-images.

arsduo avatar arsduo commented on July 20, 2024

FWIW, I'm seeing the same thing on Circle CI 2.0 with the cypress/browsers:chrome62 image. If I open up a terminal in the docker container booted during the CI steps, I can use headless Chrome (for instance, chrome --headless --print-to-pdf http://google.com generates a PDF), but running $(yarn bin)/cypress run --browser chrome in the session fails because it can't connect to the browser.

I've attached the Dockerfile, in case that's useful.

Dockerfile.txt

from cypress-docker-images.

arsduo avatar arsduo commented on July 20, 2024

I tried enabling Cypress debug logging to get more information (DEBUG=cypress:* $(yarn bin)/cypress run --browser chrome), but for some reason the log statements that seem like they should be printed during the Chrome launch process don't actually happen (see below).

Since the log statement's been there since 0.19 (according to Git history) I wonder if that means it's not actually getting launched. None of the promises a few lines up even seem to be running, since I'm not seeing any of the log data that should happen beforehand (for instance, util.path) occur either. Or maybe not, it's always tricky to jump into a new codebase and figure out what's supposed to occur.

root@b297e8fbd510:/usr/src/app# DEBUG=* $(yarn bin)/cypress run --browser chrome
  cypress:cli cli starts with arguments ["/usr/local/bin/node","/usr/src/app/node_modules/.bin/cypress","run","--browser","chrome"] +0ms
  cypress:cli program parsing arguments +3ms
  cypress:cli running Cypress +2ms
  cypress:cli parsed cli options { browser: 'chrome' } +156ms
  cypress:cli verifying Cypress app +2ms
  cypress:cli path to info.json file /usr/src/app/node_modules/cypress/dist/info.json +1ms
  cypress:cli { version: '1.1.2', verifiedVersion: '1.1.2' } +4ms
  cypress:cli installed version is 1.1.2 comparing to 1.1.2 +1ms
  cypress:cli checking if executable exists /usr/src/app/node_modules/cypress/dist/Cypress/Cypress +0ms
  cypress:cli path to info.json file /usr/src/app/node_modules/cypress/dist/info.json +1ms
  cypress:cli has verified version 1.1.2 +1ms
  cypress:cli run verification check? false +0ms
  cypress:cli processing run options +0ms
  cypress:cli --key is not set, looking up environment variable CYPRESS_RECORD_KEY +1ms
  cypress:cli run to spawn.start args ["--run-project","/usr/src/app","--browser","chrome"] +0ms
  cypress:cli needs XVFB? true +0ms
  cypress:cli Starting XVFB +0ms
  cypress:cli spawning Cypress /usr/src/app/node_modules/cypress/dist/Cypress/Cypress +16ms
  cypress:cli spawn args ["--run-project","/usr/src/app","--browser","chrome"] +0ms
Warning: Cypress can only record videos when using the built in 'electron' browser.

You have set the browser to: 'chrome'

A video will not be recorded when using this browser.
  (Tests Starting)

Timed out waiting for the browser to connect. Retrying...

Timed out waiting for the browser to connect. Retrying again...

The browser never connected. Something is wrong. The tests cannot run. Aborting...

  (Tests Finished)

  - Tests:           0
  - Passes:          0
  - Failures:        1
  - Pending:         0
  - Duration:        0 seconds
  - Screenshots:     0
  - Video Recorded:  false
  - Cypress Version: 1.1.2


  (All Done)

  cypress:cli Stopping XVFB +2m

from cypress-docker-images.

brian-mann avatar brian-mann commented on July 20, 2024

@arsduo appreciate your detailed debugging analysis.

There are actually two problems in play here:

  1. that we are not printing all the debugging logs to stdout. Already an open issue here: cypress-io/cypress#921
  2. that the browser is not being connected to. We can actually repro locally (with a docker container) but haven't spent the time to investigate why. in Circle, buildkite, appveyor it always works. Locally without docker it always works. Something about the docker when running locally (likely in a less performant file system mode) is when it appears

from cypress-docker-images.

arsduo avatar arsduo commented on July 20, 2024

Thanks for the response! That's good to know. FWIW this is actually happening in Docker on Circle CI 2.0 -- we're building the client in a container so that it can interact with a container hosting the server. If there's any additional info I can give you, just let me know.

from cypress-docker-images.

cameronc56 avatar cameronc56 commented on July 20, 2024

Thanks for the response, I just ran into this issue.

from cypress-docker-images.

cameronc56 avatar cameronc56 commented on July 20, 2024

I'm able to repro this both locally and on Jenkins CI.

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

from cypress-docker-images.

Graham42 avatar Graham42 commented on July 20, 2024

If you're on a linux machine you should be able to mount the x11 socket to display the window on the host.
docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY ...

from cypress-docker-images.

brian-mann avatar brian-mann commented on July 20, 2024

We are all on OSX

from cypress-docker-images.

cameronc56 avatar cameronc56 commented on July 20, 2024

Using the above docker run -v options, with -it, and --shm-size=2g, here is some more info on what I am experiencing:

./chrome.sh found here works fine, chrome opens and is fully functional, though i do get the "make google chrome the default browser" window before the real browser opens. I disabled it by adding --no-default-browser-check to chrome.sh but that doesn't fix the timing out issue

cypress run: Timed out waiting for the browser to connect. Retrying...

cypress open: the client opens
attempting to run a test with chrome 62 here fails - no error log to the console, the "chrome 62" text just switches to "opening" and then immediately back to chrome 62.

from cypress-docker-images.

cameronc56 avatar cameronc56 commented on July 20, 2024

If anyone has any other ideas on how I can debug this I'd love to hear it. I'm not sure where to go from here

from cypress-docker-images.

brian-mann avatar brian-mann commented on July 20, 2024

@bahmutov has been working on this, we'll probably have an update tomorrow or later in the week.

from cypress-docker-images.

arsduo avatar arsduo commented on July 20, 2024

from cypress-docker-images.

brian-mann avatar brian-mann commented on July 20, 2024

@bahmutov spent a couple hours tracking this down and should have fixes out for 1.1.4 - it was a combination of issues that should all get resolved.

from cypress-docker-images.

arsduo avatar arsduo commented on July 20, 2024

from cypress-docker-images.

cameronc56 avatar cameronc56 commented on July 20, 2024

@bahmutov Thanks so much!!!!

from cypress-docker-images.

brian-mann avatar brian-mann commented on July 20, 2024

Released in 1.1.4.

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

I just tested [email protected] with latest built Docker image cypress/browsers:chrome63 using project cypress-test-tiny to confirm

Here is the raw output from the terminal (Docker on Mac)

$ docker run -v $PWD:/src -w /src -it cypress/browsers:chrome63 /bin/bash
Unable to find image 'cypress/browsers:chrome63' locally
chrome63: Pulling from cypress/browsers
ad74af05f5a2: Already exists 
2b032b8bbe8b: Already exists 
a9a5b35f6ead: Already exists 
3245b5a1c52c: Pull complete 
afa075743392: Pull complete 
9fb9f21641cd: Pull complete 
0ad7b4ea7d88: Pull complete 
734822eca0d5: Pull complete 
834c5d960979: Pull complete 
f97dc2eb9d1b: Pull complete 
3700ff49740e: Pull complete 
3b1bed89e293: Pull complete 
Digest: sha256:191e1fdaa50a08f95b0fe728ea0037b291b32944ba5fa7ced4f68fb36ca38238
Status: Downloaded newer image for cypress/browsers:chrome63
root@d301e13ff9a6:/src# whoami
root
root@d301e13ff9a6:/src# $(npm bin)/cypress version
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info ok 
Cypress package version: 1.1.4
Cypress binary version: 1.1.4
root@d301e13ff9a6:/src# $(npm bin)/cypress run --browser chrome
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info ok 
Warning: Cypress can only record videos when using the built in 'electron' browser.

You have set the browser to: 'chrome'

A video will not be recorded when using this browser.
  (Tests Starting)


  page
    ✓ works


  1 passing (120ms)


  (Tests Finished)

  - Tests:           1
  - Passes:          1
  - Failures:        0
  - Pending:         0
  - Duration:        0 seconds
  - Screenshots:     0
  - Video Recorded:  false
  - Cypress Version: 1.1.4


  (All Done)

root@d301e13ff9a6:/src# google-chrome --version
Google Chrome 63.0.3239.84 
root@d301e13ff9a6:/src# node node_modules/cypress/dist/Cypress/resources/app/packages/launcher/index.js 
Launcher project exports
{ [Function: init]
  update: [Function: update],
  detect: [Function: detectBrowsers] }
⛔️ please use it as a module, not from CLI
detected 1 browser
[ { name: 'chrome',
    displayName: 'Chrome',
    version: '63.0.3239.84',
    path: 'google-chrome',
    majorVersion: '63' } ]

from cypress-docker-images.

bahmutov avatar bahmutov commented on July 20, 2024

Example runs on CircleCI:

from cypress-docker-images.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.