A gem to assist in building page-object like structures for testing iOS applications. furter
uses frank-cucumber
to automate iOS applications using page-objects.
Add this line to your application's Gemfile:
source 'https://rubygems.org'
gem 'furter'
And then execute:
$ bundle
After your Gemfile
has been updated, add these lines to your features/support/env.rb
file in cucumber
:
require 'furter'
require 'rspec-expectations'
World(Furter::Navigation)
APP_BUNDLE_PATH = File.expand_path( '../../../Frank/frankified_build/YourApp.app', __FILE__ )
Frank::Cucumber::FrankHelper.use_shelley_from_now_on
Before do
version = '6.1'
idiom = 'iPhone'
launch_app APP_BUNDLE_PATH, version, idiom
end
Simply create a new class that describes the screen that you are working with and include Furter
.
class LoginScreen
include Furter
text(:username, :label => 'usernameField')
text(:password, :label => 'passwordField')
button(:login, :text => 'Login')
end
In your step definition, use the Furter::Navigation#on
method when using your page-object. This method will create your screen and then wait until all animations have stopped before letting you interact with your page-object.
When ^I login to my application$ do
on(LoginScreen) do |screen|
screen.username = 'user@example.com'
screen.password = '$3cr3t'
screen.login
end
end
If you would like for furter
to wait until your screen becomes "active" (perhaps after some asynchronous call has come back), simply define an active?
method and furter
will wait until this returns true
before interacting with it.
class LandingScreen
include Furter
def active?
has_text? 'You have successfully logged in!'
end
end
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request