I don't maintain this repo (anymore). Just fork and alter it
This is a reporter for TestCafe. It sends the output of the test to Slack.
Once configured the reporter sends test results to Slack channel, e.g.
Install this reporter as your test project dependency:
yarn add testcafe-reporter-slack
In order to use this TestCafe reporter plugin, it is necessary to add it as your reporter to your TestCafe.
Add a reporter name (slack
) to your reporter
object:
{
"browsers": [ "chrome" ],
"src": "scenarios",
"reporter": [
{
"name": "slack"
}
]
}
Pass the reporter name (slack
) to the reporter()
method:
testCafe
.createRunner()
.src('path/to/test/file.js')
.browsers('chrome')
.reporter('slack') // <-
.run();
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 has it working.
Slack reporter have few options which could be configured from both, .testcaferc.json
or .env
file as global variables.
It will first retrieve the values from the TestCafe config file .testcaferc.json
, after that from .env
file.
⚠️ - required- 🎈 - optional
- 🔗 - deprecated
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 the 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": "slack",
"options": {
"webhookUrl": "https://hooks.slack.com/services/*****"
}
}
- via
.env
file
# .env
TESTCAFE_SLACK_WEBHOOK=https://hooks.slack.com/services/*****
Your Slack channel name where you want to post reports.
- via
.testcaferc.json
{
"name": "slack",
"options": {
"channel": "#testcafe"
}
}
- via
.env
file
# .env
TESTCAFE_SLACK_CHANNEL="#testcafe"
Your Slack app username.
- via
.testcaferc.json
{
"name": "slack",
"options": {
"username": "testcafebot"
}
}
- via
.env
file
# .env
TESTCAFE_SLACK_USERNAME=testcafebot
Choose your report logging level, if you want to see each test with error stack trace, choose TEST
(default). The second one is short & condensed which show the only number of tests which passed, failed and was skipped - SUMMARY
.
- via
.testcaferc.json
{
"name": "slack",
"options": {
"loggingLevel": "SUMMARY"
}
}
- via
.env
file
# .env
TESTCAFE_SLACK_LOGGING_LEVEL=SUMMARY
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": "slack",
"options": {
"quietMode": true
}
}
- via
.env
file
# .env
TESTCAFE_SLACK_QUIET_MODE=true