Slack Reporter Reporter
wdio-slack-reporter is a 3rd party package, for more information please see GitHub | npm
Reporter from WebdriverIO using Incoming webhook and Web API to send results to Slack.
📢 Important Notice
Migration to filesUploadV2 due to files.upload deprecation
Slack notification screenshot

WebdriverIO Version Support Policy
The WebdriverIO versions supported in this project follow WebdriverIO's support policy. WebdriverIO's support policy can be checked here.
Installation
The easiest way is to keep @moroo/wdio-slack-reporter
as a devDependency in your package.json
.
{
"devDependencies": {
"@moroo/wdio-slack-reporter": "^9.0.0"
}
}
You can simple do it by:
- NPM
npm install @moroo/wdio-slack-reporter --save-dev
- Yarn
yarn add -D @moroo/wdio-slack-reporter
Instructions on how to install WebdriverIO
can be found here.
Configuration
In order to use the reporter you need to add slack to your reporters array in wdio.conf.js
// wdio.conf.js
import SlackReporter from '@moroo/wdio-slack-reporter';
export const config: WebdriverIO.Config = {
reporters: [
[
SlackReporter,
{
slackOptions: {
type: 'web-api',
channel: process.env.SLACK_CHANNEL || 'Cxxxxxxxxxx',
token: process.env.SLACK_BOT_TOKEN || 'xoxb-xxxxxxxxxx-xxxxxx...',
},
},
],
],
};
Configuration Options
The following configuration options are supported.
For notifications to be sent, You must set webhook
or web-api
.
If both web-api
and webhook
are set, web-api
is used.
Webhook (Incoming Webhook)
webhook (Required
)
Incoming Webhook of the slack channel to which notifications should be sent. If the URL is not configured, notifications will not be sent.
- Scope:
webhook
- Type:
string
username (Optional
)
The value of username will appear in the slack notification as the user who sent it.
- Scope:
webhook
- Type:
string
- Default:
"WebdriverIO Reporter"
icon_url (Optional
)
The url of the Icon to be displayed in the slack
- Scope:
webhook
- Type:
string
- Default:
"https://webdriver.io/img/webdriverio.png"
[!TIP] Besides these, all options defined in the Slack Incoming Webhook specification can also be used.
Web API (Slack Bot)
token (Required
)
Web API of the slack channel to which notifications should be sent. A bot user token is required. Bot access tokens always begin with xoxb
.
The bot token requires the OAuth scope of chat:write
, files:write
.
See below for more details.
- Scope:
web-api
- Type:
string
channel (Required
)
Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name. See below for more details.
"How to find channel ID" - stackoverflow -
- Scope:
web-api
- Type:
string
[!TIP] Besides these, all options defined in the Slack Web API specification can also be used.
uploadScreenshotOfFailedCase (Optional
)
Set this option to true to attach a screenshot to the failed case.
- Scope:
web-api
- Type:
boolean
- Default:
true
notifyDetailResultThread (Optional
)
This option only works when the notifyTestFinishMessage option is true.
Set this option to true if you want to add thread with details of results to notification of test results posted to Slack.
- Scope:
web-api
- Type:
boolean
- Default:
true
filterForDetailResults (Optional
)
This option only works when the notifyDetailResultThread option is true.
Add the filter you want to this option to the array and the detailed results will be filtered out in Slack and sent to the thread.
(If there are no filters (array is empty or undefined), all filters are applied.)
Filter list: passed
, failed
, pending
, skipped
- Scope:
web-api
- Type:
array (passed | failed | pending | skipped)
- Default:
['passed', 'failed', 'pending', 'skipped']
createScreenshotPayload (Optional
)
This option customizes the payload that is uploaded of the screenshot for the failure of the test.
- Scope:
web-api
- Type:
function
createResultDetailPayload (Optional
)
This option customizes the payload that is notified of the detailed results of the test.
- Scope:
web-api
- Type:
function
Common
title (Optional
)
Set this option to the test title.
- Scope:
webhook
,web-api
- Type:
string
resultsUrl (Optional
)
Provide a link to the test results. It is a clickable link in the notification.
- Scope:
webhook
,web-api
- Type:
string
notifyTestStartMessage (Optional
)
Set this option to true to send notifications test start.
- Scope:
webhook
,web-api
- Type:
boolean
- Default:
true