-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch back to pretty print in the Protractor cucumberOpts and add a JSON output listener as per [cucumber/cucumber-js#90 (comment)]
- Loading branch information
1 parent
384da10
commit ae53b57
Showing
3 changed files
with
84 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
[ | ||
{ | ||
"id": "Todo-list", | ||
"name": "Todo list", | ||
"description": "As a user of the todo list\r\nI want to be able to add and read todos\r\nSo that I can remember what I am supposed to do later", | ||
"line": 2, | ||
"keyword": "Feature", | ||
"uri": "C:\\Users\\jimcr_000\\Documents\\GitHub\\cucumber-with-protractor-demo\\features\\todo.feature", | ||
"elements": [ | ||
{ | ||
"name": "Adding a todo", | ||
"id": "Todo-list;adding-a-todo", | ||
"line": 8, | ||
"keyword": "Scenario", | ||
"description": "", | ||
"type": "scenario", | ||
"tags": [ | ||
{ | ||
"name": "@smoke", | ||
"line": 7 | ||
} | ||
], | ||
"steps": [ | ||
{ | ||
"keyword": "Before ", | ||
"hidden": true, | ||
"result": { | ||
"duration": 883962, | ||
"status": "passed" | ||
}, | ||
"match": {} | ||
}, | ||
{ | ||
"name": "I am on the app homepage.", | ||
"line": 9, | ||
"keyword": "Given ", | ||
"result": { | ||
"duration": 2737178804, | ||
"status": "passed" | ||
}, | ||
"match": {} | ||
}, | ||
{ | ||
"name": "I add a todo called \"hello world\".", | ||
"line": 10, | ||
"keyword": "When ", | ||
"result": { | ||
"duration": 21925858, | ||
"status": "passed" | ||
}, | ||
"match": {} | ||
}, | ||
{ | ||
"name": "I should see it added to the todo list.", | ||
"line": 11, | ||
"keyword": "Then ", | ||
"result": { | ||
"duration": 884422463, | ||
"status": "passed" | ||
}, | ||
"match": {} | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] |
16 changes: 16 additions & 0 deletions
16
features/support/output-listeners/json-reporter-listener.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
module.exports = function JsonOutputHook() { | ||
var Cucumber = require('cucumber'); | ||
var JsonFormatter = Cucumber.Listener.JsonFormatter(); | ||
var fs = require('fs'); | ||
|
||
var filepath = 'cucumber-report.json'; | ||
|
||
JsonFormatter.log = function (json) { | ||
fs.writeFile(filepath, json, function (err) { | ||
if (err) throw err; | ||
console.log('json file location: ' + filepath); | ||
}); | ||
}; | ||
|
||
this.registerListener(JsonFormatter); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ exports.config = { | |
}, | ||
specs: ['features/*.feature'], | ||
cucumberOpts: { | ||
format: 'json' | ||
format: 'pretty' | ||
} | ||
}; | ||
|