Automated screenshots and/or Snapshot Testing?

I found this video (https://www.youtube.com/watch?v=AvnZhqC50Iw) from Ionic itself about a screenshot testing tool from May 2014… what happened to it?

I’d love to integrate automated screenshots (taking them for the app store manually is a pain) into my tests, but am looking for a place to start. I can’t seem to find out to have the browser render the views as if it were a specific OS (similar to how ionic serve --lab gives different views for iOS and Android)

It looks like ionic serve defaults to iOS while ionic serve --lab adds in Android? Maybe I can use ionic serve w/window resizes to take the iOS screenshots, and then do an ionic serve --lab and screenshot a part of the window?

I find it hard to believe no one else has automated this…

Have you looked at Fastlane?

Fastlane looks interesting, but it also looks like it’s iOS only. Half is better than none though.

I’ll see if I can hack something together and if I do I’ll share it

It seems to work also for Android, see https://github.com/fastlane/fastlane/blob/master/docs/Android.md

I’ve tried it and it crashes when i “record” my actions on xCode in order to take the screenshots. Might be a problem of how i am executing the steps though. :frowning:

I was able to setup fastlane, but not the screenshot tool.

When you start recording the test, all the clicks on the webview are treated the same way, making it impossible for Xcode to reproduce the interaction because it can’t find the buttons inside the webview.

Did you manage to make it work, @gmarziou?

I hate to semi-necro this topic, but has anyone had any luck using fastlane’s snapshot tool with Ionic / Cordova?

When I try and record a UI test, half of the buttons I press (e.g. items in a list) show up as element.tap() which is useless, because element() is only defined once, so it’s basically doing repeated taps on an element on another page.

I’d just plough through this and use the simulator, but the Macbook I have is hopelessly slow (it’s a 2009 Macbook with 2gb of RAM – I bought the bare minimum I needed to build and test on a real device, then submit to the app store)

Any suggestions?

EDIT: I wrote a blog post on making iOS screenshots using Firefox and the ionic serve command. It’s not the best way to go about it, but with a really slow Mac like mine, I was determined not to use the simulator.