niffy icon indicating copy to clipboard operation
niffy copied to clipboard

Handling click events and screenshots with Niffy

Open alexjtark opened this issue 6 years ago • 1 comments

Trying to work out how to do this given the limited documentation currently.
Im aiming to run the Niffy screenshot on page load, then do some page interaction (ex: open a menu), and take a new screenshot at that moment so in the end i will have 2 screenshots of the page to compare against my base screenshots of those same instances.

Im assuming some nightmare API interaction will be needed but just hoping I could get some wisdom on how to do it.

Thank you.

alexjtark avatar Jul 21 '17 19:07 alexjtark

Newb-leading-the-newb here, but it seems that the callback to test() and goto() gets the Nightmare object as an argument. You can then call Nightmare methods (which return Promises) on it. The example here https://github.com/segmentio/niffy#gotourl-fn does this in the before, but I believe you can do it in a test case too.

I'd be curious to hear whether manipulating the Nightmare instance in these callbacks affects subsequent tests. Maybe the maintainers have some advice?

jessehattabaugh avatar Aug 01 '17 21:08 jessehattabaugh