Testing views in express js

I'm trying to figure out an ideal way to test my views, written in Jade. They contain some logic. For example on the home page if a cookie has been set it should show a button to link to the main console and have option to logout versus if no cookie is set it should show login.

Any advice is appreciated.

Have a look at selenium

http://seleniumhq.org/

And of course the node adapter

https://github.com/LearnBoost/soda

I think that are not hard bugs to debug(You should see that in the browser window if it happens). But if you really want to I think you have following options:

  • Write the tests the way TJ did looking at his tests. He has written tests for almost everything.
  • Doing headless testing use for example tobi or zombie.js. There is also phantom.js, but this product is not developed in node.js.
  • selenium(not developed in node.js) with soda like deltanovember pointed out.
  • You could use js-test-driver to test all your browsers(client-side javascript). You could also use YETI(using YUI test framework) to test all your code in all the browsers.