testcafe: Restart browser if it became unresponsive

Are you requesting a feature or reporting a bug?

Feature

What is the current behavior?

When browser becomes unresponsive (XXX browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.) we stop all running tests.

What is the expected behavior?

Unresponsive browser can be closed, and a new browser instance can be started on the next or even the same test (e.g. if quarantine mode is enabled).

How would you reproduce the current behavior (if this is a bug)?

???

Specify your

  • testcafe version: 0.17.2
  • node.js version: any

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 41
  • Comments: 33 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Hi,

Thanks for your interest. This issue is in our plans to the one of the next releases.

Hi @sijosyn, we plan to implement this feature in next sprint (0.21.0 version). We’ll let you know when the dev build will become available.

How hard would it be to add something along the lines of test.skipOnDisconnect() (or any other method of tagging the test with specific instructions for the runner how to handle the test – maybe in meta like test.meta({skipOnDisconnect: true})?), which upon browser disconnect would normally restart browser, and continue from the next test? Where should I start looking if I’d like to create a PR for it?

We’re not using TestCafe for stress-testing, but still our e2e tests hang with “browser disconnected” message every now and then, which makes them very unstable. We’re almost considering dropping TestCafe because of this single issue, cause it was very annoying throughout last year. We’re managing some sophisticated “restarting scripts” right now to mitigate that, but that increases our e2e run time by 2 / 3 times (cause restart restarts ALL tests).

I want to add another example why this function is needed.

The example contains testing 3D graphics on mobile devices. Not all mobile devices can load complex 3d graphics.

This is a simplified test to make it easy to reproduce:

npm install testcafe-browser-provider-android

test.js

import { Selector } from 'testcafe';

var examples = ['https://devexpress.github.io/testcafe/example/', 'https://xeokit.github.io/xeokit-sdk/examples/#sceneRepresentation_PerformanceModel_batching_benchmark', 'google.com'];

examples.forEach(example => {
   
    fixture `Test page: ${example}`
        .page (`${example}`);

    test('My test', async t => {
        const element     = Selector('#developer-name', {timeout:90000});
        const clientWidth = await element.clientWidth;
    });
});

A timeout is needed to wait until browser falls on the 3d.

npx testcafe android::52109133:chrome test.js

The browser cannot load the 3D model and the testcafe restarts this test after some time, and so on three times. After that, the testcafe completes its work with output:

ERROR The Chrome Mobile 76.0.3809 / Android 8.0.0 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.

In the example, several tests and I expected that after a failed test on one page, the tests will continue on the next. But no, this completely interrupts the work.

I use Samsung Galaxy A5 (2017) and webdriverio + appium as browser-provider. And I get the same issue on ios devices.

Hello, we have the same issue for Chrome and Firefox on CircleCI with Testcafe v.1.0.1, any updates on this issue? thanks

Hello! I’m also very need this feature: track the browser memory usage (only for IE) and restart the browser when it exceeds this limit Thanks!

Annoying issue. Any ETA here? 😃 0.18.5 still has it