Proof of Concept - An Edge Inspect Screenshot Viewer

This post is more than 2 years old.

This falls into the category of "Possibly Useless", something I thrive on here at the blog, but I thought I'd share in case this actually is useful to someone out there. I've been presenting/tweeting/etc lately on Adobe Edge Inspect. If you haven't tried it out yet, I encourage you to make the time. Edge Inspect makes it incredibly easy to test your web sites on multiple mobile devices at once. Simply set up your devices and open a web page on your desktop and watch as each device navigates to the same URL in sync with your clicks.

Edge Inspect can also gather screen shots from your devices. When Inspect does this, it creates one image (the screen shot obviously) and one text file for each connected device. Here's what my folder looks like now:

And here is a quick example of the detail provided in the corresponding text file.

I thought it might be interesting to build a little web service that could provide a web-based way to browse this data. In order to do this, I needed a way to sync PNG and TXT files together into one logical unit. Each file uses a naming scheme of (date)(time)(devicename). Given that, I thought it would be simple to write some code that could parse out the date/time and name from each "pair" of files. Unfortunately, I found that in some cases, the time was off by a second. I imagine that is due to network issues in transferring the binary data to the host machine running Edge Inspect. I got around this by simply adding a bit of wiggle room - my logic would try to match the device name and a date/time value within 2 seconds.

I created a simple Node.js application and used Express and Handlebars.js for my templating. I decided on a one page application that would use modal windows to display the screen shots. I'll share my code, but as before, remember I'm new to Node. Here's my app.js file. It's going to handle the command line processing (you have to tell it where your Edge Inspect screenshot folder lives) and responding to requests.

My assumption here is that even those of you who don't know Node or Express can get the basics of what I'm doing, but if you have any questions, please ask. The real meat of the application is in inspectparser.js. This is where I do my file IO and file name parsing. Notice that I ended up doing a synchronous file read on the text files because I wasn't sure how to do a deferred in my Node.js code. I've seen a library that supposedly adds that as a feature, but I erred on the side of ease of use. If I really cared, I'd probably add some basic caching since there really isn't a need to reread a txt file once it has been parsed.

Finally, let's take a quick look at the main home page. I'm making use of Bootstrap JS for the layout along with their Modal window support. Note that Express supports layout abstraction so that's in another template. I'm mainly sharing this as a way to give you an example of how Handlebars look within a Node/Express application. Personally I really like it.

And finally, some screenshots of the app itself.

Let me know what you think. I've attached the full source code below.

Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA

Archived Comments

Comment 1 by sam posted on 11/7/2012 at 4:20 AM

Really enjoying your blog articles!
And looking to your Facebook episode..

Do you know of any HTML5 mobile app template selling resource, similar to the ios
I know there is

I think it is more than possible to create an HTML5 app, which looks native, it's just imagery at the end of the day..

Comment 2 by Raymond Camden posted on 11/8/2012 at 12:40 AM

Sorry, no. Surprised there isn't one out there yet.

Comment 3 by Peter Schmalfeldt posted on 1/18/2013 at 2:27 AM

I've created something similar that also supports filtering the snapshots.

Comment 4 by Raymond Camden posted on 1/18/2013 at 2:33 AM

Nice. I want to work more on mine - but am packed this month. (Btw, normally I'd offer to work on yours, or see if you wanted to share dev in general, but I'm finding this code a good way to practice my Node. :)