Cypress: Cypress with Heroku CI

Created on 8 Jul 2019  路  13Comments  路  Source: cypress-io/cypress

We are using Heroku CI and try to run cypress with it. I have followed several issues and repos and use the following app.json config:

{
  "stack": "cedar-14",
  "formation": {
    "web": {
      "quantity": 1,
      "size": "performance-l"
    }
  },
  "environments": {
    "test": {
      "buildpacks": [
        { "url": "heroku/nodejs" },
        {
          "url": "https://github.com/heroku/heroku-buildpack-xvfb-google-chrome"
        }
      ],
      "scripts": {
        "test-setup": "cd client && npm i",
        "test": "cd client && npm run test"
      },
      "formation": {
        "test": {
          "quantity": 1,
          "size": "performance-l"
        }
      }
    }
  }
}

And this is the output from Heroku:
image

I tried many things for hours with no luck.

heroku

Most helpful comment

@ArielGueta Did you ever resolve this? I am trying to use the heroku-buildpack-apt buildpack as well to install cypress dependencies. xvfb will install but none of the other cypress dependencies' packages can be located. I get an error usually like 'libXcomposite' cannot be found. I have tried to explicitly install this package and have tried to install all packages via direct url without success. This seems more like a Heroku issue but since you are the only one I have found asking about this online I figured I would see if you resolved this

All 13 comments

Can you try using older versions of Cypress? We are running cypress-example-kitchensink on Heroku CI using this settings file https://github.com/cypress-io/cypress-example-kitchensink/blob/master/app.json without any problems

Downgraded to v3.1.5 and still the same error:

/app/.cache/Cypress/3.1.5/Cypress/Cypress: error while loading shared libraries: libpng16.so.16: cannot open shared object file: No such file or directory

I've seen a similar error in a different context, see if this SO Thread helps shed some light on the issue

I got a response from the Heroku team:

That sounds like the apt buildpack is installing libgtk-3.so.0 into a directory that Cypress does not expect it to be, you may have to make changes to your PATH or some other environment variable to enable Cypress to find the library.

Do you have any idea?

Cedar 14 is based on Ubuntu 14.04. You'll need to install all the required dependencies using apt before Cypress can work. An up-to-date list can be found here: https://docs.cypress.io/guides/guides/continuous-integration.html#Dependencies

If some of these dependencies are not available on your system, you'll need to look up the exact package names of the library you need to install it. Sadly, Ubuntu just removed Trusty Tahr from their package search in April, so you can't use packages.ubuntu.com to do this anymore. If you have difficulty installing those packages you should probably just move to a newer buildpack, since Cedar 14 is being deprecated anyways.

Thanks, we will try to use this https://github.com/heroku/heroku-buildpack-apt to add the dependencies. I will let you know.

After installed the required dependencies you mentioned, I get the following error:

(Cypress:2180): Gtk-WARNING **: 05:32:30.944: cannot open display: :99

Also, I鈥檓 not using Cedar 14 stack.

@ArielGueta Is this error failing the build? Could you run Cypress in debug mode mode and print the logs here?

2019-07-15T08:43:52.848Z cypress:cli cli starts with arguments ["/app/.heroku/node/bin/node","/app/client/node_modules/.bin/cypress","run"]
2019-07-15T08:43:52.851Z cypress:cli NODE_OPTIONS is not set
2019-07-15T08:43:52.851Z cypress:cli program parsing arguments
2019-07-15T08:43:52.852Z cypress:cli running Cypress
2019-07-15T08:43:52.937Z cypress:cli parsed cli options {}
2019-07-15T08:43:52.939Z cypress:cli verifying Cypress app
2019-07-15T08:43:52.940Z cypress:cli checking environment variables
2019-07-15T08:43:52.964Z cypress:cli checking if executable exists /app/.cache/Cypress/3.3.2/Cypress/Cypress
2019-07-15T08:43:52.968Z cypress:cli Binary is executable? : true
2019-07-15T08:43:52.968Z cypress:cli binaryDir is  /app/.cache/Cypress/3.3.2/Cypress
2019-07-15T08:43:52.969Z cypress:cli Reading binary package.json from: /app/.cache/Cypress/3.3.2/Cypress/resources/app/package.json
2019-07-15T08:43:52.973Z cypress:cli Found binary version 3.3.2 installed in: /app/.cache/Cypress/3.3.2/Cypress
2019-07-15T08:43:52.975Z cypress:cli could not read binary_state.json file
2019-07-15T08:43:52.975Z cypress:cli {}
2019-07-15T08:43:52.975Z cypress:cli is Verified ? undefined
2019-07-15T08:43:52.976Z cypress:cli running binary verification check 3.3.2
It looks like this is your first time using Cypress: 3.3.2
[?25l[08:43:52]  Verifying Cypress can run /app/.cache/Cypress/3.3.2/Cypress [started]
2019-07-15T08:43:52.984Z cypress:cli clearing out the verified version
2019-07-15T08:43:52.987Z cypress:cli undefined DISPLAY environment variable
2019-07-15T08:43:52.987Z cypress:cli Cypress will spawn its own Xvfb
2019-07-15T08:43:52.987Z cypress:cli needs Xvfb? true
2019-07-15T08:43:52.987Z cypress:cli Starting Xvfb
2019-07-15T08:43:53.005Z cypress:xvfb _XSERVTransmkdir: ERROR: euid != 0,directory /tmp/.X11-unix will not be created.
2019-07-15T08:43:53.012Z cypress:cli running smoke test
2019-07-15T08:43:53.012Z cypress:cli using Cypress executable /app/.cache/Cypress/3.3.2/Cypress/Cypress
2019-07-15T08:43:53.012Z cypress:cli smoke test command: /app/.cache/Cypress/3.3.2/Cypress/Cypress --smoke-test --ping=919
2019-07-15T08:43:53.089Z cypress:xvfb XKB: Failed to compile keymap
Keyboard initialization failed. This could be a missing or incorrect setup of xkeyboard-config.
(EE) 
Fatal server error:
(EE) Failed to activate virtual core keyboard: 2(EE) 
2019-07-15T08:43:53.100Z cypress:cli Smoke test failed: { Error: Command failed: /app/.cache/Cypress/3.3.2/Cypress/Cypress --smoke-test --ping=919
(Cypress:2329): Gtk-WARNING **: 08:43:53.089: cannot open display: :99
    at makeError (/app/client/node_modules/cypress/node_modules/execa/index.js:172:9)
    at Promise.all.then.arr (/app/client/node_modules/cypress/node_modules/execa/index.js:277:16)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)
  code: 1,
  stdout: '',
  stderr: '\n(Cypress:2329): Gtk-WARNING **: 08:43:53.089: cannot open display: :99\n',
  failed: true,
  signal: null,
  cmd: '/app/.cache/Cypress/3.3.2/Cypress/Cypress --smoke-test --ping=919',
  timedOut: false,
  killed: false }
2019-07-15T08:43:53.102Z cypress:cli error message: 
(Cypress:2329): Gtk-WARNING **: 08:43:53.089: cannot open display: :99
2019-07-15T08:43:53.109Z cypress:cli Stopping Xvfb
[08:43:53]  Verifying Cypress can run /app/.cache/Cypress/3.3.2/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.
----------
(Cypress:2329): Gtk-WARNING **: 08:43:53.089: cannot open display: :99
----------

@ArielGueta Your original post mentions that you're using the cedar-14 stack, can you share your updated Heroku config that has all the dependencies added? I'll take a look and see if I can find what's missing.

{
  "formation": {
    "web": {
      "quantity": 1,
      "size": "performance-l"
    }
  },
  "environments": {
    "test": {
      "buildpacks": [
        { "url": "heroku/nodejs" },
        {
          "url": "https://github.com/heroku/heroku-buildpack-apt"
        }
      ],
      "scripts": {
        "test-setup": "cd client && npm i",
        "test": "cd client && npm run test"
      },
      "formation": {
        "test": {
          "quantity": 1,
          "size": "performance-l"
        }
      }
    }
  }
}
// Aptfile
xvfb
libgtk2.0-0
libnotify-dev
libgconf-2-4
libnss3
libxss1
libasound2

And the command is:
"e2e:ci": "cross-env CYPRESS_baseUrl=ourDomain DEBUG=cypress:* cypress run"

@ArielGueta Did you ever resolve this? I am trying to use the heroku-buildpack-apt buildpack as well to install cypress dependencies. xvfb will install but none of the other cypress dependencies' packages can be located. I get an error usually like 'libXcomposite' cannot be found. I have tried to explicitly install this package and have tried to install all packages via direct url without success. This seems more like a Heroku issue but since you are the only one I have found asking about this online I figured I would see if you resolved this

Was this page helpful?
0 / 5 - 0 ratings