Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Financial-Times/n-automation

Repository files navigation

n-automation Circle CI

Run automated regression tests for your app using nightwatch.js and get results on Slack and email.

Installation

npm install @financial-times/n-automation

Usage

Makefile

Write a regression recipe on your Makefile containing the tests you'd like to run, passing the n-automation reporter to nht nightwatch:

REPORTER = ./node_modules/@financial-times/n-automation/build/reporter.js

regression:
	nht nightwatch -c nightwatch.js path/to/test.js --reporter ${REPORTER}
	nht nightwatch -c nightwatch.js path/to/anotherTest.js --reporter ${REPORTER}
	...

Init

Init n-automation in an independent file somewhere in your project, for example jobs/run-regression.js:

const Automation = require('@financial-times/n-automation');

Automation.run({
	appName: 'Your App Name',
	nightwatchJson: require('../nightwatch.js')
});

Only pass in nightwatchJson if your project has a nightwatch config. If not, send only appName and n-automation will default to the n-heroku-tools nightwatch config file

Env Variables

  • process.env.SLACK_URL Slack Incoming Webhook Integration URL for the channel to notify
  • process.env.SLACK_MENTIONS Slack users to mention on failure (optional)
  • process.env.REGRESSION_RECIPIENTS email addresses of the people to notify on test failure

Heroku Schedule

Schedule your job with something like the Heroku Scheduler. Once a day is recommended.

Email on failure

Full nightwatch output will be sent to the email addresses above whenever a test fails.

Examples

See next-signup