Run automated regression tests for your app using nightwatch.js and get results on Slack and email.
npm install @financial-times/n-automation
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 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
process.env.SLACK_URL
Slack Incoming Webhook Integration URL for the channel to notifyprocess.env.SLACK_MENTIONS
Slack users to mention on failure (optional)process.env.REGRESSION_RECIPIENTS
email addresses of the people to notify on test failure
Schedule your job with something like the Heroku Scheduler. Once a day is recommended.
Full nightwatch output will be sent to the email addresses above whenever a test fails.
See next-signup