GithubHelp home page GithubHelp logo

Comments (27)

mucsi96 avatar mucsi96 commented on June 19, 2024 1

Yes because .end() is added after every scenario in the feature. This causes the problem nightwatchjs/nightwatch#117 (comment)

from nightwatch-cucumber.

mucsi96 avatar mucsi96 commented on June 19, 2024 1

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.

mucsi96 avatar mucsi96 commented on June 19, 2024

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.

louiscbotha avatar louiscbotha commented on June 19, 2024

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.

mucsi96 avatar mucsi96 commented on June 19, 2024

That's great news! thanks. I will try to fix this

from nightwatch-cucumber.

mucsi96 avatar mucsi96 commented on June 19, 2024

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.

louiscbotha avatar louiscbotha commented on June 19, 2024

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.

volodya1805 avatar volodya1805 commented on June 19, 2024

hey Igor. Any luck with that issue?

from nightwatch-cucumber.

mucsi96 avatar mucsi96 commented on June 19, 2024

Not yet :( But for speed up I suggest to try paralell test execution.

"test_workers": true 

More details here

from nightwatch-cucumber.

volodya1805 avatar volodya1805 commented on June 19, 2024

Yeah i know about paralell test execution, but that's the only one blocker why we don't use this module.

from nightwatch-cucumber.

volodya1805 avatar volodya1805 commented on June 19, 2024

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.

mucsi96 avatar mucsi96 commented on June 19, 2024

I started to work on this. I can see two possible solutions for this:

  • Fix nightwatchjs/nightwatch#117
  • Add a runner option with default value nightwatch. If the user set it to cucumber 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.

volodya1805 avatar volodya1805 commented on June 19, 2024

I think it's ok since we can use browser stack for parallel execution - right?

from nightwatch-cucumber.

mucsi96 avatar mucsi96 commented on June 19, 2024

Ok. I plan to fix it this week.

from nightwatch-cucumber.

volodya1805 avatar volodya1805 commented on June 19, 2024

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.

volodya1805 avatar volodya1805 commented on June 19, 2024

because right now instances are opened and closed per every screnario in the feature. Is it expected?

from nightwatch-cucumber.

anatoliyarkhipov avatar anatoliyarkhipov commented on June 19, 2024

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.

mucsi96 avatar mucsi96 commented on June 19, 2024

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.

anatoliyarkhipov avatar anatoliyarkhipov commented on June 19, 2024

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.

anatoliyarkhipov avatar anatoliyarkhipov commented on June 19, 2024

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.

anatoliyarkhipov avatar anatoliyarkhipov commented on June 19, 2024

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.

anatoliyarkhipov avatar anatoliyarkhipov commented on June 19, 2024

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.

mucsi96 avatar mucsi96 commented on June 19, 2024

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.

mucsi96 avatar mucsi96 commented on June 19, 2024

This is the bad barts of open source

from nightwatch-cucumber.

tegomass avatar tegomass commented on June 19, 2024

+1

from nightwatch-cucumber.

cengiz-a avatar cengiz-a commented on June 19, 2024

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.

anatoliyarkhipov avatar anatoliyarkhipov commented on June 19, 2024

Unfortunately, I switched my job and don't have access to the code. As I remember the "watch mode" consisted of two parts:

  1. 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
  2. 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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.