3

Using protractor-cucumber-framework

How do I modify the console output of the CucumberJs that will output the steps during run time.

Example Scenario in Feature:

Given that Home Page is Displayed
When I Click Sales Button at Home Page
Then Sales Page is Displayed

When Running the Test, it should output the ff. in the console.

Given that Home Page is Displayed - Passed
When I Click Sales Button at Home Page - Passed
Then Sales Page is Displayed - Passed
Ry-ry
  • 210
  • 1
  • 4
  • 15

1 Answers1

3

Change protractor conf.js to specify a formatter in cucumberOpts as following:

exports.config = {

    cucumberOpts: {
        format: [require.resolve('cucumber-pretty')]
    }}
}
yong
  • 13,357
  • 1
  • 16
  • 27
  • To add to this https://github.com/cucumber/cucumber-js/blob/master/docs/cli.md#formats are all the available formats – Ray Jan 16 '19 at 19:38
  • Produce an error: Error: Cannot find module 'cucumber-pretty' in my cucumberjs changelog.md under node_modules `pretty` formatter has been removed. All errors are now reported in a `pretty` format instead. The `progress` formatter is now the default. State on the cucumberjs Update https://github.com/cucumber/cucumber-js/blob/master/CHANGELOG.md#300-2017-08-08 Is there another way to print steps other than using pretty? – Ry-ry Jan 18 '19 at 02:18
  • You need add `cucumber-pretty` as dependency in package.json. And install it before your trying. – yong Jan 18 '19 at 02:37
  • This is my cucumberOptions format: [ 'node_modules/cucumber-pretty', `json:${config.jsonReports}/report.json`, './built/e2e/support/allure-reporter.js', ], and still I did not get this in the Jenkins console output – Ashok kumar Ganesan Nov 04 '20 at 16:13