pinguo-mazhong / capybara-touch

A Capybara driver for Mobile Webkit to test mobile web apps

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

capybara-touch

A capybara driver that runs your tests against Mobile Webkit via the iOS Simulator.

WARNING: This only works on iOS 6 and below. Chances are, that means it's likely not useful for you as-is.

Installation and Xcode

Capybara-touch requires Xcode, the iOS SDK, and the Xcode Command Line Tools. As such, it is only officially supported on OS X. Xcode and the iOS SDK can be downloaded as a combined package for free from Apple. The Xcode Command Line tools can be downloaded from within the Downloads tab of the Xcode Preferences window, accessible from the Xcode menubar option, or directly from Apple's Xcode Downloads Page (requires login).

Currently, capybara-touch also requires the iOS 6.1 simulator. You can still use Xcode 5 and the latest iOS 7 SDK, but the tests themselves must actually be run against the 6.1 simulator, which can be installed from the Downloads tab of the Xcode Preferences pane.

Warning

This is alpha software. You will find that many pieces of Capybara functionality are not present, and are not yet documented as such. Please feel free to reach out via GitHub Issues if you run into any trouble.

Usage

Add the capybara-touch gem to your Gemfile (use git for now; it will be added to Rubygems very soon, once the rate of development slows slightly):

gem "capybara-touch", git: "git://github.com/lazerwalker/capybara-touch"

In your Capybara tests, set the driver to either :iphone or :ipad, depending on which device family you would like to target:

Capybara.default_driver = :ipad

Goals

Capybara-touch will be considered to be at version 1.0 when it is fully usable as a drop-in replacement in any Capybara test suite, in addition to having a select number of mobile-specific conveniences. This means:

  • Full compatibility with the official Capybara test sute
  • Support for any reasonable combination of device types and iOS versions (including iOS 7)
  • Driver-specific Capybara commands for mobile-only functionality such as the accelerometer, location services, and gestures.

About

The capybara-touch driver was written by Mike Walker. He can be reached at michael@lazerwalker.com.

A significant portion of the Ruby and JavaScript code was lovingly borrowed from the capybara-webkit project.

The Objective-C TCP client code comes from CocoaAsyncSocket, a quite lovely little library for that sort of thing.

License

capybara-touch is Copyright (c) 2013 Mike Walker. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About

A Capybara driver for Mobile Webkit to test mobile web apps

License:MIT License


Languages

Language:Objective-C 83.2%Language:C++ 6.4%Language:Ruby 4.1%Language:C 3.8%Language:Objective-C++ 1.3%Language:JavaScript 0.9%Language:Shell 0.3%