briar 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +29 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +36 -0
  5. data/README.md +25 -0
  6. data/Rakefile +12 -0
  7. data/briar.gemspec +26 -0
  8. data/dotirbc_briar_additions +31 -0
  9. data/features/step_definitions/alerts_and_sheets/action_sheet_steps.rb +8 -0
  10. data/features/step_definitions/alerts_and_sheets/alert_view_steps.rb +25 -0
  11. data/features/step_definitions/bars/navbar_steps.rb +95 -0
  12. data/features/step_definitions/bars/tabbar_steps.rb +32 -0
  13. data/features/step_definitions/bars/toolbar_steps.rb +17 -0
  14. data/features/step_definitions/briar_core_steps.rb +9 -0
  15. data/features/step_definitions/control/button_steps.rb +57 -0
  16. data/features/step_definitions/control/segmented_control_steps.rb +85 -0
  17. data/features/step_definitions/control/slider_steps.rb +9 -0
  18. data/features/step_definitions/email_steps.rb +59 -0
  19. data/features/step_definitions/image_view_steps.rb +9 -0
  20. data/features/step_definitions/keyboard_steps.rb +21 -0
  21. data/features/step_definitions/label_steps.rb +21 -0
  22. data/features/step_definitions/picker/date_picker_steps.rb +216 -0
  23. data/features/step_definitions/picker/picker_steps.rb +58 -0
  24. data/features/step_definitions/scroll_view_steps.rb +20 -0
  25. data/features/step_definitions/table_steps.rb +186 -0
  26. data/features/step_definitions/text_field_steps.rb +37 -0
  27. data/features/step_definitions/text_view_steps.rb +44 -0
  28. data/features/support/env.rb +0 -0
  29. data/features/support/hooks.rb +0 -0
  30. data/features/support/launch.rb +0 -0
  31. data/lib/briar.rb +72 -0
  32. data/lib/briar/alerts_and_sheets/alert_view.rb +16 -0
  33. data/lib/briar/bars/navbar.rb +104 -0
  34. data/lib/briar/bars/tabbar.rb +38 -0
  35. data/lib/briar/bars/toolbar.rb +36 -0
  36. data/lib/briar/briar_core.rb +56 -0
  37. data/lib/briar/briar_steps.rb +26 -0
  38. data/lib/briar/control/button.rb +47 -0
  39. data/lib/briar/control/segmented_control.rb +22 -0
  40. data/lib/briar/control/slider.rb +34 -0
  41. data/lib/briar/cucumber.rb +49 -0
  42. data/lib/briar/email.rb +58 -0
  43. data/lib/briar/gestalt.rb +80 -0
  44. data/lib/briar/image_view.rb +27 -0
  45. data/lib/briar/keyboard.rb +104 -0
  46. data/lib/briar/label.rb +34 -0
  47. data/lib/briar/picker/date_picker.rb +598 -0
  48. data/lib/briar/picker/picker.rb +32 -0
  49. data/lib/briar/picker/picker_shared.rb +34 -0
  50. data/lib/briar/scroll_view.rb +10 -0
  51. data/lib/briar/table.rb +237 -0
  52. data/lib/briar/text_field.rb +57 -0
  53. data/lib/briar/text_view.rb +21 -0
  54. data/lib/briar/version.rb +3 -0
  55. data/spec/briar/gestalt_spec.rb +62 -0
  56. data/spec/spec_helper.rb +17 -0
  57. metadata +164 -0
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDRhZjY3ZTNjMzQyMDEzNDY4YTI1MzY2OWU0ZjMyNTgyNzA1YzU5OQ==
5
+ data.tar.gz: !binary |-
6
+ MjRjZWU5ZTI0NjQwMTYxMDlhNjZlZWQ1NjNmNjhjM2U2ZDFkYzE5Mg==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ MDllMGU4ZmVjYjIwMDdlZjJmNDJkZGJjYTc5MWY1ZjFmOWMwOTFlMDRmYmE3
10
+ YjVmMDZjODI0NTlmZTJkN2MwOTVmNzAxMTFjYTA2YjIxNDhmOWY4NzI4YmU3
11
+ NTFkMjhkMmRmMTNlOGI3YWExYjUyZDBhZDkwMjFkNzVhOWVkODk=
12
+ data.tar.gz: !binary |-
13
+ ZjQ4YWZjMjE4N2NhMGIyYzEzZDFlZTc1NTJlODg3MWI2ZGM1MDU1MzAxNjg3
14
+ NWU2Zjc2YWViOTg3ZmM3YzJjY2Q0YmVhNzMwM2QxNTEyNjY2ZjcyMDkzYTJj
15
+ MjM2MmRhMGNlZmJhNGRmMzEzNGYyM2JmNDZiNDFlNjRkMTFjZjk=
data/.gitignore ADDED
@@ -0,0 +1,29 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ vendor
10
+ coverage
11
+ doc/
12
+ lib/bundler/man
13
+ pkg
14
+ rdoc
15
+ spec/reports
16
+ test/tmp
17
+ test/version_tmp
18
+ tmp
19
+
20
+ # JetBrains
21
+ .idea
22
+
23
+ # mac
24
+ .DS_Store
25
+ __MACOSX
26
+
27
+ # emacs turds
28
+ (.*/)?\#[^/]*\#$
29
+
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in briar.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,36 @@
1
+ #
2
+ # ----------------------------------------------------------------------------
3
+ # "THE BEER-WARE LICENSE" (Revision 42): As long as you retain this
4
+ # notice you can do whatever you want with this stuff. If we meet some
5
+ # day, and you think this stuff is worth it, you can buy me a beer in
6
+ # return.
7
+ # ----------------------------------------------------------------------------
8
+ #
9
+ #
10
+ # Copyright (c) 2010 Little Joy Software
11
+ # All rights reserved.
12
+ #
13
+ # Redistribution and use in source and binary forms, with or without
14
+ # modification, are permitted provided that the following conditions are
15
+ # met:
16
+ # * Redistributions of source code must retain the above copyright
17
+ # notice, this list of conditions and the following disclaimer.
18
+ # * Redistributions in binary form must reproduce the above copyright
19
+ # notice, this list of conditions and the following disclaimer in
20
+ # the documentation and/or other materials provided with the
21
+ # distribution.
22
+ # * Neither the name of the Little Joy Software nor the names of its
23
+ # contributors may be used to endorse or promote products derived
24
+ # from this software without specific prior written permission.
25
+ #
26
+ # THIS SOFTWARE IS PROVIDED BY LITTLE JOY SOFTWARE ''AS IS'' AND ANY
27
+ # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28
+ # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29
+ # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL LITTLE JOY SOFTWARE BE
30
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
33
+ # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
34
+ # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
35
+ # OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,EVEN
36
+ # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
data/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # Briar
2
+
3
+ extends calabash-ios steps to provide steps for controlling complex ui
4
+ elements like tables and pickers.
5
+
6
+ ## Why briar?
7
+
8
+ * http://en.wikipedia.org/wiki/Smoking_pipe_(tobacco)#Calabash
9
+ * http://en.wikipedia.org/wiki/Smoking_pipe_(tobacco)#Briar
10
+
11
+ ## Installation
12
+
13
+ not ready for release
14
+
15
+ ## Usage
16
+
17
+ TODO: Write usage instructions here
18
+
19
+ ## Contributing
20
+
21
+ 1. Fork it
22
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
23
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
24
+ 4. Push to the branch (`git push origin my-new-feature`)
25
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ require "bundler/gem_tasks"
2
+ require "./lib/briar/version.rb"
3
+ task :show_simulator do
4
+ sh "/usr/bin/osascript -e 'tell application \"iPhone Simulator\" to activate'"
5
+ sh "/usr/bin/osascript -e 'tell application \"RubyMine\" to activate'"
6
+ end
7
+
8
+ task :gem do
9
+ sh "rm -f *.gem"
10
+ sh "gem build briar.gemspec --verbose"
11
+ sh "gem install briar-#{Briar::VERSION}.gem"
12
+ end
data/briar.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ #lib = File.expand_path('../lib', __FILE__)
4
+ #$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'briar/version'
6
+
7
+ Gem::Specification.new do |gem|
8
+ gem.name = "briar"
9
+ gem.version = Briar::VERSION
10
+ gem.authors = ["Joshua Moody"]
11
+ gem.email = ["joshuajmoody@gmail.com"]
12
+ gem.description = 'extends calabash-ios steps'
13
+ gem.summary = "briar-#{gem.version}"
14
+ gem.homepage = "https://github.com/jmoody/briar"
15
+
16
+ gem.add_runtime_dependency 'calabash-cucumber'
17
+
18
+ gem.add_development_dependency 'rspec'
19
+ gem.add_development_dependency 'rvm'
20
+
21
+
22
+ gem.files = `git ls-files`.split($/)
23
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
24
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
25
+ gem.require_paths = ["lib"]
26
+ end
@@ -0,0 +1,31 @@
1
+ require "briar/gestalt"
2
+ require "briar/briar_core"
3
+ require "briar/alerts_and_sheets/alert_view"
4
+ require "briar/bars/tabbar"
5
+ require "briar/bars/navbar"
6
+ require "briar/bars/toolbar"
7
+ require "briar/control/button"
8
+ require "briar/control/segmented_control"
9
+ require "briar/control/slider"
10
+ require "briar/picker/picker_shared"
11
+ require "briar/picker/picker"
12
+ require "briar/picker/date_picker"
13
+ require "briar/email"
14
+ require "briar/image_view"
15
+ require "briar/keyboard"
16
+ require "briar/label"
17
+ require "briar/scroll_view"
18
+ require "briar/table"
19
+ require "briar/text_field"
20
+ require "briar/text_view"
21
+
22
+ include Briar::Bars
23
+ include Briar::Alerts_and_Sheets
24
+ include Briar::Control::Button
25
+ include Briar::Control::Segmented_Control
26
+ include Briar::Control::Slider
27
+ include Briar::Picker
28
+ include Briar::Picker::Date
29
+ include Briar::Picker_Shared
30
+ include Briar::Core
31
+
@@ -0,0 +1,8 @@
1
+ #include Briar::Core
2
+
3
+ Then /^I touch the "([^"]*)" button on the action sheet$/ do |button_title|
4
+ wait_for_animation
5
+ wait_for_animation
6
+ touch("actionSheet child button marked:'#{button_title}'")
7
+ wait_for_animation
8
+ end
@@ -0,0 +1,25 @@
1
+ #include Briar::Alerts_and_Sheets
2
+
3
+ Then /^I should see alert with "([^"]*)" button$/ do |button_id|
4
+ should_see_alert_button button_id
5
+ end
6
+
7
+ Then /^I should see alert with title "([^"]*)"$/ do |title|
8
+ unless query("alertView child label", :text).include?(title)
9
+ screenshot_and_raise "i do not see an alert view with title '#{title}'"
10
+ end
11
+ end
12
+
13
+
14
+ Then /^I should see alert with message "([^"]*)"$/ do |message|
15
+ unless query("alertView child label", :text).include?(message)
16
+ screenshot_and_raise "i do not see an alert view with message '#{message}'"
17
+ end
18
+ end
19
+
20
+ Then /^I should not see an alert$/ do
21
+ res = query("alertView")
22
+ unless res.empty?
23
+ screenshot_and_raise "i expected to see no alert view, but found '#{res}'"
24
+ end
25
+ end
@@ -0,0 +1,95 @@
1
+ #include Briar::Bars
2
+
3
+ # navigation back item, distinct from left bar button item
4
+ Then /^I should see navbar back button$/ do
5
+ should_see_navbar_back_button
6
+ end
7
+
8
+ Then /^I should see a back button in the navbar$/ do
9
+ should_see_navbar_back_button
10
+ end
11
+
12
+ # navigation back item, distinct from left bar button item
13
+ Then /^I should not see navbar back button$/ do
14
+ if navbar_has_back_button?
15
+ screenshot_and_raise "there should be no navigation bar back button"
16
+ end
17
+ end
18
+
19
+ Then /^I touch navbar button "([^"]*)"$/ do |name|
20
+ touch_navbar_item(name)
21
+ end
22
+
23
+ Then /^I touch right navbar button$/ do
24
+ touch("navigationButton index:1")
25
+ step_pause
26
+ end
27
+
28
+
29
+ Then /^I should see navbar with title "([^\"]*)"$/ do |title|
30
+ navbar_should_have_title title
31
+ end
32
+
33
+
34
+ Then /^I should (not see|see) (?:the|an?) "([^"]*)" button in the navbar$/ do |visibility, name|
35
+ if visibility.eql? "see"
36
+ should_see_navbar_button name
37
+ else
38
+ should_not_see_navbar_button name
39
+ end
40
+ end
41
+
42
+ When /^I touch the "([^"]*)" navbar button, then I should see the "([^"]*)" view$/ do |button_name, view_id|
43
+ idx = index_of_navbar_button button_name
44
+ if idx
45
+ touch_transition("navigationButton index:#{idx}",
46
+ "view marked:'#{view_id}'",
47
+ {:timeout=>TOUCH_TRANSITION_TIMEOUT,
48
+ :retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
49
+ else
50
+ screenshot_and_raise "could not find navbar item '#{button_name}'"
51
+ end
52
+ end
53
+
54
+ Then /^I go back after waiting$/ do
55
+ go_back_after_waiting
56
+ end
57
+
58
+ Then /^I go back and wait for "([^\"]*)"$/ do |view|
59
+ go_back_and_wait_for_view view
60
+ end
61
+
62
+ Then /^I touch the "([^"]*)" navbar button$/ do |name|
63
+ touch_navbar_item name
64
+ end
65
+
66
+ Then /^I should see that the navbar has title "([^"]*)"$/ do |title|
67
+ navbar_should_have_title title
68
+ end
69
+
70
+ Then /^I touch the "([^"]*)" button in the navbar$/ do |name|
71
+ touch_navbar_item name
72
+ end
73
+
74
+ Then /^I should see a back button in the navbar with the title "([^"]*)"$/ do |title|
75
+ if query("navigationItemButtonView marked:'#{title}'").empty?
76
+ screenshot_and_raise "the navbar should have a back button with title #{title}"
77
+ end
78
+ end
79
+
80
+ When /^I go back, I should see the "([^"]*)" view$/ do |view_id|
81
+ touch_transition("navigationItemButtonView first",
82
+ "view marked:'#{view_id}'",
83
+ {:timeout=>TOUCH_TRANSITION_TIMEOUT,
84
+ :retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
85
+ end
86
+
87
+ Then /^I should see today's date in the navbar$/ do
88
+ now = Time.now
89
+ unless date_is_in_navbar(now)
90
+ with_leading = now.strftime("%a %b %d")
91
+ without_leading = now.strftime("%a %b #{date.day}")
92
+ screenshot_and_raise "could not find #{with_leading} or #{without_leading} " +
93
+ "in the date bar"
94
+ end
95
+ end
@@ -0,0 +1,32 @@
1
+ #include Briar::Bars
2
+
3
+ Then /^I should see tabbar button "([^"]*)" at index (\d+)$/ do |name, index|
4
+ unless tabbar_item_is_at_index(name, index)
5
+ screenshot_and_raise "tabbar button with name #{name} does not exist at index " +
6
+ index.to_s
7
+ end
8
+ end
9
+
10
+ Given /^that the tabbar is visible$/ do
11
+ should_see_tabbar
12
+ end
13
+
14
+
15
+ Then /^I should not see the tabbar$/ do
16
+ screenshot_and_raise "should not be able to see tabbar" if tabbar_visible?
17
+ end
18
+
19
+ Then /I touch (?:the) "([^"]*)" tab$/ do |name|
20
+ touch_tabbar_item name
21
+ end
22
+
23
+ Then /^the tabbar is visible$/ do
24
+ macro 'that the tabbar is visible'
25
+ end
26
+
27
+ When /^I touch the "([^"]*)" tab I should see the "([^"]*)" view$/ do |tab_label, view_id|
28
+ should_see_tabbar
29
+ touch_tabbar_item tab_label
30
+ should_see_view_after_animation view_id
31
+ end
32
+
@@ -0,0 +1,17 @@
1
+ #include Briar::Bars
2
+ #include Briar::Core
3
+
4
+ Then /^I touch the "([^"]*)" toolbar button$/ do |name|
5
+ should_see_toolbar_button name
6
+ touch("toolbar descendant view marked:'#{name}'")
7
+ step_pause
8
+ end
9
+
10
+ When /^I touch the "([^"]*)" toolbar button, then I should see the "([^"]*)" view$/ do |button_name, view_id|
11
+ should_see_toolbar_button button_name
12
+ touch_transition("toolbar descendant view marked:'done with info'",
13
+ "view marked:'#{view_id}'",
14
+ {:timeout=>TOUCH_TRANSITION_TIMEOUT,
15
+ :retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
16
+ end
17
+
@@ -0,0 +1,9 @@
1
+ #include Briar::Core
2
+
3
+ Then /^I should (see|not see) (?:the|) "([^\"]*)" view$/ do |visibility, view_id|
4
+ if visibility.eql? "see"
5
+ should_see_view_after_animation view_id
6
+ else
7
+ should_not_see_view_after_animation view_id
8
+ end
9
+ end
@@ -0,0 +1,57 @@
1
+ #include Briar::Control::Button
2
+
3
+ Then /^I should see button "([^\"]*)" is enabled$/ do |name|
4
+ should_see_button name
5
+ unless button_is_enabled name
6
+ screenshot_and_raise "i did not see that #{name} was enabled"
7
+ end
8
+ end
9
+
10
+ Then /^I should see button "([^\"]*)" is disabled$/ do |name|
11
+ should_see_button name
12
+ if button_is_enabled name
13
+ screenshot_and_raise "i did not see that #{name} was disabled"
14
+ end
15
+ end
16
+
17
+ Then /^I touch "([^"]*)" button$/ do |name|
18
+ touch_button name
19
+ end
20
+
21
+ When /^I touch the "([^"]*)" button, then I should see the "([^"]*)" view$/ do |button_id, view_id|
22
+ touch_transition("button marked:'#{button_id}'",
23
+ "view marked:'#{view_id}'",
24
+ {:timeout=>TOUCH_TRANSITION_TIMEOUT,
25
+ :retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
26
+ end
27
+
28
+ Then /^I touch the "([^"]*)" button and wait for (?:the|a) "([^"]*)" view$/ do |button_id, view_id|
29
+ touch_transition("button marked:'#{button_id}'",
30
+ "view marked:'#{view_id}'",
31
+ {:timeout=>TOUCH_TRANSITION_TIMEOUT,
32
+ :retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
33
+ end
34
+
35
+ Then /^I should see the "([^"]*)" button has title "([^"]*)"$/ do |button_id, title|
36
+ should_see_button_with_title button_id, title
37
+ end
38
+
39
+ Then /^I should not see "([^"]*)" button$/ do |button_id|
40
+ if button_exists? button_id
41
+ screenshot_and_raise "should not see button: '#{button_id}'"
42
+ end
43
+ end
44
+
45
+ Then /^I should see "([^"]*)" button$/ do |button_id|
46
+ unless button_exists? button_id
47
+ screenshot_and_raise "should see button '#{button_id}'"
48
+ end
49
+ end
50
+
51
+ Then /^I should see the "([^"]*)" button is (disabled|enabled)$/ do |button_id, state|
52
+ res = query("button marked:'record an urge'", :isEnabled).first
53
+ str_state = state.eql?("disabled") ? "0" : "1"
54
+ unless res.eql?(str_state)
55
+ screenshot_and_raise "expected to see '#{button_id}' that is '#{state}' but found '#{res}'"
56
+ end
57
+ end