TestCafe reporter plugin reporting to a Slack channel
npm install testcafe-reporter-slackifyThis is a reporter for TestCafe. It sends the output of the test to Slack.
Install this reporter as your test project dependency:
``bash`
yarn add testcafe-reporter-slackify`
orbash`
npm i testcafe-reporter-slackify
Add a reporter name (slackify) to your reporter object:
`json`
{
"browsers": [ "chrome" ],
"src": "scenarios",
"reporter": [
{
"name": "slackify"
}
]
}
Pass the reporter name (slackify) to the reporter() method:
`js`
testCafe
.createRunner()
.src('path/to/test/file.js')
.browsers('chrome')
.reporter('slackify') // <-
.run();
After that, you should define .env file with variables in your test project, hence the folder from where your call TestCafe (root directory).
`dotenv`.env
TESTCAFE_SLACK_WEBHOOK=https://hooks.slack.com/services/*
This is required minimum to have the reporter working.
Slack Custom reporter has few options which it could be configured from: .testcaferc.json, or .env file as global variables..testcaferc.json
**It will first retrieve the values from the 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
`json`
{
"name": "slackify",
"options": {
"webhookUrl": "https://hooks.slack.com/services/*"
}
}
* via .env file
`dotenv`.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
`json`
{
"name": "slackify",
"options": {
"quietMode": true
}
}
* via .env file
`dotenv``.env
TESTCAFE_SLACK_QUIET_MODE=true