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
{{ message }}
This repository has been archived by the owner on Dec 18, 2019. It is now read-only.
I am new in wdio and trying to explore different wdio frameworks. I have been working on wdio-cucumber-framework lately and facing this issue. Kindly help me in this matter Issue :> Whenever I try to run my cucumber tests along with allure reports (in sync mode), it doesn't attach the Screenshot to the right failed step in the allure XML file [even it is happening to other reports too like multiple HTML reports] BUT it is attaching screenshot to the next Scenario's 1st step.
Here is the simple wdio-cucumber project ('https://github.com/kasyed245/webdriverio-cucumber/tree/master/allure-results') where you can check two xml files (*-testsuite.xml) regarding screenshots.
Here is the hook where I am trying to capture the screenshot in wdio.conf.js
afterStep: function afterStep(stepResult) {
if(stepResult.status == "passed"){
console.log("===============Step passed===============")
}else{
console.log("===============Step Failed===============")
console.log("Feature : "+stepResult.feature);
console.log("Scenario : "+stepResult.scenario);
console.log("Step Text : "+stepResult.text);
var d = new Date();
var datetime = d.getDate() + "_"+ (d.getMonth()+1) + "_" + d.getFullYear()
+ "_"+ d.getHours() + "_" + d.getMinutes() + "_" + d.getSeconds();
var fileName = encodeURIComponent(stepResult.scenario.replace(/\s+/g, '-'))+"_"+datetime;
var filePath = this.screenshotPath + fileName +'.png';
browser.saveScreenshot(filePath);
console.log('\n\t Screenshot location:',filePath,'\n');
}
Apologies in advance if this is already discussed in this forum although I searched but couldn't find any relevant details. Thanks.
The text was updated successfully, but these errors were encountered:
kasyed245
changed the title
Screenshot is not being attached to the Failed Scenario
Screenshot is not being attached to the Failed Cucumber Scenario Step
Oct 16, 2018
kasyed245
changed the title
Screenshot is not being attached to the Failed Cucumber Scenario Step
Screenshot is not being attached to the Failed Cucumber Scenario Step in Allure(or Any) Reports
Oct 16, 2018
You need to copy following code in separate file in step folder (like hooks.js) and commented out all the After hooks in the conf.js file
const {After, Status} = require('cucumber');
After((scenarioResult)=>{
// Here it is added to a failed step, but each time you call `browser.saveScreenshot()` it will automatically bee added to the report
if (scenarioResult.result.status === 'failed') {
// It will add the screenshot to the JSON
browser.saveScreenshot()
}
return scenarioResult.status;
});
And now you'll find both Allure report or wdio-multiple-cucumber-html-reporter working fine.
I am new in wdio and trying to explore different wdio frameworks. I have been working on wdio-cucumber-framework lately and facing this issue. Kindly help me in this matter
Issue :> Whenever I try to run my cucumber tests along with allure reports (in sync mode), it doesn't attach the Screenshot to the right failed step in the allure XML file [even it is happening to other reports too like multiple HTML reports] BUT it is attaching screenshot to the next Scenario's 1st step.
Here is the simple wdio-cucumber project ('https://github.com/kasyed245/webdriverio-cucumber/tree/master/allure-results') where you can check two xml files (*-testsuite.xml) regarding screenshots.
Here is the hook where I am trying to capture the screenshot in wdio.conf.js
Apologies in advance if this is already discussed in this forum although I searched but couldn't find any relevant details. Thanks.
The text was updated successfully, but these errors were encountered: