kylecoberly / nightwatch-demo

A demo of the Nightwatch.js framework. Presented as part of a lightning talk at Denver's HTML5 meetup.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nightwatch.js Demo

This is a demonstration of automated acceptance testing using the nightwatch.js framework.

Installing

Note: This requires a recent version of the JDK to be installed!

  1. Fork and clone
  2. yarn (or npm install if you're a square)
  3. npm run dev to start the Barkwire web app. It will be available at http://localhost:3000.
  4. In another shell, npm run install-selenium to install Selenium WebDriver, then npm run selenium to start it
  5. In yet another shell, npm test to run your automated acceptance test.
  6. Star the repo because it was so helpful!

Experimenting

  1. This demo uses the phantom.js headless browser. The nightwatch.json file is where you configure the tests for other browsers (Chrome, Firefox, Safari, etc.)
  2. The test spec in tests/add-puppy.js should give an idea of how these tests are written. The API for nightwatch is simple to learn, and the resulting tests are extremely readable.
  3. There's a small amount of magic happening in the npm scripts- check out the scripts hash in package.json to see how they work. They can be even more magical by adding something like watch to automatically run your tests whenever your app files or tests change.
  4. It's a pretty paint-by-numbers Express app. It uses knex to abstract out all the database stuff, which is all stored locally in a SQLite3 embedded database. It also uses Handlebars and SCSS.

Other resources

About

A demo of the Nightwatch.js framework. Presented as part of a lightning talk at Denver's HTML5 meetup.


Languages

Language:JavaScript 51.5%Language:CSS 38.2%Language:HTML 10.3%