Davis W. Frank's blog



Davis W. FrankDavis W. Frank
Capybara, Selenium, Webkit and your Mobile Site
edit Posted by Davis W. Frank on Saturday July 16, 2011 at 11:12AM

Your app now has mobile-friendly views. Do they have any Webkit-specific functionality that you want to test in-browser? Or rather, why are you testing your mobile views in desktop Firefox? Is it because Capybara/Selenium support for Webkit browsers was sketchy? Worry no more. Chrome 12, Capybara 1.0, and Selenium 2 are your new best friends.

So install Chrome, make sure your Gemfile has Capybara set to >= 1.0, bundle install and let's get configuring.

Update your SpecHelper

You have to tell Capybara that you want to use Selenium/Webdriver and Chrome. Put this in your spec_helper.rb file

Capybara.register_driver :selenium_chrome do |app|
  Capybara::Selenium::Driver.new(app, :browser => :chrome)
end

Chrome & chromedriver

While there's been limited Selenium support in Chrome for a while, with release 12 there is an entirely new and complete automation interface to Chrome. To use it you need a platform-specifc chromedriver binary in order to connect Webdriver and Chrome. Download it, make sure it's executable, and put it on your path.

Chrome likes to update, so stay on the general release (if you can) to reduce update frequency. You can even take steps to prevent Chrome from updating, but I'll leave that as an exercise for the reader.

BOOM

That should be enough to get your Capybara specs to start using Chrome. You'll want to play with your setup and maybe only run some specs with this driver.

Caveats

Webdriver does not appear to support Safari. This may matter to you if you're using this setup to approximate Mobile Safari. But for the types of tests you're likely writing for Selenium it should be good enough. After all, every mobile Webkit build is slightly different.

While complete (in terms of browser features) and far faster than previous Selenium-Chrome pairings, it's still slow-ish - for example, typing isn't nearly as fast as Firefox. So you might not want to make this your default stack for your entire Rails app.

You might make it your only stack if you're testing a Webkit & JavaScript only framework, say an HP webOS application using Enyo.

But that's another post.

Davis W. FrankDavis W. Frank
Ending Support for Tweed, our Twitter client for HP webOS
edit Posted by Davis W. Frank on Tuesday May 17, 2011 at 12:42PM

Over the past two years we've worked on Tweed, our webOS Twitter client, we've learned a lot about mobile development, JavaScript techniques and of course the Twitter client space. But the landscape has changed a lot recently so we've been thinking a lot about Tweed.

Davis W. FrankDavis W. Frank
webOS Workshop Tech Talk posted
edit Posted by Davis W. Frank on Thursday February 18, 2010 at 10:29PM

As promised, the video from the webOS Workshop we held on January 23rd is posted on our talks page.

It's full of tips & tricks for developing webOS applications, including a live "pairing" session with the audience.

Slides (such as they are) are posted here.

Davis W. FrankDavis W. Frank
What's so funny 'bout pseudo-classical inheritance (in JavaScript)?
edit Posted by Davis W. Frank on Monday February 15, 2010 at 05:17PM

Our customers are asking for richer interfaces and user experiences. And so we - and by "we" I mean the Rails development community - are writing more and more JavaScript. We've gone from ignoring JS (using RJS server-side) to rendering JSON and writing our own jQuery plugins.

But in this transition some of us left our objects & design patterns on the server. Just because you're writing a click handler in JavaScript doesn't mean it couldn't, or shouldn't, be a method on an object.

Davis W. FrankDavis W. Frank
Report: Palm webOS Workshop 1/23
edit Posted by Davis W. Frank on Wednesday January 27, 2010 at 08:45PM

Sarah Allen approached Pivotal back in December wanting to host a Palm webOS hack session. She knew that there was curiosity among the San Francisco Rails community about the platform and wanted to have a hands-on coding day where they could learn.

Davis W. FrankDavis W. Frank
"Evening with webOS" Posted, PreDevCamp
edit Posted by Davis W. Frank on Wednesday August 05, 2009 at 08:56AM

Our "Palm webOS Night @ Pivotal Labs" was well attended two weeks ago. Mitch Allen, of Palm introduced talks by Palm's Jesse Donaldson & yours truly. Jesse walked through an overview of how to write a Mojo (the name for Palm's framework) application and I shared our experiences, including how test-driven development can work on the platform. After working with Palm's new operating system for several months it was great finally to be able to share our experiences, talk up agile practices, and answer questions.

But don't take my word for it - go see and/or listen for yourself, or just go read Jesse's slides or my slides.

The following week the San Francisco webOS Meetup was at Palm headquarters on July 28th. The organizers asked we give the same talks. We had a larger crowd but had similar questions about platform direction and experiences. While this event at Palm wasn't recorded, the content was largely the same and it was just as great to hear enthusiasm in the community.

This excitement carries over to this Saturday. August 8th is PreDevCamp, a worldwide, self-organizing event where developers will be hacking together to teach & learn how to write applications for webOS.

I'll be at the San Francisco event, which is going to be at Palm in Sunnyvale (not exactly SF), talkin' agile, helping out and of course, hacking a bit. If you're in the Bay Area, come say, "Hi." If you're not, then register for your local PreDevCamp and go code up some apps.