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

Browser hangs / disconnects when running testcafe tests on docker #2194

Closed
neilmatillano opened this issue Mar 5, 2018 · 21 comments
Closed
Assignees

Comments

@neilmatillano
Copy link

neilmatillano commented Mar 5, 2018

Are you requesting a feature or reporting a bug?

Reporting a bug

What is the current behavior?

Testcafe crashes/disconnects to browser when clicking a link that loads or opens another page.
Or when the page is loading a list of elements.

ERROR The HeadlessChrome 63.0.3239 / Linux 0.0.0 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.

What is the expected behavior?

Continue test on that page

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

  1. create a trial account (pm me for details)
  2. Run a testcafe test on docker image using chromium.
  3. Test the Trial Period header link on top right and it will load a page where you will be directed with a plans page.
  4. Test page (normally the error on disconnect browser occurs after page is loaded)

Provide the test code and the tested page URL (if applicable)

Tested page URL:

Test code

Specify your

  • operating system: MAC OS X 10.13.3
  • testcafe version: 0.18.7-dev20180206
  • node.js version: 5.6.0
@neilmatillano
Copy link
Author

I recently upgraded the chromium version to Chrome 64.0.3282 and error still occurs

@neilmatillano neilmatillano changed the title Testcafe car Browser hangs / disconnects when running testcafe tests on docker Mar 5, 2018
@neilmatillano
Copy link
Author

Is there like a setting or debugger mode for testcafe that has additional logs that I can check after running to help me investigate this issue?

@ahnpnl
Copy link

ahnpnl commented Mar 7, 2018

I have the same issue when running on local Windows machine with Chrome 64.0.3282 on the TestCafe 0.19.0

@neilmatillano
Copy link
Author

Any update on this? I really am quite lost, I switch to other browsers but apparently, our platform doesnt fully support firefox or safari.. so I need to do tests on chrome.

Additional Info: This issue doesnt happen on firefox BUT one test suite fails around 90% of the total tests due to our support issue with firefox

@ameyagholkar
Copy link

We're also facing this issue intermittently on our CI machines. We're running Chrome beta.


2018-03-08T22:20:46.8490380Z Error: The HeadlessChrome 0.0.0 / Mac OS X 10.13.2 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.
2018-03-08T22:20:46.8523930Z     at Timeout.<anonymous> (/Users/agent/2.129.1/work/1/s/node_modules/testcafe/lib/browser/connection/index.js:225:34)
2018-03-08T22:20:46.8551560Z     at ontimeout (timers.js:386:11)
2018-03-08T22:20:46.8579960Z     at tryOnTimeout (timers.js:250:5)
2018-03-08T22:20:46.8606310Z     at Timer.listOnTimeout (timers.js:214:5)

@leojh
Copy link

leojh commented Mar 9, 2018

The same thing is happening to me using Firefox. Is this something just recently started happening? I just started looking into using TestCafe.

@miherlosev
Copy link
Collaborator

miherlosev commented Mar 16, 2018

The issue does not relate with docker or headless chrome.
It is the duplicate of the Add ability to perform testing in multiple browser windows issue.

The fact is that TestCafe opens browser windows created with window.open function call in the same window.
I've created a test with steps from issue description and run it using TestCafe.
The test opens the 'Login via Facebook' page in the same window instead of secondary browser window.
Respectively, 'Login via Facebook' window will not closed after login (see video).
To 'Login via Facebook' try to use workaround from DevExpress/testcafe-hammerhead#1428

@AhnpGit @leojh @ameyagholkar
Note that the error browser <browser-name> disconnected. ... can occur due to a variety of reasons.
It is necessary to investigate each case separately.

@leojh
Copy link

leojh commented Mar 16, 2018

@miherlosev what can you recommend to troubleshoot the browser <browser-name> disconnected. ... issue?

@miherlosev
Copy link
Collaborator

miherlosev commented Mar 19, 2018

I closed this issue because it is a duplicate.

@AhnpGit @ameyagholkar Please create separate issues and provide more details about your environment there.

@robhrt7
Copy link

robhrt7 commented Mar 19, 2018

Our test suite does not include multiple window test cases, but we also get browser disconnected errors running in Docker.

ERROR The HeadlessChrome 0.0.0 / Linux 0.0.0 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.

@miherlosev what can you recommend to troubleshoot the browser disconnected. ... issue?

The question about debugging still stands. What are the ways to debug this? cc @miherlosev

Note: We get this error in random order, after different tests, so I don't consider it related to specific test cases.

@miherlosev
Copy link
Collaborator

@operatino
Since that error occurred randomly, it indicates that it is not a docker related problem.
In the current development sprint, we have planned to implement video recording of test running. This feature should help you find the reason of the problem. We can publish an early dev release with the video recording feature.
Track #2151 to be notified about our progress.
 

@aphofstede
Copy link

Using @andrzej-kodify's video recorder plugin I was able to capture a screenshot, but it's just a white page. Note that it consistently halts after printing the first test name, stating:

ERROR The HeadlessChrome 71.0.3554 / Linux 0.0.0 browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.
Type "testcafe -h" for help.

It does not occur randomly.
Note: You can quickly set up a free test environment on https://buddy.works if you want to test out docker headless chrome issues.

@AndreyBelym
Copy link
Contributor

@aphofstede, this problem can be specific to the site and the Docker container. Could you please provide the Dockerfile for the container that runs problematic tests?

@meraj-ahmed
Copy link

I received a similar error after adding a .maximizeWindow() call to the test. Removing that was the only way to fix it in my case.

@aphofstede
Copy link

My problem turned out to be nginx configuration issues. ($<string>s being badly replaced by envsubst to be exact)

@ghost
Copy link

ghost commented Dec 26, 2018

@meraj-ahmed looks like that really helped our pipeline to become stable. So instead of using testcafe call, we just start chrome with command line params setting up the resolution

@gdoyer-oxv
Copy link

We had the same issue when testing in both Chromium and Firefox in the same docker container (as shown in the documentation both it seems to not be a good idea.
It also goes against docker best practice of 1 service per container.
Running the same tests in 2 different docker run commands (one for each browser) fixed this for us.

@suv37
Copy link

suv37 commented Mar 4, 2019

I am still experience this issue, can anyone provided the solution for this issue ?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 4, 2019
@AndreyBelym AndreyBelym removed the STATE: Need response An issue that requires a response or attention from the team. label Mar 4, 2019
@AndreyBelym AndreyBelym self-assigned this Mar 4, 2019
@miherlosev
Copy link
Collaborator

@neilmatillano

Try to specify the --no-sandbox flag for Chromium browser.

docker run -v //d/tests:/tests -it testcafe/testcafe 'chromium --no-sandbox,firefox' /tests/**/*.js

@mfestrada
Copy link

mfestrada commented Mar 7, 2019

@miherlosev I've been hitting my head against this issue as well and finally came across this thread. If I try only 'chromium --no-sandbox' it will hang with no timeout message, only after trying Firefox do I get the message This problem may appear when a browser hangs or is closed, or due to network issues..

Aside from debug();, is there anything I can do to determine if it's an issue with TestCafe or the page I'm testing?

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Mar 7, 2019
@miherlosev
Copy link
Collaborator

Hi @mfestrada
 
If tests hang with the --no-sandbox flag, it means there is a problem with TestCafe.
Please try to create a simple example to reproduce this problem so that I can run it on my machine.
I will lock this issue because other comments are not connected with the original problem.
 
@neilmatillano @ameyagholkar and others
If the problem still persists, try to do the followings:

  • update to the latest TestCafe version ([email protected])
  • specify the --no-sandbox and --shm-size flags (see the Using TestCafe Docker Image help topic)
     
    If it does not help you, please create separate tickets for each problem and provide all the necessary information.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Mar 7, 2019
@DevExpress DevExpress locked as off-topic and limited conversation to collaborators Mar 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests