Nightwatch.js
nightwatchjs.org
nightwatchjs.org
pip install robotframework-selenium2library
test.txt:
*** Settings ***
Library Selenium2Library
*** Test Cases ***
Google The Night Watch
[Setup] Open Browser https://google.com
Title Should Be Google
Input Text q nightwatch
Click Button Google Search
Wait Until Page Contains The Night Watch
[Teardown] Close All Browsers
pybot test.txt
Still haven't found anything that beats Robotframework when it comes to test automation. It's not just for web testing, it has many ready made libraries and creating your own is really easy.Check it out http://robotframework.org/
Personally I like just using "wd" along with a promise helper library or two.
Here's an example using q-proxy (https://npmjs.org/package/q-proxy) and q-step (https://npmjs.org/package/q-step). The result is a pretty nice syntax (admittedly nicer in CoffeeScript than JavaScript) and a lot more flexibility to do other logic:
browser = QProxy(wd.promiseRemote("localhost", 4444))
QStep(
-> browser.init(browserName: "firefox")
-> browser.get("https://www.facebook.com/")
-> browser.elementById("email").type(credentials.email)
-> browser.elementById("pass").type(credentials.password)
-> browser.elementById("u_0_b").click()
)
Or wd's own built-in promise chaining is pretty similar to Nightwatch.js as well: browser
.init({browserName:'chrome'})
.get("http://admc.io/wd/test-pages/guinea-pig.html")
.title()
.should.become('WD Tests')
.elementById('i am a link')
.click()
.eval("window.location.href")
.should.eventually.include('guinea-pig2')
.back()
.elementByCss('#comments').type('Bonjour!')
.getValue().should.become('Bonjour!')
.fin(function() { return browser.quit(); })
.done();What I really want is a selenium server 30MB, firefox speaks the webdriver protocol natively, I dont see why a proxy server to a browser needs to be 30MB (40 including chromedriver?, it pretty much needs to launch browsers and proxy requests, the project that launches the browsers should probably be its own project for that matter.
If anyone can point me to a project working on that, I would highly appreciate it :)
It's considerably more lightweight and compatible with all browsers you care about, but you can't do everything you can do with selenium.
We've been using it for about 6 months at work and having good results.
Check out https://github.com/scriby/browser-harness-bootstrap-tests for a full example. Browser harness itself is just a conduit between node and a browser - you need to provide the test framework yourself (mocha, vows, etc.).
As having a quick scan of the source code, it looks very well written! Especially for javascript, not many people can write javascript well.
"Nightwatch got its name from the famous painting The Night Watch by Dutch painter Rembrandt van Rijn. The masterpiece is prominently displayed in the Rijksmuseum, in Amsterdam - The Netherlands".
At http://clara.io, our app is a fairly typical client-side Backbone.js app, so our integration tests can use standard backbone, mocha and jQuery constructs. Instead of using selenium, we use contructs like on('show').
The only thing that we actually use selenium for is for starting the browser from the command line.
the line
> .waitForElementVisible("button[name=btnG]", 1000)
in the demo test caught my attention - what is a good way to achieve this in production code? i.e. execute a function when a certain element which matches the query becomes visible?
atm i'm using the DOMNodeInserted event (debounced)
> $(document).on('DOMNodeInserted', _.debounce(function(e, ui) {}, 100);
Can anyone who has done lots of browser based testing shed light on what solutions out there introduce the fewest or no side effects when probing?
The motivation is to economically (both in test suite run time and development time) test the system's many edge cases, including race conditions.
https://github.com/btakita/jasmine-flow
It's only dependency is jasmine. I use it with jsdom, so I can test all > 95% client's edge cases in a reasonable amount of time and confidence of the software working. This allows me to run the entire test suite before commits on mature projects.
disclaimer: I work on https://github.com/admc/wd and https://github.com/jlipps/yiewd, which are other webdriver clients for Node
After a few years building/maintaining a similar library I've found the key is simplifying peoples lives but making sure they can still do 'everything'.
Does Nightwatch implement the entire WebDriver JsonWire protocol or just the bits needed for the provided actions?
Cool stuff
- debugger is awful, horrible stack dumps (sometimes just no stack info, you have no idea where the test failed) - very slow - selectors for ng-repeats are so hard to decipher (I still don't get them)
The Boston PHP group had a talk this week on integrating Selenium, phantomJS (headless browser) and Jenkins (continuous integration). Its php based talk, but at the end he showed the javascript version of the same tests.
https://github.com/balancerockmedia/boston-php-automated-tes...
Any plans to integrate with Grunt.js?
Deleted comment
Nightwatch got its name from the famous painting The Night Watch by Dutch painter Rembrandt van Rijn. The masterpiece is prominently displayed in the Rijksmuseum, in Amsterdam - The Netherlands.