Comments (27)
Yes because .end()
is added after every scenario in the feature. This causes the problem nightwatchjs/nightwatch#117 (comment)
from nightwatch-cucumber.
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
from nightwatch-cucumber.
I think this is a limitation of Selenium itself. Reusing Selenium session is considered a bad practice :( Because of session failure case.
from nightwatch-cucumber.
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
from nightwatch-cucumber.
That's great news! thanks. I will try to fix this
from nightwatch-cucumber.
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
from nightwatch-cucumber.
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.
from nightwatch-cucumber.
hey Igor. Any luck with that issue?
from nightwatch-cucumber.
Not yet :( But for speed up I suggest to try paralell test execution.
"test_workers": true
More details here
from nightwatch-cucumber.
Yeah i know about paralell test execution, but that's the only one blocker why we don't use this module.
from nightwatch-cucumber.
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.
from nightwatch-cucumber.
I started to work on this. I can see two possible solutions for this:
- Fix nightwatchjs/nightwatch#117
- Add a
runner
option with default valuenightwatch
. If the user set it tocucumber
than cucumber will be the main runner. In this case Nightwatch runner features will be not available. (Like parallel execution) Also the output will be Cucumber style.
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?
from nightwatch-cucumber.
I think it's ok since we can use browser stack for parallel execution - right?
from nightwatch-cucumber.
Ok. I plan to fix it this week.
from nightwatch-cucumber.
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
from nightwatch-cucumber.
because right now instances are opened and closed per every screnario in the feature. Is it expected?
from nightwatch-cucumber.
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).
from nightwatch-cucumber.
Hi! I am not sure I understand you correctly. Do you think about a REPL like executing node
from terminal? Where you entera nightwatch command, hit Enter and it will be executed inbrowser using selenium?
from nightwatch-cucumber.
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?
from nightwatch-cucumber.
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.
from nightwatch-cucumber.
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
from nightwatch-cucumber.
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 Runner#run
is overloaded by nightwatch-cucumber
. So I'm not sure where should I continue this discussion and should I continue it at all. If someone interested, I can split the "watch mode" code from our application code and puslish a repo.
from nightwatch-cucumber.
I think this shoul be part of Nightwatch. But they are not very active now. I have an open pull request for month
from nightwatch-cucumber.
This is the bad barts of open source
from nightwatch-cucumber.
+1
from nightwatch-cucumber.
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.
from nightwatch-cucumber.
Unfortunately, I switched my job and don't have access to the code. As I remember the "watch mode" consisted of two parts:
- The
express
proxy. It was pretty simple - it redirected every request to the real Selenium, but if it was a request to create a browser instance, than the proxy checked if it had been already created and returned its session ID if it had - Another part was to override
Runner#run
and that was full of dirty hacks which I wouldn't be able to remember now
Actually, for now I use Cypress and it works just fine.
from nightwatch-cucumber.
Related Issues (20)
- Connection of two feature files without reusing HOT 1
- Adding feature of creating of XML reporting
- this.api is not available inside a page-object command definition HOT 3
- Feature request: HOT 1
- Simple Example not working HOT 4
- beforeEach is not called. before is called. after is called afterEach is not called HOT 3
- Incomplete Hook Example HOT 1
- Attach Nightwatch assertion messages to cucumber json report HOT 3
- [Bug] Using glob to define file source path in cucumberArgs does not work
- Version 10 of node.js has been released
- Can't return/await a promisified client.getCookies() HOT 1
- Allow passing tag_filter through test_settings
- API is not able to get Json report name when running tests in parallel mode with your own JSON formatter
- update to nightwatch 1.0.x HOT 2
- How to run individual feature in nightwatch js ? HOT 3
- How can I change selenium host for each scenario? HOT 1
- both element and page name of page object is supported in the step definition? HOT 1
- How to close the browser when the test case gets failed.
- Start test suite using cucumber-js HOT 2
- multiple arguments and implementation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nightwatch-cucumber.