Slack Service

wdio-slack-service is a 3rd party package, for more information please see GitHub | npm

A WebdriverIO service which sends notifications of test results to Slack. Reporter

Installation#

The easiest way is to keep wdio-slack-service as a devDependency in your package.json.

{
"devDependencies": {
"wdio-slack-service": "2.0.8"
}
}

You can simple do it by:

npm install wdio-slack-service --save-dev

Instructions on how to install WebdriverIO can be found here.

Configuration#

At the top of the wdio.conf.js-file, add:

// wdio.conf.js
var slack = require('wdio-slack-service');

In order to use the service you need to add slack to your services array in wdio.conf.js

// wdio.conf.js
export.config = {
services: [
[slack, {
webhook: process.env.SLACK_WEBHOOK_URL || "https://hooks.slack.com/........",
notifyOnlyOnFailure: true,
message:'Test Report'
}],
],
};

Configuration Options#

The following configuration options are supported and are all optional. By default none of the config options are set. For notifications to be sent webhook option should atleast be set.

OptionDescription
webhookURL - Incoming webhook of the slack channel to which notifications should be sent. If the URL is not configured, notifications will not be sent.
notifyOnlyOnFailureSet this option to true to send notifications only when there are test fail, else nothing will be sent.
messageTitle of text message which appears in the notification.
// wdio.conf.js
export.config = {
services: [
[slack, {
webhook: process.env.SLACK_WEBHOOK_URL || "https://hooks.slack.com/........",
notifyOnlyOnFailure: true,
message:'Test Report'
}],
],
};