Home

Awesome

DEPRECATED

I don't maintain this repo (anymore). Just fork and alter it

TestCafe Reporter Slack

testcafe-reporter-slack

This is a reporter for TestCafe. It sends the output of the test to Slack.

Purpose :dart:

Once configured the reporter sends test results to Slack channel, e.g.

Slack report - success

Slack report - failed

Installation :construction:

Install this reporter as your test project dependency:

yarn add testcafe-reporter-slack

Setup instructions :wrench:

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 (slack) to your reporter object:

{
  "browsers": [ "chrome" ],
  "src": "scenarios",
  "reporter": [
    {
      "name": "slack"
    }
  ]
}

Using TestCafe API

Pass the reporter name (slack) to the reporter() method:

testCafe
    .createRunner()
    .src('path/to/test/file.js')
    .browsers('chrome')
    .reporter('slack') // <-
    .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 has it working.

Options :gear:

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.

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 the config file, in this case, due to sensitive data, it's better to pass it via global variable in .env file.

{
  "name": "slack",
  "options": {
    "webhookUrl": "https://hooks.slack.com/services/*****"
  }
}
# .env
TESTCAFE_SLACK_WEBHOOK=https://hooks.slack.com/services/*****

Channel :balloon: :link:

Your Slack channel name where you want to post reports.

{
  "name": "slack",
  "options": {
    "channel": "#testcafe"
  }
}
# .env
TESTCAFE_SLACK_CHANNEL="#testcafe"

Username :balloon: :link:

Your Slack app username.

{
  "name": "slack",
  "options": {
    "username": "testcafebot"
  }
}
# .env
TESTCAFE_SLACK_USERNAME=testcafebot

Logging level

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.

{
  "name": "slack",
  "options": {
    "loggingLevel": "SUMMARY"
  }
}
# .env
TESTCAFE_SLACK_LOGGING_LEVEL=SUMMARY

Quiet mode

Choose if you want to have messages in the terminal about sending specific messages to Slack, it's turned off by default.

{
  "name": "slack",
  "options": {
    "quietMode": true
  }
}
# .env
TESTCAFE_SLACK_QUIET_MODE=true

No Maintenance Intended

Further Documentation :books:

TestCafe Reporter Plugins