nightwatchjs / nightwatch

Integrated end-to-end testing framework written in Node.js and using W3C Webdriver API. Developed at @browserstack
https://nightwatchjs.org
MIT License
11.79k stars 1.31k forks source link

can I test different browsers sequentially? #138

Closed newjs closed 10 years ago

newjs commented 10 years ago

In my case, I need to test different browsers. How do I do that? I basically want to run the same set of test cases on chrome, then Firefox, then Safari.

beatfactor commented 10 years ago

No, I'm afraid nightwatch doesn't support this out of the box.

erickbrower commented 10 years ago

@newjs Though nightwatch doesn't have a built-in function for this, it can handle multiple browsers if you're willing to script the process a bit. Here's what I did to handle multiple browsers with Saucelabs, you could do something similar if you're running your own selenium server:

I replaced the desiredCapabilities entries with ENV vars as placeholders, allowing me to use it as a sort of template. Then I can run the test runner against a specific browser by setting the proper ENV vars before the command (e.g., SAUCE_BROWSER_NAME=chrome nightwatch -e saucelabs -t smoketest.js)

newjs commented 10 years ago

Thanks @erickbrower. I did that the old fashion way yesterday. Duplicated the json file, change one for chrome, then just wire them up in one script.

node nightwatch.js --c ./nightwatch_ff.json node nightwatch.js --c ./nightwatch_ch.json

Any plan to support out of box multiple browsers capabilities?

dsuckau commented 10 years ago

I need multiple browser support too. This feature would make much sense!

Jezternz commented 10 years ago

+1 Multiple browser support would be awesome. - Thanks @newjs, good substitute while this feature is considered.

disciplezero commented 10 years ago

We do this through grunt-nigthwatch. Grunt is able to change the config, so we have a task that wraps nw execution and sets the browser configs before each.

Jezternz commented 10 years ago

I just noticed that nightwatch now supports this natively in the trunk version. how often does nightwatch get pushed to npm?

newjs commented 10 years ago

@jezternz thats good news! I suppose we can build it before its available in npm if trunk is stable.

beatfactor commented 10 years ago

v0.5.6 is now in npm. Normally it is released on npm quickly whenever there's fixes or features but recently I had some issues with npm publish.

Also some docs here: http://nightwatchjs.org/guide#run-parallel. There are some guides on the Wiki as well about browser specific setup.

Jezternz commented 10 years ago

awesome, thanks @beatfactor :)

knownasilya commented 9 years ago

So this is nice, but still lacks.

I have two environments, saucelabs, and default. I want to test multiple browsers in each environment. With the current setup I have to copy my saucelabs environment x amount of time, so sauce-chrome, sauce-firefox, etc.. This is kind of sub-par, it would be nice if I could pass an array to desiredCapabilities, with the different browsers, and those would run in parallel.

beatfactor commented 9 years ago

You could also create your environments programmatically with Javascript to avoid repetition. You can use a nightwatch.conf.js file instead of nightwatch.json, like I did here: http://nightwatchjs.org/blog/testing-webrtc-apps-with-nightwatch/#adaptingtestsettingsatruntimeperenvironment

On Mon, Feb 9, 2015 at 3:30 PM, Ilya Radchenko notifications@github.com wrote:

So this is nice, but still lacks.

I have two environments, saucelabs, and default. I want to test multiple browsers in each environment. With the current setup I have to copy my saucelabs environment x amount of time, so sauce-chrome, sauce-firefox, etc.. This is kind of sub-par, it would be nice if I could pass an array to desiredCapabilities, with the different browsers, and those would run in parallel.

— Reply to this email directly or view it on GitHub https://github.com/beatfactor/nightwatch/issues/138#issuecomment-73517118 .

knownasilya commented 9 years ago

@beatfactor thanks for that.