Skip to content

Commit 47bd356

Browse files
author
Marc Rooding
authored
Merge pull request #17 from danyc/master
Bug fixes
2 parents 37b5f45 + 71a5f32 commit 47bd356

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
55
This is a stand-alone fork of [grunt-protractor-cucumber-html-report](https://github.com/robhil/grunt-protractor-cucumber-html-report)
66

7+
![Sample report](https://cloud.githubusercontent.com/assets/3902324/16930002/00f575c6-4d43-11e6-85fd-bcfeea694007.png "Sample report")
8+
79
## Getting Started
810
This plugin requires Gulp `~3.9.0`
911

lib/html_formatter.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,15 @@ module.exports = (function () {
3838
return step.keyword.trim() === 'After' && step.name === undefined && step.embeddings === undefined;
3939
}
4040

41+
/**
42+
* Checks if the step is an empty Before step
43+
* @param step - object which contains step data
44+
* @returns boolean
45+
*/
46+
function isEmptyBeforeStep(step) {
47+
return step.keyword.trim() === 'Before' && step.name === undefined && step.embeddings === undefined;
48+
}
49+
4150
/**
4251
* Checks if the step is an After step containing a screenshot
4352
* @param step - object which contains step data
@@ -62,7 +71,7 @@ module.exports = (function () {
6271
return compiled({
6372
status: step.result ? step.result.status : '',
6473
errorDetails: step.result ? toHtmlEntities(step.result.error_message) : '',
65-
name: step.keyword + step.name,
74+
name: step.keyword + (step.name ? step.name : ''),
6675
dataTable: step.rows ? step.rows : ''
6776
});
6877
}
@@ -178,7 +187,7 @@ module.exports = (function () {
178187
for (var k = 0; k < testResults[i].elements[j].steps.length; k++) {
179188
step = testResults[i].elements[j].steps[k];
180189

181-
if(isEmptyAfterStep(step)) {
190+
if(isEmptyAfterStep(step) || isEmptyBeforeStep(step)) {
182191
continue;
183192
}
184193

test/data/cucumber_report.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,17 @@
1616
"description": "",
1717
"type": "scenario",
1818
"steps": [
19+
{
20+
"keyword": "Before ",
21+
"hidden": true,
22+
"result": {
23+
"status": "passed",
24+
"duration": 11258903
25+
},
26+
"match": {
27+
"location": "...\\src\\test\\hooks.js:2"
28+
}
29+
},
1930
{
2031
"name": "I login as teacher",
2132
"line": 4,

0 commit comments

Comments
 (0)