Twitter: raymondcamden


Address: Lafayette, LA, USA

Proof of Concept - An Edge Inspect Screenshot Viewer

11-06-2012 3,924 views Mobile, JavaScript 4 Comments

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

4 Comments

  • sam #
    Commented on 11-06-2012 at 5:20 PM
    Really enjoying your blog articles!
    And looking to your Parse.com Facebook episode..

    Do you know of any HTML5 mobile app template selling resource, similar to the ios http://www.appdesignvault.com.
    I know there is themeforest.net..

    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..
  • Commented on 11-07-2012 at 1:40 PM
    Sorry, no. Surprised there isn't one out there yet.
  • Peter Schmalfeldt #
    Commented on 01-17-2013 at 3:27 PM
    I've created something similar that also supports filtering the snapshots.

    https://github.com/manifestinteractive/edge-inspec...
  • Commented on 01-17-2013 at 3:33 PM
    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. :)

Post Reply

Please refrain from posting large blocks of code as a comment. Use Pastebin or Gists instead. Text wrapped in asterisks (*) will be bold and text wrapped in underscores (_) will be italicized.

Leave this field empty