Code Monkey home page Code Monkey logo

testcafe-reporter-slack's Introduction

TestCafe Reporter Slack

testcafe-reporter-slack

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

Purpose ๐ŸŽฏ

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

Slack report - success

Slack report - failed

Installation ๐Ÿšง

Install this reporter as your test project dependency:

yarn add testcafe-reporter-slack

Setup 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 (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 โš™๏ธ

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

Slack Webhook URL โš ๏ธ

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/*****

Channel ๐ŸŽˆ ๐Ÿ”—

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"

Username ๐ŸŽˆ ๐Ÿ”—

Your Slack app username.

  • via .testcaferc.json
{
  "name": "slack",
  "options": {
    "username": "testcafebot"
  }
}
  • via .env file
# .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.

  • via .testcaferc.json
{
  "name": "slack",
  "options": {
    "loggingLevel": "SUMMARY"
  }
}
  • via .env file
# .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.

  • via .testcaferc.json
{
  "name": "slack",
  "options": {
    "quietMode": true
  }
}
  • via .env file
# .env
TESTCAFE_SLACK_QUIET_MODE=true

Further Documentation ๐Ÿ“š

TestCafe Reporter Plugins

testcafe-reporter-slack's People

Contributors

gabrielbs avatar marcinlesek avatar shafied avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.