testcafe-reporter-slackify v0.0.1
TestCafe Reporter Slack Custom
testcafe-reporter-slackify
This is a reporter for TestCafe. It sends the output of the test to Slack.
Purpose
Once configured the reporter sends test information to Slack channel at runtime, e.g.
Installation
Install this reporter as your test project dependency:
yarn add testcafe-reporter-slackifyor
npm i testcafe-reporter-slackifySetup instructions
In order to use this TestCafe reporter plugin, it is necessary to add it as your reporter to your TestCafe.
Using .testcaferc.json config file
Add a reporter name (slackify) to your reporter object:
{
"browsers": [ "chrome" ],
"src": "scenarios",
"reporter": [
{
"name": "slackify"
}
]
}Using TestCafe API
Pass the reporter name (slackify) to the reporter() method:
testCafe
.createRunner()
.src('path/to/test/file.js')
.browsers('chrome')
.reporter('slackify') // <-
.run();Necessary configuration
After that, you should define .env file with variables in your test project, hence the folder from where your call TestCafe (root directory).
# .env
TESTCAFE_SLACK_WEBHOOK=https://hooks.slack.com/services/*****This is required minimum to have the reporter working.
Options
Slack Custom reporter has few options which it could be configured from: .testcaferc.json, or .env file as global variables.
**It will first retrieve the values from the .testcaferc.json file, after that from .env file.
- :warning: - required
Slack Webhook URL :warning:
This option is required! Your Slack channel webhook URL generated from Slack API to allow reporter post there.
It's not recommended to pass your webhookUrl into either config file, in this case, due to sensitive data, it's better to pass it via global variable in .env file.
- via
.testcaferc.json
{
"name": "slackify",
"options": {
"webhookUrl": "https://hooks.slack.com/services/*****"
}
}- via
.envfile
# .env
TESTCAFE_SLACK_WEBHOOK=https://hooks.slack.com/services/*****Quiet mode
Choose if you want to have messages in the terminal about sending specific messages to Slack, it's turned off by default.
- via
.testcaferc.json
{
"name": "slackify",
"options": {
"quietMode": true
}
}- via
.envfile
# .env
TESTCAFE_SLACK_QUIET_MODE=trueFurther Documentation :books:
6 years ago