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
Support for screenshots gone? #25
Comments
Thank for your contribution. I don't think that's gone just need more manual effort. You want to create screenshots on failure? |
@mucsi96 I had this sort-of-working until I realized the problems with This is what I was doing, in // Passing a callback
After(function(testCase, callback) {
if (testCase.result.status === Status.FAILED) {
const world = this;
const filepath = `./screenshots/${faker.random.uuid()}.png`;
client.saveScreenshot(filepath, screenshot => {
try {
world.attach(screenshot.value, 'image/png', callback);
} catch(e) {
callback();
}
}
);
} else {
callback();
}
}); Passing the |
I see. Can you do some deeper investigation on this? I am not at my computer for 2 weeks |
When creating a client in export async function createSession(options: IOptions): Promise<Api> {
createRunner(options);
const settings = runner.test_settings;
client = createClient(settings, new reporter([], 0, {}, {}));
await client.startSession();
log('Session created');
return client.api;
} Currently it is being passed an empty Note that when no See here https://github.com/nightwatchjs/nightwatch/blob/master/lib/index.js#L414 I haven't had time to test this yet, so may not be this issue... UPDATE I've done some testing and this doesn't seem to be the issue. In addition to The I made these "fixes" locally, ran my tests again, but still no screenshots. My failing test is being treated as passed, and is being handled by the Note that Wondering if this is related to #26 Sorry for the noise here - just thought I'd share my findings incase it points someone else in the right direction. |
I have created a PR for this. After review we can release it. After that I am waiting for your feedback 👍 |
Feature released in |
I followed the same example in cucumber-example and one of my step definition for title got failed, still After function has been success and no screenshot is getting saved to the folder. Could anyone help me what is the actual issue i am using cucumber-js, html reporter latest versions and nightwatch api latest version. Thanks, |
Have you enabled the screenshot creation on failure? Search for screenshot in the docs. Looks like its missing from the cucumber html repoter docs. Will update the docs |
yes i enabled screenshots:{ |
Then something is wrong with screenshot creation. What path are you using? Maybe there is something about it. Can you try both relative and absolute path. Currently it works fine on my machine and on CI Linux |
I used both relative and absolute path still not working and below are the versions i am using |
The last think I car recommend is to clone the repo and try to run the examples on your machine. Check if screenshot is created in cucumber example if you make some step failing |
Even I have tried with cucumber-example by altering line number 17 as below and found screenshots under screenshots folder.
|
@gnaneswarreddy any updates? |
Great! Happy to help! Will add screenshot enabling to html reporting section |
Hi, |
@gnaneswarreddy You are right. This is not the right forum to ask. But just to help you out, check the below URL. http://nightwatchjs.org/api/moveToElement.html |
Hi, |
Hi, Thanks, |
Hi! Unfortunately this is implemented currently to skip the the successful cases. See
But it's quite easy to change. Would appreciate if you can contribute and send a pull request for this. Also please create a separate issue for this as this thread is getting too long :) |
Based on Nightwatch docs it also doesn't support auto screenshot creation on success. See
But you can manually create screenshot any time. |
Yes i tried the same way for failure and it was successfully getting saved to disk. But i have to use the screenshots used in pass scenario in cucumber-html-reporter. As you have mentioned if (client && client.api.screenshotsPath) { Can we have the option so that we can also save the screenshots and it automatically be pulled up in reporter framework also? |
When do you want to do the scrrenshots? After every step or after every scenario as last step? |
after every step if possible |
It's easy to make screenshot after every scenario using cucumber hooks. Unfortunatly the step hook was removed from cucumber. So its harder. Also I dont think we can do much in this package |
This is the issue you can follow cucumber/cucumber-js#997 |
I was wondering if the support for screenshots that nightwatch-cucumber is gone now? I can't find any references in this repo and configs that worked in n-c do not work now.
The text was updated successfully, but these errors were encountered: