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

Tests fails on Ubuntu 18.04 with browser set to chrome #4199

Closed
AlexChariyska opened this issue May 15, 2019 · 2 comments
Closed

Tests fails on Ubuntu 18.04 with browser set to chrome #4199

AlexChariyska opened this issue May 15, 2019 · 2 comments

Comments

@AlexChariyska
Copy link

AlexChariyska commented May 15, 2019

Current behavior:

Hi, when I run tests in Ubuntu with browser set to chrome the tests are failing with the following error:

The following error was thrown by a plugin. We've stopped running your tests because a plugin crashed.
Error [ERR_IPC_CHANNEL_CLOSED]: channel closed
    at ChildProcess.target.send (internal/child_process.js:584:16)
    at Object.send (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/util.js:34:27)
    at /home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/index.js:74:28
    at /home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/util.js:77:16
    at Promise.cancellationExecute [as _execute] (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/debuggability.js:321:9)
    at Promise._resolveFromExecutor (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:481:18)
    at new Promise (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/promise.js:77:14)
    at Object.wrapParentPromise (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/util.js:61:14)
    at Object.file:preprocessor (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/index.js:67:27)
    at Object.execute (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/index.js:115:38)
    at /home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/preprocessor.js:97:24
    at tryCatcher (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/node_modules/bluebird/js/release/method.js:39:29)
    at Object.getFile (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/plugins/preprocessor.js:96:63)
    at Socket.watchTestFileByPath (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/socket.js:88:27)
    at Socket.<anonymous> (/home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/server/lib/socket.js:224:19)
    at emitOne (events.js:115:13)
    at Socket.emit (events.js:210:7)
    at /home/ubuntu/.cache/Cypress/3.2.0/Cypress/resources/app/packages/socket/node_modules/socket.io/lib/socket.js:503:12
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

The same tests run without specified browser, pass correctly.
The command used is npm run cypress:run

Desired behavior:

The tests to pass without the error.

Steps to reproduce: (app code and test code)

cypress.json

{
  "viewportWidth": 1280,
  "viewportHeight": 800,
  "video": false,
  "reporter": "mochawesome",
  "reporterOptions": {
    "overwrite": false,
    "html": false,
    "json": true
  },
  "requestTimeout" : 30000,
  "numTestsKeptInMemory": 0,
  "responseTimeout" : 50000,
  "pageLoadTimeout": 100000,
  "env": {
    "updateSnapshots": false
  }
}

cypress/plugins/index.js

const { addMatchImageSnapshotPlugin } = require('cypress-image-snapshot/plugin');
const wp = require('@cypress/webpack-preprocessor');

module.exports = (on, config) => {
  const options = { webpackOptions: require('../webpack.config') };
  on('file:preprocessor', wp(options));
  addMatchImageSnapshotPlugin(on, config);
};

cypress/run.js

const cypress = require('cypress');
const fse = require('fs-extra');
const { merge } = require('mochawesome-merge');
const generator = require('mochawesome-report-generator');

async function runTests() {
  await fse.remove('mochawesome-report');
  const { totalFailed } = await cypress.run({
    spec: "cypress/integration/visual/**/*.spec.ts",
    browser: "chrome"
  });
  const jsonReport = await merge();
  await generator.create(jsonReport);
  process.exit(totalFailed);
}

runTests();

It happens for all tests no matter how big, the project uses TypeScript

Versions

Cypress: 3.2.0
Browser: Chrome
Ubuntu 18.04

@AlexChariyska AlexChariyska changed the title Tests fails on Ubuntu 18.0.4 with browser set to chrome Tests fails on Ubuntu 18.04 with browser set to chrome May 16, 2019
@ahmedkotb
Copy link

I had the same issue and our project uses typescript at well, turns out it was ts-loader. it can cause out of memory exception. the work around is to pass transpireOnly in the web pack config according to this: #2316 (comment)

they also updated the cypress example recipes project recently

https://github.com/cypress-io/cypress-example-recipes/blame/master/examples/preprocessors__typescript-webpack/webpack.config.js

@jennifer-shehane
Copy link
Member

Unfortunately we have to close this issue due to inactivity. Please comment if there is new information to provide concerning the original issue and we can reopen.

I would recommend trying the workaround as @ahmedkotb describes if you are using ts-loader though.

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

3 participants