New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
World does not exit inside setDefinitionFunctionWrapper in Cucumber 3 #937
Comments
Hi @koprivica You are using a arrow function which has no This should do the trick (sorry for the IT-joke ;-)) import { browser } from 'protractor';
import {defineSupportCode} from 'cucumber';
defineSupportCode (({setDefinitionFunctionWrapper}) => {
(async function () {
const screenShot = await browser.takeScreenshot();
this.attach(screenShot, 'image/png');
}) ();
return fn;
}); |
Hi @wswebcreation I tried with:
and got the same: |
Hmm, You are using cucumber i.c.m. with Protractor. When do you want to attach the screenshot? This is for example my implementation and it works as a charm It attaches the screenshot to the report and saves the image to the filesystem (the last can be removed). In my case I only save a screenshot in an Personally I never worked with the |
I think because your trying to access this.attach within a closure. I believe the reference to this is different and won't have access to world. You need to rewrite to remove closure. |
|
Steps Hooks would have been convenient for this use case. Too bad we removed them. |
Closing in favor of #997 as I'm good adding the step hooks back in. They can be built as first class citizens instead of being dependent on an internal |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Hi all,
I am using Cucumber 3.0.3 and Node.js 8.5.
I am trying to attach screenshot after each step by using setDefinitionFunctionWrapper, but it looks like world does not exist in it !
Here is my code:
And here is log:
Anyone pls help.
The text was updated successfully, but these errors were encountered: