tableflip/meteor-nightwatch-helpers

Name: meteor-nightwatch-helpers

Owner: TABLEFLIP

Description: A series of helper functions for writing Nightwatch tests for Meteor apps

Created: 2015-10-18 19:10:32.0

Updated: 2015-10-18 19:25:55.0

Pushed: 2015-10-19 08:47:25.0

Homepage: null

Size: 140

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Nightwatch Helpers

A series of helper functions for writing Nightwatch tests for Meteor apps.

Setup
  1. Install starrynight:
m install -g starrynight
  1. Initialise project for starry night. From the root directory of the app:
arrynight generate-autoconfig
arrynight scaffold --framework nightwatch
  1. Clone this repo into the packages subdirectory from the project root. You might need to create a packages directory.
@host:~/YOUR_PROJECT/packages$ git clone https://github.com/tableflip/meteor-nightwatch-helpers
  1. Add the package to your project:
teor add tableflip:nightwatch-helpers
  1. Add the following line to the "custom_commands_path" key in the .meteor/nightwatch.json file that will have been created:
kages/tests-helpers/nightwatch"
Usage
Writing tests

Tests should be put in tests/nightwatch/walkthroughs. The starrynight scaffold will have created an example walkthrough in the appropriate location.

Logging in
nt.login()

This will log the test client in with a user ID of AAAAAAAAAAAAAAAAA and name Test User. Note that the core accounts-base package must be present in the app for this to work (accounts-base is included with all the accounts-XXX packages).

Fixtures
nt.clearDB()

This method will remove all the contents of the collections which appear in fixtures files (see below).

nt.populateDB()

This method will insert all of the documents listed in any file in the tests-helpers/fixtures directory. Files must be valid JSON and must contain an object with two keys: name, which is the collection name (in Meteor, not in the MongoDB), and docs, which is an array of documents to insert. An example is provided and should be either amended or removed before using this method.

Running tests
arrynight run-tests --framework nightwatch

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.