Testcafe-hammerhead: Tests sometimes (frequently) lose connection

Created on 13 Jun 2018  路  21Comments  路  Source: DevExpress/testcafe-hammerhead

Sometimes when I launch tests, the tests suddenly stops; I get this error message when I look at the console.

It doesn't matter what browser I use. I am on MacOS

```
.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20
throw new Error(err);
^

Error: Error: write EPIPE
at Domain. (.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20:15)
at Domain.emit (events.js:182:13)
at Domain.EventEmitter.emit (domain.js:442:20)
at Domain._errorHandler (domain.js:224:23)
at Object.setUncaughtExceptionCaptureCallback (domain.js:140:29)
at process._fatalException (internal/bootstrap/node.js:447:31)```

Auto-locked bug

Most helpful comment

@NickCis The fix is published in 0.22.1-alpha.3.

All 21 comments

Hi @ryuuji3

It's difficult to understand the reason of problem by provided your information.
Please provide more details for us:

  • MacOS version
  • nodejs version
  • a test (or test suite) on which the problem is reproduced

Sorry for the late reply,
MacOS: High Sierra 10.13.1 (17B1003)
Chrome: 67.0.3396.79 (Official Build) (64-bit)
NodeJS: v10.4.1
Sample test:

Command: testcafe chrome tests/

fixture`Login and Registration`.page(`example.com`)

test('Sign up', async t => {
  await t
  .click(home.registerButton)
  .typeText(register.firstName, 'firstname')
  .typeText(register.lastName, 'lastName')
  .typeText(register.email1, 'email')
  .typeText(register.email2, 'email')
  .typeText(register.password1, 'password')
  .typeText(register.password2, 'password')
  .click(register.signupButton)
  .wait(5000)
})

At any time during the test, I might suddenly lose connection and the test stops. This happened on Safari and Chrome. I would see the typing pause, and then when I look at my open terminal, I would see the error message. Restarting the test may or may not solve the problem, until it happens again.

I'm having the exact same issue:

Mac OS X 10.13.5
Chrome: 67.0.3396.87 (Official Build) (64-bit)
Node: v10.1.0

issue:
Error: Error: write EPIPE
at Domain. (.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20:15)
at Domain.emit (events.js:182:13)
at Domain.EventEmitter.emit (domain.js:442:20)
at Domain._errorHandler (domain.js:224:23)
at Object.setUncaughtExceptionCaptureCallback (domain.js:140:29)
at process._fatalException (internal/bootstrap/node.js:435:31)

Same.

Mac OS X 10.13.4
Chrome 67.0.3396.99 (Official Build) (64-bit)
Node v10.3.0

Error: Error: write EPIPE
    at Domain.<anonymous> (.../node_modules/testcafe-hammerhead/lib/request-pipeline/connection-reset-guard.js:20:15)
    at Domain.emit (events.js:182:13)
    at Domain.EventEmitter.emit (domain.js:442:20)
    at Domain._errorHandler (domain.js:224:23)
    at Object.setUncaughtExceptionCaptureCallback (domain.js:140:29)
    at process._fatalException (internal/bootstrap/node.js:447:31)
error Command failed with exit code 7.

Hi guys,

I tried running a simple test with authentication on GitHub 20 times and I cannot reproduce this error. Could you please create a simple example and test so that I could reproduce the issue. Or you can mail me the URL of the page I could use to reproduce this error (find my email in GitHub account settings).

Mac OS X 10.13.3
Chrome 67.0.3396.99 (Official Build) (64-bit)
Node v10.5.0

The error is not 100% reproducible, it happens randomly but frequently, I would say for me happens around 40% of the times, when the page is under heavy load appears to have a frequency increase. However I haven't been able to reproduce it on safari nor firefox yet.

I'm experiencing this as well, was working fine with testcafe v0.18, it started when I upgraded to testcafe v0.20.4

If I run it inside my docker env it runs fine. On my host I get this error 100% of the time.

On my docker I have node v8.7.0 and yarn v1.2.0. On my host node v10.4.1 and yarn v1.7.0

Guys, it all indicates that the problem exists.
To find the cause of this issue and fix it, we need a simple example.
So, we are looking forward to receiving a project where this problem is reproducible.

I'm going to quickly write a example project right now, but if anyone beats me to the punch, I won't be mad.

Edit: I have a test for work that already is written, but I prefer not to post it. I can send you the project in a DM? @miherlosev

Edit 2: I have suspicions what may be causing the problem.
I am receiving an instance of TestController which I pass to a constructor and store as a class property. I use that to carry out the tests in a modular way (ie. test.login(username, password)) but maybe that's why I'm losing connection?

I have a class like this:

class SignupTest {
  constructor(private t: TestController) { }

  register() {
    await this.t // everything in the function uses the instance of t
  }

And in my actual test:

test('Register, async t => {
  const model = new SignupTest(t)
  model.register(profile)
  model.login(profile.username, profile.password)
})

Does this look something similar to the tests you guys wrote, as well?

Edit 2: I have suspicions what may be causing the problem.
I am receiving an instance of TestController which I pass to a constructor and store as a class property. I use that to carry out the tests in a modular way (ie. test.login(username, password)) but maybe that's why I'm losing connection?

I'm not doing this, but I use the Role api everywhere and it always crashes on the first time a t.useRole is called... I don't know how it works internally but the TestController seems to be passed around... It might store a reference under the hoods?

Edit: I have a test for work that already is written, but I prefer not to post it. I can send you the project in a DM? @miherlosev

Could you please send me your project to mikhail.[email protected]?

Edit 2: I have suspicions what may be causing the problem.
I am receiving an instance of TestController which I pass to a constructor and store as a class property. I use that to carry out the tests in a modular way (ie. test.login(username, password)) but maybe that's why I'm losing connection?

Your code looks good. Also, your can import TestController directly from TestCafe and use it in your page object classes.
Example:

import { t } from 'testcafe';

class SignupTest {
  register() {
    ...
    await t.click('#submit');
  }

We just ran into this issue and found the solution. It turned out to be a mis-match between the node version and the testcafe version. We ended up downgrading node (to 9.2.1) to match with our older version of testcafe (0.19.2).

@vladimirdrndarski @sirgallifrey @cmmv91 @SleepyWerewolf @ryuuji3

Guys, according to you descriptions, I can assume that the problem is related to the built-in modules (http and https) of Nodejs.
I am afraid only a small and reproducible example can help us to understand and fix this problem.

We need to fix it behavior for Linux too.

@LavrovArtem In what release will land your fix?

@NickCis The fix is published in 0.22.1-alpha.3.

Hi, We probably have the same issue, but we're using the testcafe/testcafe docker image from Dockerhub to run our builds in Bitbucket pipelines.

If I use the :alpha tag, i'm getting 0.22.1-alpha.1. Is there a reason why you're not pushing proper versions to dockerhub besides "latest", "alpha" and "dev"? Or why you're not consistently pushing all alpha builds to docker?

Hi @DerMika

Is there a reason why you're not pushing proper versions to dockerhub besides "latest", "alpha" and "dev"?

At present, we do not publish dev versions anymore. So, the image with the dev tag is not actual. I will remove it later.

Or why you're not consistently pushing all alpha builds to docker?

This is a bug. I will research it and let you know my results.

This is a bug. I will research it and let you know my results.

Thanks for that!

I was also wondering why you aren't pushing version tags for specific releases of Testcaf茅. That would make it easier for us at least to tag a specific version and get reliable results. Right now I'm running 0.20.0 although I am using "latest". This is because I never deleted my local image of when docker first downloaded the "latest" tag, docker will never fetch a newer version because it thinks it still has the correct version locally.

We have an enhancement for that in the TestCafe repository. Track this issue to be aware of our progress.

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings