You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to post a custom message with SlackReporter.postMessage() in the WDIO onComplete block while using the mocha framework with bdd causes the message to silently not be posted.
after, afterSession, afterSuite, etc. all function as expected.
Code
onComplete: function () {
console.log('aaaa');
return new Promise((resolve, reject) => {
SlackReporter.postMessage({
channel: process.env.SLACK_CHANNEL,
slackBotToken: process.env.SLACK_BOT_TOKEN,
text: 'testing onComplete', // Never gets sent
})
.then(() => {
console.log('ssss'); // Never Fires
resolve('');
})
.catch(() => {
console.log('dddd'); // Never Fires
reject();
});
});
},
Suboptimal Workaround Solution
Use npm package @slack/web-api instead to directly send the message to slack rather than having it wrapped in this library.
Context
Mocha considers every WDIO test to be it's own suite.
As such, sending the full details onComplete makes the reports in Slack legible.
In an ideal world, this reporter would allow me to dump the full details during onComplete, but unfortunately WDIOReporter does not expose onComplete.
As such, I am extending my onComplete hook to bridge the gap between the reporter and WDIO.
The text was updated successfully, but these errors were encountered:
Problem
Trying to post a custom message with
SlackReporter.postMessage()
in the WDIOonComplete
block while using themocha
framework withbdd
causes the message to silently not be posted.after
,afterSession
,afterSuite
, etc. all function as expected.Code
Suboptimal Workaround Solution
Use npm package
@slack/web-api
instead to directly send the message to slack rather than having it wrapped in this library.Context
Mocha considers every WDIO test to be it's own suite.
As such, sending the full details
onComplete
makes the reports in Slack legible.In an ideal world, this reporter would allow me to dump the full details during
onComplete
, but unfortunatelyWDIOReporter
does not exposeonComplete
.As such, I am extending my
onComplete
hook to bridge the gap between the reporter and WDIO.The text was updated successfully, but these errors were encountered: