Coder Social home page Coder Social logo

calios-uikit-extension's Introduction

Gem Version Build Status Coverage Status Code Climate Dependency Status

calios-uikit-extension

Calabash-ios UIKit extension provides convenient metaclasses for Calabash usage.

You can utilise these classes in calabash-ios console as well as in your test automation code.

See similar extension for Calabash-android: calandroid-widget-extension

Installation

In your Gemfile:

gem 'calios-uikit-extension'

Install gem manually:

$ gem install calios-uikit-extension

Supported UIKit elements

Currently small subset of UIKit elements are supported. Supported UIKit elements are:

UIButton UICollectionView UICollectionViewCell UIKeyboardAutomatic UILabel UINavigationBar UISearchBar UISegmentedControl UISwitch UITableView UITableViewCell UITextField UIView UIWebView

Example use cases

Launch calabash-ios console (irb)

$ calabash-ios console

Load calios-uikit-extension

irb> require 'calios-uikit-extension'

Launch your application

irb> start_test_server_in_background

Execute some example Calabash and equivalent calios-uikit-extension commands

query('view')

UIView.query

query("view marked:'myId'")

UIView.query('myId')

query('label index:0', :text).first

UILabel.text

query('label index:1', :text).first

UILabel.text(1)

touch('button')

UIButton.touch

touch('button index:1')

UIButton.touch(1)

touch("button marked:'buttonId'")

UIButton.touch('buttonId')

flash("button marked:'buttonId'")

UIButton.flash('buttonId')

query('label', :font)

UILabel.property(:font)

query("button marked:'buttonId'", :currentTitle).first

UIButton.text('buttonId')

query('switch', :isOn).first.to_boolean

UISwitch.on?

query('tableViewCell').count

UITableViewCell.count

query('collectionView', numberOfItemsInSection:0).first

UICollectionView.number_of_items_in_section

query('collectionView', numberOfItemsInSection:1).first

UICollectionView.number_of_items_in_section(1)

scroll('collectionView', :left)

UICollectionView.scroll(:left)

scroll('tableView', :down)

UITableView.scroll(:down)

scroll_to_collection_view_item(1, 0, {scroll_position: :left})

UICollectionView.scroll_to_item(1, 0, :left)

See available methods for a certain metaclass

UIButton.help

Did you notice alias methods?

UIButton.help --> UIButton.h

UIButton.query --> UIButton.q

UIButton.flash --> UIButton.f

UIButton.property --> UIButton.prop --> UIButton.p

UIButton.touch --> UIButton.tap

Okay, I think you got the point. Time to utilise calios-uikit-extension methods in your test automation code now!

Run the tests

$ bundle

$ bundle exec rake

License

MIT

calios-uikit-extension's People

Contributors

janijegoroff avatar

Watchers

 avatar  avatar  avatar

Forkers

kmorgan1204

calios-uikit-extension's Issues

Error CFFormatError: invalid XML: #<ArgumentError: wrong number of arguments (0 for 1+)

After upgrading to Calabash 0.11.0 from 0.9.169 I receive an error
CFFormatError: invalid XML: #<ArgumentError: wrong number of arguments (0 for 1+) due to Calabash tap method in calabash-cucumber/core.rb:909

Steps to reproduce:

  1. Install calabash-cucumber 0.11.0
  2. Install calios-uikit-extension 0.0.8
  3. Start calabash-ios console: DEVICE_TARGET='iPhone 5 (8.0 Simulator)' calabash-ios console
  4. require 'calios-uikit-extension'
  5. start_test_server_in_background

See discussion from similar problem:
https://groups.google.com/d/msg/calabash-ios/YRPoQGLEWrU/HNHY05NBVP8J

Full console trace:

janis-air:xxx janijegoroff$ DEVICE_TARGET='iPhone 5 (8.0 Simulator)' calabash-ios console
Running irb...
irb(main):001:0> require 'calios-uikit-extension'
true
irb(main):002:0> start_test_server_in_background
CFFormatError: invalid XML: #<ArgumentError: wrong number of arguments (0 for 1+)>
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/core.rb:909:in `tap'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rexml/parsers/baseparser.rb:184:in `pull'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rexml/parsers/treeparser.rb:22:in `parse'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rexml/document.rb:283:in `build'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/rexml/document.rb:44:in `initialize'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbREXMLParser.rb:16:in `new'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbREXMLParser.rb:16:in `block in load'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbREXMLParser.rb:16:in `open'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbREXMLParser.rb:16:in `load'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbCFPropertyList.rb:348:in `load'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbCFPropertyList.rb:248:in `initialize'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:89:in `new'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:89:in `block in derived_data_dir_for_project'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:87:in `each'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:87:in `find'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:87:in `derived_data_dir_for_project'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:223:in `app_bundle_or_raise'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:185:in `detect_app_bundle'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launcher.rb:686:in `detect_app_bundle_from_args'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launcher.rb:521:in `relaunch'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/core.rb:838:in `start_test_server_in_background'
(irb):2:in `irb_binding'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/workspace.rb:86:in `eval'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/workspace.rb:86:in `evaluate'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/context.rb:380:in `evaluate'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb.rb:492:in `block (2 levels) in eval_input'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb.rb:624:in `signal_status'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb.rb:489:in `block in eval_input'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:247:in `block (2 levels) in each_top_level_statement'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in `loop'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:233:in `block in each_top_level_statement'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in `catch'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb/ruby-lex.rb:232:in `each_top_level_statement'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb.rb:488:in `eval_input'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb.rb:397:in `block in start'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb.rb:396:in `catch'
/Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/2.1.0/irb.rb:396:in `start'
/Users/janijegoroff/.rbenv/versions/2.1.2/bin/irb:11:in `<main>'
...
wrong number of arguments (0 for 1+)
Line: -1
Position: -1
Last 80 unconsumed characters:

    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbREXMLParser.rb:26:in `rescue in load'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbREXMLParser.rb:14:in `load'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbCFPropertyList.rb:348:in `load'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/CFPropertyList-2.2.8/lib/cfpropertylist/rbCFPropertyList.rb:248:in `initialize'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:89:in `new'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:89:in `block in derived_data_dir_for_project'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:87:in `each'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:87:in `find'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:87:in `derived_data_dir_for_project'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:223:in `app_bundle_or_raise'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launch/simulator_launcher.rb:185:in `detect_app_bundle'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launcher.rb:686:in `detect_app_bundle_from_args'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/launcher.rb:521:in `relaunch'
    from /Users/janijegoroff/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/gems/calabash-cucumber-0.11.0/lib/calabash-cucumber/core.rb:838:in `start_test_server_in_background'
    from (irb):2
    from /Users/janijegoroff/.rbenv/versions/2.1.2/bin/irb:11:in `<main>'
irb(main):003:0>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.