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

Cypress unexpectedly hangs when running tests on Codeship CI #1890

Closed
rufushonour opened this issue Jun 6, 2018 · 9 comments
Closed

Cypress unexpectedly hangs when running tests on Codeship CI #1890

rufushonour opened this issue Jun 6, 2018 · 9 comments
Milestone

Comments

@rufushonour
Copy link

Current behavior:

We have parallel tests running a suite of specs on Codeship Pro, completely dockerised setup. One container running our app, one the database and one cypress for each parallel run.

In the last month or so, we've been seeing our CI hang randomly on different specs. They can fail on one build and pass after being restarted.

I have no errors in the logs.

The behaviour is very weird. It will run an random number of specs and then stop dead. On each run, its a different spec file that decides to hang. I have set DEBUG to cypress:* but when it hangs, I just get messages about waiting for an event.

Everything works fine running on my dev machine.

Any ideas to what could be causing it?

Desired behavior:

All tests run and output correctly, fail/pass

Steps to reproduce:

Not sure how to reproduce as completely random.

Versions

Cypress 3.0.1
Docker on Codeship

@brandonb927
Copy link

I normally don't do this, but +1 here.

Since upgrading to Cypress v3.0.1 we've also been seeing random hangs on Jenkins builds that run our Cypress tests in headless mode. It is intermittent and we're not sure how to reproduce as it will hang the build on different specs while running.

@jennifer-shehane
Copy link
Member

Could you paste the error message/exit message from one of these previously failing runs?

@jennifer-shehane jennifer-shehane added the stage: needs information Not enough info to reproduce the issue label Jun 6, 2018
@rufushonour
Copy link
Author

rufushonour commented Jun 6, 2018

@jennifer-shehane the problem is, the build hangs and codeship kills it so the last piece of information is the spec name. There is no error message or exit message

Edit: I can set debug and give you the info from that if it will be useful?

@brandonb927
Copy link

brandonb927 commented Jun 6, 2018

This is the exact issue with our situation as well: there is no exit code and there is no error message, and the last message in STDOUT is the spec name.

Update 2: It seems like it's randomly happening on different specs now as a few builds since I posted have stalled on other specs.

Update: I found a pattern in our tests (it halts on the same spec file) and I'm no longer going to be commenting on this issue but will monitor it. If it is in-fact a problem I will open a new issue with more information.

@rufushonour
Copy link
Author

rufushonour commented Jun 7, 2018

I've just noticed that my issue seems to be related to CORS. However, I'm not really sure exactly whats going on or whats actually causing this. There seems to be a bug where cypress doesn't report that it failed and just gets stuck.

Thu, 07 Jun 2018 08:19:36 GMT cypress:server:reporter got mocha event 'fail' with args: [ { id: 'r3', title: 'completed project display a closed banner', err: { message: 'Script error.\n\nCypress detected that an uncaught error was thrown from a cross origin script.\n\nWe cannot provide you the stack trace, line number, or file where this error occurred.\n\nCheck your Developer Tools Console for the actual error - it should be printed there.\n\nIt\'s possible to enable debugging these scripts by adding the \'crossorigin\' attribute and setting a CORS header.\n\nhttps://on.cypress.io/cross-origin-script-error\n\nThis error originated from your application code, not from Cypress.\n\nWhen Cypress detects uncaught errors originating from your application it will automatically fail the current test.\n\nThis behavior is configurable, and you can choose to turn this off by listening to the \'uncaught:exception\' event.\n\nhttps://on.cypress.io/uncaught-exception-from-application', name: 'Uncaught Error', stack: 'Uncaught Error: Script error.\n\nCypress detected that an uncaught error was thrown from a cross origin script.\n\nWe cannot provide you the stack trace, line number, or file where this error occurred.\n\nCheck your Developer Tools Console for the actual error - it should be printed there.\n\nIt\'s possible to enable debugging these scripts by adding the \'crossorigin\' attribute and setting a CORS header.\n\nhttps://on.cypress.io/cross-origin-script-error\n\nThis error originated from your application code, not from Cypress.\n\nWhen Cypress detects uncaught errors originating from your application it will automatically fail the current test.\n\nThis behavior is configurable, and you can choose to turn this off by listening to the \'uncaught:exception\' event.\n\nhttps://on.cypress.io/uncaught-exception-from-application\n at createErrFromMsg (http://gaudi:3000/__cypress/runner/cypress_runner.js:61362:14)\n at Object.createUncaughtException (http://gaudi:3000/__cypress/runner/cypress_runner.js:61369:13)\n at Object.onUncaughtException (http://gaudi:3000/__cypress/runner/cypress_runner.js:63919:20)\n at onError (http://gaudi:3000/__cypress/runner/cypress_runner.js:63393:39)' }, state: 'failed', body: 'function (done) {\n production.newDesignFeedbackScenario(projects.COMPLETED_DESIGN_FEEDBACK_PROJECT).then(function (scenario) {\n var anon = scenario.newAnonymousUser();\n\n anon.seesProjectIsClosed().then(function () {\n return done();\n });\n });\n }', type: 'test', duration: 940, wallClockStartedAt: '2018-06-07T08:19:35.281Z', timings: { lifecycle: 65, 'before all': [Array], test: [Object] } } ]

Update: turned off uncaught exceptions and now the tests are failing correctly

@SanderMeester
Copy link

+1; same issue on TFS. It just hangs without any feedback about why. So the tests work fine on my local-machine, but since upgrading to 3.0.1 the cli hangs randomly on my build-server.

@neutcomp
Copy link

+1 totally agree with SanderMeester and rufushonour. Hope there will be an quick fix for this.

@gugahoi
Copy link

gugahoi commented Jun 12, 2018

We used to see the same thing in v2 but it seems like upgrading to v3 made it so that it hangs more often. Also running in CI with docker, cypress is actually running in the same container talking over localhost and yet it hangs every now and then. When things are good the steps take a little over 2 minutes so it should be pretty quick.

@brian-mann brian-mann added this to the 3.0.2 milestone Jun 25, 2018
brian-mann pushed a commit that referenced this issue Jun 25, 2018
@jennifer-shehane jennifer-shehane added stage: pending release and removed stage: needs information Not enough info to reproduce the issue stage: in progress stage: needs investigating Someone from Cypress needs to look at this stage: proposal 💡 No work has been done of this issue stage: needs review The PR code is done & tested, needs review stage: ready for work The issue is reproducible and in scope labels Jun 26, 2018
@brian-mann
Copy link
Member

Released in 3.0.2.

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

7 participants