karma-runner / karma

Spectacular Test Runner for JavaScript
http://karma-runner.github.io
MIT License
11.95k stars 1.71k forks source link

Expose the ability to take screenshots #2304

Open tlrobinson opened 8 years ago

tlrobinson commented 8 years ago

I understand Karma is primarily designed for unit tests, however the ability to screenshot during a test would be very useful for visual regression testing (both automated and manual).

End-to-end frameworks like Protractor or raw WebDriver scripts generally require you handle building the frontend and spinning up a server. Karma already does almost exactly what I need for this use case, except the ability to take a screenshot.

It's currently possible via the PhantomJS launcher, but it would be great if more launchers supported it, especially in a cross-browser way.

MLefebvreICO commented 8 years ago

PhantomJS has a way to take screenshots natively. Other browsers like Chrome or Firefox does not have this natively. I'm pretty sure there's no easy way to do this (or maybe not at all).

gabrielcsapo commented 7 years ago

@MLefebvreICO seems like Chrome does (https://developer.chrome.com/extensions/desktopCapture)

codingawayy commented 7 years ago

Any update on this issue? I am using ChromeHeadless and have been searching for almost half a day now for a way to take screenshot. Any pointers?

sergiubologa commented 4 years ago

After 3 years, anything new on this?

devoto13 commented 4 years ago

Something like karma-puppeteer-launcher should do (see here).

Given that it is already doable and that this feature requires a very specific browser and a very specific browser launcher to work, it is best to be developed as a separate plugin. If you're interested in this feature I would suggest to use/contribute to karma-puppetteer-launcher or a similar plugin.

sergiubologa commented 4 years ago

Thanks, I'll give it a try.

ftfeiteng commented 11 months ago

Just want to comment that this framework works well for me. https://github.com/prantlf/karma-failure-snapshots I am using karma + jasmine on an Angular project