-
Notifications
You must be signed in to change notification settings - Fork 73
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
Keep browser instance open #12
Comments
I think this is a limitation of Selenium itself. Reusing Selenium session is considered a bad practice :( Because of session failure case. |
Keeping the browser session open between features works perfectly with Nightwatch and Yadda. Take a look at https://github.com/kjelloe/Yadda-NightwatchJS. This also uses selenium with the chrome driver and works |
That's great news! thanks. I will try to fix this |
I checked the Yadda-NightwatchJS integration. I think it is not perfect because it is mapping all feature files into a single nightwatch test. This will give strange output from Nightwatch This implementation is mapping multiple feature files to multiple Nightwatch tests. That's why keeping browser instance open depends on a Nightwatch issue nightwatchjs/nightwatch#117 |
Wouldn't it be better to allow for this via a config setting? This could temporarily solve the issue for some people but won't necessarily be the most ideal fix. |
hey Igor. Any luck with that issue? |
Not yet :( But for speed up I suggest to try paralell test execution.
More details here |
Yeah i know about paralell test execution, but that's the only one blocker why we don't use this module. |
Igor, can you please give me an update on that. If you are not going to fix that in the near feature we are going to search any other solution instead of using your nightwatch + cucmber integration. |
I started to work on this. I can see two possible solutions for this:
For cucumber runner mode we can create an additional option to use single browser session like in https://github.com/kjelloe/Yadda-NightwatchJS What do you think? |
I think it's ok since we can use browser stack for parallel execution - right? |
Ok. I plan to fix it this week. |
if it quick fix - please add a check for now: if we execute the latest scenario from the current feature in this case close browser otherwise keep browser instance open |
because right now instances are opened and closed per every screnario in the feature. Is it expected? |
Yes because |
Sorry if it's not a correct place for the question, but I think it's somehow related. Is there a way to keep nightwatch always run? Something like "live" or "interactive" mode, where Nightwatch can re-run the tests without rerunning everything else (Selenium, browser). |
Hi! I am not sure I understand you correctly. Do you think about a REPL like executing |
No, sorry. Let me try to explain. In this thread you made it possible to not close the browser after every scenario. It's very cool, it speeds up the tests. And I want to go further, something like "watch" mode from unit tests frameworks, when they don't stop the process after running all tests but waits for files changes. In case of Nightwatch it means that it doesn't run Selenium and browser every time when I need to run the tests but keeps them opened. Does it make sense? |
The main problem for me is slow start. When I'm working on a single test it prevents me from running it often. The test itself takes ~3 seconds but starting of it takes ~12 seconds. The most part of this time is the browser opening. It's why I'm asking about something like "watch" mode. I tried to start Selenium in a parallel process, but it doesn't help, because Nightwatch is still opening the browser on every run. It looks like I'm missing something obvious. |
Okay, I created an express proxy between Nightwatch and Selenium, and I cache the first created session while the proxy is running. So I can reuse the same browser window between test runs. It's still taking some time for running the Nightwatch itself, but the current situation is much better. My problem has gone, sorry for bothering 😅 |
Wow! Nice. I think creating a watch mode is a very good idea. But I feel that it should be part of the Nightwatch package. Not this one. I am closing this for now |
Actually, after the proxy, I implemented a "watch mode". Now it takes 0 seconds to re-run the tests. But my implementation uses some hacks and relies on the fact, that |
I think this shoul be part of Nightwatch. But they are not very active now. I have an open pull request for month |
This is the bad barts of open source |
+1 |
I´m fascinated by the idea of a watch mode in nightwatch like nodejss nodemon. That method would save so much time! Could you show /share your solution with that express proxy? Thanks. |
Unfortunately, I switched my job and don't have access to the code. As I remember the "watch mode" consisted of two parts:
Actually, for now I use Cypress and it works just fine. |
Currently, new browser instances are opened and closed per feature. How do I force the browser session to stay open and for the features to reuse the same browser session?
Usually, one could add the background section to setup the scenario (login etc.) but your implementation doesn't seem to support background data.
The text was updated successfully, but these errors were encountered: