Skip to content

Fix browser restart for BrowserStack #5238

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

Closed
AndreyBelym opened this issue Jun 22, 2020 · 9 comments
Closed

Fix browser restart for BrowserStack #5238

AndreyBelym opened this issue Jun 22, 2020 · 9 comments
Assignees
Labels
AREA: server SYSTEM: browser connection TYPE: bug The described behavior is considered as wrong (bug).
Milestone

Comments

@AndreyBelym
Copy link
Contributor

AndreyBelym commented Jun 22, 2020

TestCafe cannot restart browsers on BrowserStack when heartbeat is lost.

@AndreyBelym AndreyBelym added TYPE: bug The described behavior is considered as wrong (bug). AREA: server SYSTEM: browser connection labels Jun 22, 2020
@AndreyBelym AndreyBelym added this to the Sprint #59 milestone Jun 23, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #59, Sprint #60 Jul 8, 2020
AndreyBelym added a commit to AndreyBelym/testcafe that referenced this issue Jul 17, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #60, Sprint #61 Jul 23, 2020
@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Jul 24, 2020
@AlexSkorkin AlexSkorkin removed the STATE: Need response An issue that requires a response or attention from the team. label Jul 24, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #61, Sprint #62 Aug 5, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #62, Sprint #63 Aug 17, 2020
AndreyBelym added a commit to AndreyBelym/testcafe that referenced this issue Aug 24, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #63, Sprint #64 Sep 2, 2020
@AndreyBelym AndreyBelym self-assigned this Sep 3, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #64, Sprint #65 Sep 14, 2020
@rob4629
Copy link
Contributor

rob4629 commented Sep 14, 2020

I would love for this to be done in the near future. We're constantly having our overnight regression tests stop due to a loss of connection with BS... and it's just creates a delay in investigating whether a bug has been introduced.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Sep 14, 2020
@AndreyBelym AndreyBelym removed the STATE: Need response An issue that requires a response or attention from the team. label Sep 15, 2020
@AlexKamaev AlexKamaev modified the milestones: Sprint #65, Sprint #66 Sep 28, 2020
@AlexKamaev AlexKamaev modified the milestones: Sprint #66, Sprint #67 Oct 13, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #67, Sprint #68 Oct 27, 2020
@AlexKamaev AlexKamaev modified the milestones: Sprint #68, Sprint #69 Nov 11, 2020
@AlexKamaev
Copy link
Contributor

@rob4629
I would like to research this issue. However, the cause of the initial issue can be different from that of the issue you reported. Could you please share your test or help me reproduce it? I checked some tests that emulate disconnections on BrowserStack, but every time the browser was restarted successfully.

@rob4629
Copy link
Contributor

rob4629 commented Nov 19, 2020

I haven't managed to consistently reproduce this error, but we do still see it (albeit, we're still on v1.9.0). I'll run some tests on the latest version, and get back to you.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 19, 2020
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 20, 2020
@rob4629
Copy link
Contributor

rob4629 commented Nov 20, 2020

I've upgraded to the latest version (1.9.4), and will be running our suite over the weekend. So far, the testing I have done hasn't reproduced the issue, but I should have more confidence Monday morning (PST).

UPDATE:
I'll find the test which caused the failure, and see if I can replicate. I'll then share the steps with you.

ERROR The Internet Explorer 11.0 / Windows 10 (https://automate.browserstack.com/builds/4b5b1b031c44402913826a4f56aa6a5127db5ccf/sessions/fcb6aa4e78482b74ec51e30146fa2a699b3e81ff) browser disconnected. This problem may appear when a browser hangs or is closed, or due to network issues.

Type "testcafe -h" for help.
npm ERR! Test failed.  See above for more details.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 20, 2020
@AlexKamaev
Copy link
Contributor

@rob4629 Thank you for your input. I prepared a draft pull request with the fix of the initial issue. You can see the details at #5731

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 23, 2020
@rob4629
Copy link
Contributor

rob4629 commented Nov 23, 2020

Sounds good, I'll check out your PR this morning (PST), and let you know 🕵🏻‍♂️ .

Thanks Alex!

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 23, 2020
@rob4629
Copy link
Contributor

rob4629 commented Nov 23, 2020

UPDATE:
I'm still seeing this error/disconnect occur, during a BrowserStack run. The actual failing test changes between runs, so I'll give an overview of my test scenario:

Setup
Browser: Opera
Max BrowserStack (concurrent) Instances: 5
Command: testcafe 'browserstack:opera' -c 5 -q

I've noticed that the error might be related to BS, failing to load the page. The last successful session ended midway through an assertion... then failed to re-connect:
image
image

I'm not really sure what TestCafe should do in this instance... it seems like this happened in all 5 active instances:
image

@AlexKamaev
Copy link
Contributor

@rob4629 Thank you for the additional information. It looks like your issue is not related to the restarting mechanism. We will research your case as well. It seems that your issue may be related to BrowserStack, not TestCafe.

Look at the following article: https://github.com/DevExpress/testcafe-browser-provider-browserstack#usage :

If you have troubles starting multiple browsers at once, or get browserstack-local related errors like #27, try setting the BROWSERSTACK_PARALLEL_RUNS environment variable to the number of browsers you want to run simultaneously, or to 1 if you want to run just one browser.

Also, you can run BrowserStackLocal itself as described in the User managed tunnel connection section of this article: https://www.browserstack.com/docs/automate/selenium/getting-started/nodejs/testcafe#set-up-the-browserstacklocal-connection article.

You need to start BrowserStackLocal with the following command:

BrowserStackLocal --key your_key --local-identifier TestCafeIdentifier --daemon start --logFile logs.txt

Before you run TestCafe, you need to set the BROWSERSTACK_LOCAL_IDENTIFIER environment variable to TestCafeIdentifier as in the previous command.

Then, please run your tests on BrowserStack and check the logs.txt file to see if it has any errors.

@need-response-app need-response-app bot removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 24, 2020
@rob4629
Copy link
Contributor

rob4629 commented Nov 24, 2020

It looks like your issue is not related to the restarting mechanism.

I'm of a similar opinion. Thanks for the additional info. I raised a ticket with BS yesterday, but I'll try your suggestions today, and get back to you.

@need-response-app need-response-app bot added the STATE: Need response An issue that requires a response or attention from the team. label Nov 24, 2020
AlexKamaev pushed a commit to AlexKamaev/testcafe that referenced this issue Nov 24, 2020
@AlexKamaev AlexKamaev removed the STATE: Need response An issue that requires a response or attention from the team. label Nov 25, 2020
@AndreyBelym AndreyBelym modified the milestones: Sprint #69, Sprint #70 Nov 25, 2020
AlexKamaev pushed a commit to AlexKamaev/testcafe that referenced this issue Nov 29, 2020
miherlosev pushed a commit that referenced this issue Dec 16, 2020
…#5239) (#5738)

* Add service worker & fix browser restart

Closes #5238. Closes #5239.

* test no await

* test no sw in driver

* retry test pages disable

* Try another

* Safari only

* Mojave

* Clean cache on Azure

* Update azure-pipelines.yml

* Update azure-pipelines.yml

* Catalina

* Catalina

* add tests

* refactoring

* fix

* not headless

* restore config

* head => headless

* Try to avoid out-of-memory errors

* remove redundant config settings

* routes to separate config

Co-authored-by: Andrey Belym <belym.a.2105@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AREA: server SYSTEM: browser connection TYPE: bug The described behavior is considered as wrong (bug).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants