@@ -74,9 +74,6 @@ module.exports = function (config) {
74
74
} ) ;
75
75
76
76
event . dispatcher . on ( event . step . finished , ( step ) => {
77
- if ( ! isBDD ( step ) ) return ;
78
- // calculate the duration in nanoseconds for cucumber-html-reporter
79
- report . step . result . duration = ( step . endTime - step . startTime ) * 1000000 ;
80
77
if ( step . helperMethod === 'saveScreenshot' ) {
81
78
const filePath = path . join ( global . output_dir , step . args [ 0 ] ) ;
82
79
addScreenshotToReport ( filePath ) ;
@@ -91,6 +88,9 @@ module.exports = function (config) {
91
88
recorder . add ( 'Set step position' , async ( ) => {
92
89
report . step = report . scenario . steps [ report . stepPosition ] ;
93
90
} ) ;
91
+ recorder . add ( 'Set step starting time' , async ( ) => {
92
+ if ( report && report . step ) report . step . start_time = Date . now ( ) ;
93
+ } ) ;
94
94
} ) ;
95
95
96
96
event . dispatcher . on ( event . bddStep . after , ( ) => {
@@ -101,6 +101,13 @@ module.exports = function (config) {
101
101
// and if bddStep after event is emitted, it should have passed
102
102
if ( report . step . result . status === 'skipped' ) report . step . result . status = 'passed' ;
103
103
} ) ;
104
+ recorder . add ( 'Set step end time and duration' , async ( ) => {
105
+ if ( report && report . step ) {
106
+ report . step . end_time = Date . now ( ) ;
107
+ // calculate the duration in nanoseconds for cucumber-html-reporter
108
+ report . step . result . duration = ( report . step . end_time - report . step . start_time ) * 1000000 ;
109
+ }
110
+ } ) ;
104
111
} ) ;
105
112
106
113
// finalize and write your json file after all complete
0 commit comments