john-doherty / selenium-cucumber-js

Browser automation framework written in pure JavaScript using official selenium-webdriver and cucumber-js
ISC License
120 stars 89 forks source link

how to use attach inside of a step #62

Open stevenraines opened 6 years ago

stevenraines commented 6 years ago

Looking to use the "attach" to include a screenshot of a particular step. This is outlined in cucumber-js as seen by this code:

Given(/^a basic step$/, function() {
  this.attach('Some info.')
  this.attach('{"some", "JSON"}}', 'application/json')
})

from: https://github.com/cucumber/cucumber-js/blob/master/docs/support_files/attachments.md

error is: this.attach is not a function

At first I thought it was because I was using an arrow function (per the cucumber notes this doesn't work because of rebinding), but I switched to a regular function and still no luck.

Thanks!