webdriverio 3.2.x to expose scenario tags, feature description, etc to spec reporter
We are using webdriverio V3.2.x with spec reporter. Industry I work in is highly regulated and we need to document all automation test results output before every release. So it is quite essential that all test output is pretty formatted and passed on from feature files to test output files.
Right now, I can't get all information from my feature files to my hooks or custom reporter as its not being exposed by frameworks/cucumber.js methods like handleBeforeFeatureEvent or handleBeforeScenarioEvent.
Here is example of one of the hooks I am using for getting scenario tags...
var CukeHooks = function () {
this.BeforeScenario(function (event, callback) {
var tags = event.getPayloadItem('scenario').getTags().map(function(tag) {
return tag.getName();
});
console.log(' ' + tags.join(' '));
callback();
});
};
module.exports = CukeHooks;
Do you accept commits to one of the older releases or is it exposed in latest release?
In v4 you will have more opportunity to get more information on the test data. There you have beforeFeature hooks giving you data about the current running feature. Same for scenarions and steps. We are about to official release v4 this week so it might be a good idea to start with it already.
Cheers @christian-bromann. I will wait for V4 release.
Hey Chris so now that we are on v4 whats the right way to get feature/scenario/steps definitions?
@tripleratamacue please have a look at our cucumber boilerplate projects
Thanks for replying Chris I do see tags example, but my concern its how get feature, scenario and step details, I don't see any of those examples in that project, correct me if this is not the one: https://github.com/webdriverio/cucumber-boilerplate/blob/master/wdio.conf.js
how get feature, scenario and step details
What do you mean by that?
Scenario title, this is some code I currently but it show errors: afterScenario: function (stepResult) { feature = stepResult.getPayloadItem('feature'); scenario = stepResult.getPayloadItem('scenario');
scenario = this.stepResult.getScenario().getName();
step = this.stepResult.getStep().getName();
console.log('Last ran step: ' + step);
} https://github.com/cucumber/cucumber-js/issues/200
Chris? Am I able to explain my self? :)