briar 0.1.2 → 0.1.3.b1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/briar.gemspec +12 -12
- data/features/step_definitions/alerts_and_sheets/action_sheet_steps.rb +2 -2
- data/features/step_definitions/bars/tabbar_steps.rb +0 -12
- data/features/step_definitions/control/segmented_control_steps.rb +5 -5
- data/features/step_definitions/email_steps.rb +0 -6
- data/features/step_definitions/keyboard_steps.rb +2 -3
- data/features/step_definitions/picker/date_picker_steps.rb +0 -7
- data/features/step_definitions/scroll_view_steps.rb +0 -7
- data/features/step_definitions/table_steps.rb +1 -12
- data/lib/briar.rb +41 -10
- data/lib/briar/alerts_and_sheets/action_sheet.rb +6 -5
- data/lib/briar/alerts_and_sheets/alert_view.rb +13 -11
- data/lib/briar/bars/navbar.rb +12 -12
- data/lib/briar/bars/tabbar.rb +1 -1
- data/lib/briar/bars/toolbar.rb +13 -11
- data/lib/briar/briar_core.rb +22 -20
- data/lib/briar/briar_uia.rb +18 -5
- data/lib/briar/control/button.rb +7 -6
- data/lib/briar/control/segmented_control.rb +4 -2
- data/lib/briar/control/slider.rb +5 -4
- data/lib/briar/cucumber.rb +1 -0
- data/lib/briar/email.rb +47 -11
- data/lib/briar/image_view.rb +4 -4
- data/lib/briar/{keyboard.rb → keyboard/keyboard.rb} +17 -12
- data/lib/briar/keyboard/uia_keyboard.rb +172 -0
- data/lib/briar/label.rb +5 -3
- data/lib/briar/picker/date_picker.rb +1 -0
- data/lib/briar/picker/date_picker_core.rb +4 -4
- data/lib/briar/picker/date_picker_manipulation.rb +1 -0
- data/lib/briar/scroll_view.rb +1 -1
- data/lib/briar/table.rb +49 -21
- data/lib/briar/text_field.rb +5 -0
- data/lib/briar/text_view.rb +8 -9
- data/lib/briar/version.rb +1 -1
- metadata +7 -6
data/lib/briar/bars/tabbar.rb
CHANGED
@@ -26,7 +26,7 @@ module Briar
|
|
26
26
|
def touch_tabbar_item(name, wait_for_view_id=nil)
|
27
27
|
sleep(0.2)
|
28
28
|
wait_for(:timeout => BRIAR_WAIT_TIMEOUT,
|
29
|
-
:retry_frequency =>
|
29
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ) do
|
30
30
|
index_of_tabbar_item(name) != nil
|
31
31
|
end
|
32
32
|
should_see_tabbar
|
data/lib/briar/bars/toolbar.rb
CHANGED
@@ -56,8 +56,8 @@ module Briar
|
|
56
56
|
end
|
57
57
|
|
58
58
|
options = {:timeout => timeout,
|
59
|
-
:retry_frequency =>
|
60
|
-
:post_timeout =>
|
59
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
60
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
61
61
|
:timeout_message => msg}
|
62
62
|
wait_for(options) do
|
63
63
|
toolbar_button_exists? button_id, opts
|
@@ -73,8 +73,8 @@ module Briar
|
|
73
73
|
def wait_for_toolbar_to_disappear(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
|
74
74
|
msg = "waited for '#{timeout}' seconds but i still see toolbar marked: '#{toolbar_id}'"
|
75
75
|
options = {:timeout => timeout,
|
76
|
-
:retry_frequency =>
|
77
|
-
:post_timeout =>
|
76
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
77
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
78
78
|
:timeout_message => msg}
|
79
79
|
|
80
80
|
wait_for(options) do
|
@@ -86,8 +86,8 @@ module Briar
|
|
86
86
|
def wait_for_toolbar(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
|
87
87
|
msg = "waited for '#{timeout}' seconds but did not see toolbar marked: '#{toolbar_id}'"
|
88
88
|
options = {:timeout => timeout,
|
89
|
-
:retry_frequency =>
|
90
|
-
:post_timeout =>
|
89
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
90
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
91
91
|
:timeout_message => msg}
|
92
92
|
wait_for(options) do
|
93
93
|
toolbar_exists? toolbar_id
|
@@ -104,10 +104,12 @@ module Briar
|
|
104
104
|
:toolbar_id => nil}
|
105
105
|
opts = default_opts.merge(opts)
|
106
106
|
else
|
107
|
-
|
107
|
+
deprecated('0.1.2',
|
108
|
+
"second argument should be a hash - found '#{opts}'",
|
109
|
+
:warn)
|
108
110
|
opts = {:wait_for_view => opts[:wait_for_view],
|
109
|
-
|
110
|
-
|
111
|
+
:timeout => BRIAR_WAIT_TIMEOUT,
|
112
|
+
:toolbar_id => nil}
|
111
113
|
end
|
112
114
|
|
113
115
|
should_see_toolbar_button button_id, opts
|
@@ -120,8 +122,8 @@ module Briar
|
|
120
122
|
timeout = opts[:timeout]
|
121
123
|
msg = "touched '#{button_id}' and waited for '#{timeout}' sec but did not see '#{wait_for_view}'"
|
122
124
|
options = {:timeout => timeout,
|
123
|
-
:retry_frequency =>
|
124
|
-
:post_timeout =>
|
125
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
126
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
125
127
|
:timeout_message => msg}
|
126
128
|
wait_for(options) do
|
127
129
|
view_exists? wait_for_view
|
data/lib/briar/briar_core.rb
CHANGED
@@ -57,15 +57,6 @@ module Briar
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
def should_see_view_after_animation (view_id)
|
61
|
-
pending "WARN: deprecated 0.0.8 - use 'wait_for_view #{view_id}' instead"
|
62
|
-
|
63
|
-
end
|
64
|
-
|
65
|
-
def should_not_see_view_after_animation (view_id)
|
66
|
-
pending "WARN: deprecated 0.0.8 - use 'wait_for_view_to_disappear #{view_id}' instead"
|
67
|
-
end
|
68
|
-
|
69
60
|
def should_see_view_with_text (text)
|
70
61
|
res = view_exists_with_text? text
|
71
62
|
unless res
|
@@ -83,11 +74,18 @@ module Briar
|
|
83
74
|
wait_for_view(view_to_wait_for, timeout)
|
84
75
|
end
|
85
76
|
|
77
|
+
def wait_opts(msg, timeout)
|
78
|
+
{:timeout => timeout,
|
79
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
80
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
81
|
+
:timeout_message => msg}
|
82
|
+
end
|
83
|
+
|
86
84
|
def wait_for_view (view_id, timeout=BRIAR_WAIT_TIMEOUT)
|
87
85
|
msg = "waited for '#{timeout}' seconds but did not see '#{view_id}'"
|
88
86
|
wait_for(:timeout => timeout,
|
89
|
-
:retry_frequency =>
|
90
|
-
:post_timeout =>
|
87
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
88
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
91
89
|
:timeout_message => msg) do
|
92
90
|
view_exists? view_id
|
93
91
|
end
|
@@ -96,8 +94,8 @@ module Briar
|
|
96
94
|
def wait_for_query(qstr, timeout=BRIAR_WAIT_TIMEOUT)
|
97
95
|
msg = "waited for '#{timeout}' seconds but did not see\n '#{qstr}'"
|
98
96
|
wait_for(:timeout => timeout,
|
99
|
-
:retry_frequency =>
|
100
|
-
:post_timeout =>
|
97
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
98
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
101
99
|
:timeout_message => msg) do
|
102
100
|
!query(qstr).empty?
|
103
101
|
end
|
@@ -106,8 +104,8 @@ module Briar
|
|
106
104
|
def wait_for_custom_view (view_class, view_id, timeout=BRIAR_WAIT_TIMEOUT)
|
107
105
|
msg = "waited for '#{timeout}' seconds but did not see '#{view_id}'"
|
108
106
|
wait_for(:timeout => timeout,
|
109
|
-
:retry_frequency =>
|
110
|
-
:post_timeout =>
|
107
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
108
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
111
109
|
:timeout_message => msg) do
|
112
110
|
!query("view:'#{view_class}' marked:'#{view_id}'").empty?
|
113
111
|
end
|
@@ -129,8 +127,8 @@ module Briar
|
|
129
127
|
def wait_for_views(views, timeout=BRIAR_WAIT_TIMEOUT)
|
130
128
|
msg = "waited for '#{timeout}' seconds but did not see '#{views}'"
|
131
129
|
options = {:timeout => timeout,
|
132
|
-
:retry_frequency =>
|
133
|
-
:post_timeout =>
|
130
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
131
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
134
132
|
:timeout_message => msg}
|
135
133
|
wait_for(options) do
|
136
134
|
views.all? { |view_id| view_exists?(view_id) }
|
@@ -140,8 +138,8 @@ module Briar
|
|
140
138
|
def wait_for_view_to_disappear(view_id, timeout=BRIAR_WAIT_TIMEOUT)
|
141
139
|
msg = "waited for '#{timeout}' seconds for '#{view_id}' to disappear but it is still visible"
|
142
140
|
options = {:timeout => timeout,
|
143
|
-
:retry_frequency =>
|
144
|
-
:post_timeout =>
|
141
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
142
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
145
143
|
:timeout_message => msg}
|
146
144
|
wait_for(options) do
|
147
145
|
not view_exists? view_id
|
@@ -166,7 +164,11 @@ module Briar
|
|
166
164
|
|
167
165
|
array = args.kind_of?(Array) ? args : [args]
|
168
166
|
json = "{\":selector\" : \"#{command}\", \":args\" : #{array}}"
|
169
|
-
backdoor('calabash_backdoor_handle_command:', json)
|
167
|
+
res = backdoor('calabash_backdoor_handle_command:', json)
|
168
|
+
if res.eql?('ERROR: no matching selector')
|
169
|
+
screenshot_and_raise "no matching backdoor selector found for '#{command}'"
|
170
|
+
end
|
171
|
+
res
|
170
172
|
end
|
171
173
|
|
172
174
|
def tokenize_list (list)
|
data/lib/briar/briar_uia.rb
CHANGED
@@ -40,7 +40,7 @@ module Briar
|
|
40
40
|
def uia_touch_with_options(point, opts={})
|
41
41
|
defaults = {:tap_count => 1,
|
42
42
|
:touch_count => 1,
|
43
|
-
:duration =>
|
43
|
+
:duration => 0.0}
|
44
44
|
opts = defaults.merge(opts)
|
45
45
|
pt = "{x: #{point[:x]}, y: #{point[:y]}}"
|
46
46
|
args = "{tapCount: #{opts[:tap_count]}, touchCount: #{opts[:touch_count]}, duration: #{opts[:duration]}}"
|
@@ -50,11 +50,24 @@ module Briar
|
|
50
50
|
def dismiss_ipad_keyboard
|
51
51
|
screenshot_and_raise 'cannot dismiss keyboard on iphone' if iphone?
|
52
52
|
screenshot_and_raise 'cannot dismiss keyboard without launching with instruments' unless uia_available?
|
53
|
-
send_uia_command command:"uia.keyboard().buttons()['Hide keyboard'].tap()"
|
53
|
+
send_uia_command command: "uia.keyboard().buttons()['Hide keyboard'].tap()"
|
54
54
|
step_pause
|
55
55
|
end
|
56
56
|
|
57
57
|
def make_ipad_emulation_1x
|
58
|
+
#irb(main):040:0> uia('UIATarget.localTarget().frontMostApp().windows()[2].buttons()[0].label()')
|
59
|
+
#{
|
60
|
+
# "status" => "success",
|
61
|
+
# "value" => "Switch to normal mode",
|
62
|
+
# "index" => 21
|
63
|
+
#}
|
64
|
+
#irb(main):041:0> uia('UIATarget.localTarget().frontMostApp().windows()[2].buttons()[0].label()')
|
65
|
+
#{
|
66
|
+
# "status" => "success",
|
67
|
+
# "value" => "Switch to full screen mode",
|
68
|
+
# "index" => 22
|
69
|
+
#}
|
70
|
+
|
58
71
|
device = device()
|
59
72
|
unless device.ipad?
|
60
73
|
pending 'this trick only works on the iPad'
|
@@ -70,16 +83,16 @@ module Briar
|
|
70
83
|
|
71
84
|
# this only works because iPhone apps emulated on iPads in iOS 7 _always_
|
72
85
|
# launch at 2x
|
73
|
-
uia_touch_with_options({x:738, y:24})
|
86
|
+
uia_touch_with_options({x: 738, y: 24})
|
74
87
|
step_pause
|
75
88
|
end
|
76
89
|
|
77
90
|
def ensure_ipad_emulation_1x
|
78
91
|
device = device()
|
79
92
|
if device.ipad? and device.ios7? and uia_available?
|
80
|
-
uia_touch_with_options({x:738, y:24})
|
93
|
+
uia_touch_with_options({x: 738, y: 24})
|
81
94
|
end
|
82
95
|
end
|
83
96
|
|
84
97
|
end
|
85
|
-
end
|
98
|
+
end
|
data/lib/briar/control/button.rb
CHANGED
@@ -4,6 +4,7 @@ module Briar
|
|
4
4
|
module Control
|
5
5
|
module Button
|
6
6
|
include Briar::Core
|
7
|
+
|
7
8
|
def button_exists? (button_id)
|
8
9
|
res = query("button marked:'#{button_id}'", :alpha)
|
9
10
|
if res.empty?
|
@@ -54,9 +55,9 @@ module Briar
|
|
54
55
|
def wait_for_button (button_id, timeout=BRIAR_WAIT_TIMEOUT)
|
55
56
|
msg = "waited for '#{timeout}' seconds but did not see button '#{button_id}'"
|
56
57
|
wait_for(:timeout => timeout,
|
57
|
-
:retry_frequency =>
|
58
|
-
:post_timeout =>
|
59
|
-
:timeout_message => msg
|
58
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
59
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
60
|
+
:timeout_message => msg) do
|
60
61
|
button_exists? button_id
|
61
62
|
end
|
62
63
|
end
|
@@ -64,9 +65,9 @@ module Briar
|
|
64
65
|
def wait_for_button_with_title (button_id, title, timeout=BRIAR_WAIT_TIMEOUT)
|
65
66
|
msg = "waited for '#{timeout}' seconds but did not see button '#{button_id}' with title '#{title}'"
|
66
67
|
wait_for(:timeout => timeout,
|
67
|
-
:retry_frequency =>
|
68
|
-
:post_timeout =>
|
69
|
-
:timeout_message => msg
|
68
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
69
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
70
|
+
:timeout_message => msg) do
|
70
71
|
button_exists? button_id
|
71
72
|
end
|
72
73
|
should_see_button_with_title(button_id, title)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'calabash-cucumber'
|
2
|
+
|
1
3
|
module Briar
|
2
4
|
module Control
|
3
5
|
module Segmented_Control
|
@@ -20,7 +22,7 @@ module Briar
|
|
20
22
|
num_segs = query(qstr, :numberOfSegments).first.to_i
|
21
23
|
idx = 0
|
22
24
|
while idx < num_segs
|
23
|
-
title = query(qstr, {titleForSegmentAtIndex:idx}).first
|
25
|
+
title = query(qstr, {titleForSegmentAtIndex: idx}).first
|
24
26
|
return idx if title.eql?(segment_id)
|
25
27
|
idx = idx + 1
|
26
28
|
end
|
@@ -59,7 +61,7 @@ module Briar
|
|
59
61
|
tokens.each do |expected|
|
60
62
|
idx = index_of_segment_with_name_in_control_with_id expected, control_id
|
61
63
|
unless idx == counter
|
62
|
-
actual = query("segmentedControl marked:'#{control_id}'", {titleForSegmentAtIndex:counter}).first
|
64
|
+
actual = query("segmentedControl marked:'#{control_id}'", {titleForSegmentAtIndex: counter}).first
|
63
65
|
screenshot_and_raise "expected to see segment '#{expected}' at index '#{counter}' but found '#{actual}'"
|
64
66
|
end
|
65
67
|
counter = counter + 1
|
data/lib/briar/control/slider.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'calabash-cucumber'
|
2
|
+
|
1
3
|
module Briar
|
2
4
|
module Control
|
3
5
|
module Slider
|
@@ -18,11 +20,11 @@ module Briar
|
|
18
20
|
args
|
19
21
|
end
|
20
22
|
|
21
|
-
def briar_slider_set_value(slider_id, value,
|
22
|
-
|
23
|
+
def briar_slider_set_value(slider_id, value, options = {:animate => true,
|
24
|
+
:notify_targets => true})
|
23
25
|
value_str = value.to_f.to_s
|
24
26
|
args = briar_args_for_slider_set_value(options)
|
25
|
-
query_str =
|
27
|
+
query_str = "slider marked:'#{slider_id}'"
|
26
28
|
views_touched = map(query_str, :changeSlider, value_str, *args)
|
27
29
|
if views_touched.empty? or views_touched.member? '<VOID>'
|
28
30
|
screenshot_and_raise "could not slider marked '#{slider_id}' to '#{value}' using query '#{query_str}' with options '#{options}'"
|
@@ -32,7 +34,6 @@ module Briar
|
|
32
34
|
end
|
33
35
|
|
34
36
|
|
35
|
-
|
36
37
|
# WARNING: requires a tap gesture recognizer on the slider
|
37
38
|
# you have been warned
|
38
39
|
def change_slider_value_to(slider_id, value)
|
data/lib/briar/cucumber.rb
CHANGED
data/lib/briar/email.rb
CHANGED
@@ -9,7 +9,7 @@ module Briar
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def email_not_testable?
|
12
|
-
not email_testable?
|
12
|
+
not email_testable?
|
13
13
|
end
|
14
14
|
|
15
15
|
def warn_about_no_ios5_email_view
|
@@ -80,10 +80,6 @@ module Briar
|
|
80
80
|
query("layoutContainerView descendant view:'MFMailComposeView'").count == 1
|
81
81
|
end
|
82
82
|
|
83
|
-
def is_ios6_mail_view
|
84
|
-
warn 'WARN: deprecated 0.0.9'
|
85
|
-
end
|
86
|
-
|
87
83
|
def should_see_mail_view (opts = {:timeout => BRIAR_WAIT_TIMEOUT,
|
88
84
|
:email_view_mark => 'compose email'})
|
89
85
|
|
@@ -97,11 +93,12 @@ module Briar
|
|
97
93
|
|
98
94
|
timeout = opts[:timeout]
|
99
95
|
msg = "waited for '#{timeout}' seconds but did not see email compose view"
|
96
|
+
#noinspection RubyParenthesesAfterMethodCallInspection
|
100
97
|
dev = device()
|
101
98
|
email_view_mark = opts[:email_view_mark]
|
102
99
|
wait_for(:timeout => timeout,
|
103
|
-
:retry_frequency =>
|
104
|
-
:post_timeout =>
|
100
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
101
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
105
102
|
:timeout_message => msg) do
|
106
103
|
if dev.ios5?
|
107
104
|
is_ios5_mail_view
|
@@ -136,6 +133,7 @@ module Briar
|
|
136
133
|
# does a wait for iOS > 5 + uia available
|
137
134
|
should_see_mail_view opts
|
138
135
|
|
136
|
+
#noinspection RubyParenthesesAfterMethodCallInspection
|
139
137
|
device = device()
|
140
138
|
|
141
139
|
if device.ios5?
|
@@ -157,8 +155,8 @@ module Briar
|
|
157
155
|
timeout = BRIAR_WAIT_TIMEOUT * 2
|
158
156
|
msg = "waited for '#{timeout}' seconds but did not see cancel button"
|
159
157
|
wait_for(:timeout => timeout,
|
160
|
-
:retry_frequency =>
|
161
|
-
:post_timeout =>
|
158
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
159
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
162
160
|
:timeout_message => msg) do
|
163
161
|
uia_element_exists?(:view, marked: 'Cancel')
|
164
162
|
end
|
@@ -166,8 +164,8 @@ module Briar
|
|
166
164
|
uia_tap_mark('Cancel')
|
167
165
|
msg = "waited for '#{timeout}' seconds but did not see dismiss email action sheet"
|
168
166
|
wait_for(:timeout => timeout,
|
169
|
-
:retry_frequency =>
|
170
|
-
:post_timeout =>
|
167
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
168
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
171
169
|
:timeout_message => msg) do
|
172
170
|
uia_element_exists?(:view, marked: 'Delete Draft')
|
173
171
|
end
|
@@ -178,5 +176,43 @@ module Briar
|
|
178
176
|
end
|
179
177
|
step_pause
|
180
178
|
end
|
179
|
+
|
180
|
+
def uia_touch_email_to (opts={})
|
181
|
+
default_opts = {:await_keyboard => true}
|
182
|
+
opts = default_opts.merge(opts)
|
183
|
+
|
184
|
+
if uia_not_available?
|
185
|
+
screenshot_and_raise 'UIA needs to be available'
|
186
|
+
end
|
187
|
+
|
188
|
+
res = uia_query(:view, marked: 'To:').first
|
189
|
+
rect = res['rect']
|
190
|
+
point = {:x => rect['x'] + (2 * rect['width']),
|
191
|
+
:y => rect['y']}
|
192
|
+
uia_touch_with_options(point)
|
193
|
+
uia_await_keyboard if opts[:await_keyboard]
|
194
|
+
end
|
195
|
+
|
196
|
+
def uia_set_email_to(addresses, opts={})
|
197
|
+
default_opts = {:await_keyboard => true}
|
198
|
+
opts = default_opts.merge(opts)
|
199
|
+
uia_touch_email_to opts
|
200
|
+
addresses.each do |addr|
|
201
|
+
uia_type_string addr
|
202
|
+
uia_enter
|
203
|
+
step_pause
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
def uia_touch_send_email
|
208
|
+
uia_tap_mark('Send')
|
209
|
+
end
|
210
|
+
|
211
|
+
def uia_send_email_to(addresses, opts={})
|
212
|
+
default_opts = {:await_keyboard => true}
|
213
|
+
opts = default_opts.merge(opts)
|
214
|
+
uia_set_email_to addresses, opts
|
215
|
+
uia_touch_send_email
|
216
|
+
end
|
181
217
|
end
|
182
218
|
end
|
data/lib/briar/image_view.rb
CHANGED
@@ -23,8 +23,8 @@ module Briar
|
|
23
23
|
def wait_for_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
|
24
24
|
msg = "waited for '#{timeout}' seconds but did not see image view marked: '#{iv_id}'"
|
25
25
|
options = {:timeout => timeout,
|
26
|
-
:retry_frequency =>
|
27
|
-
:post_timeout =>
|
26
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
27
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
28
28
|
:timeout_message => msg}
|
29
29
|
wait_for(options) do
|
30
30
|
image_view_exists? iv_id
|
@@ -34,8 +34,8 @@ module Briar
|
|
34
34
|
def wait_for_image_view_to_disappear(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
|
35
35
|
msg = "waited for '#{timeout}' seconds but i still see image view marked: '#{iv_id}'"
|
36
36
|
options = {:timeout => timeout,
|
37
|
-
:retry_frequency =>
|
38
|
-
:post_timeout =>
|
37
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
38
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
39
39
|
:timeout_message => msg}
|
40
40
|
wait_for(options) do
|
41
41
|
not image_view_exists? iv_id
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'calabash-cucumber'
|
2
|
+
|
1
3
|
module Briar
|
2
4
|
module Keyboard
|
3
5
|
# dismiss the keyboard on iPad
|
@@ -21,8 +23,8 @@ module Briar
|
|
21
23
|
def should_see_keyboard (timeout=BRIAR_WAIT_TIMEOUT)
|
22
24
|
msg = "waited for '#{timeout}' seconds but did not see keyboard"
|
23
25
|
wait_for(:timeout => timeout,
|
24
|
-
:retry_frequency =>
|
25
|
-
:post_timeout =>
|
26
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
27
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
26
28
|
:timeout_message => msg) do
|
27
29
|
element_exists('keyboardAutomatic')
|
28
30
|
end
|
@@ -31,8 +33,8 @@ module Briar
|
|
31
33
|
def should_not_see_keyboard (timeout=BRIAR_WAIT_TIMEOUT)
|
32
34
|
msg = "waited for '#{timeout}' seconds but keyboard did not disappear"
|
33
35
|
wait_for(:timeout => timeout,
|
34
|
-
:retry_frequency =>
|
35
|
-
:post_timeout =>
|
36
|
+
:retry_frequency => BRIAR_WAIT_RETRY_FREQ,
|
37
|
+
:post_timeout => BRIAR_WAIT_STEP_PAUSE,
|
36
38
|
:timeout_message => msg) do
|
37
39
|
element_does_not_exist 'keyboardAutomatic'
|
38
40
|
end
|
@@ -47,7 +49,7 @@ module Briar
|
|
47
49
|
|
48
50
|
|
49
51
|
# is it possible to find what view the keyboard is responding to?
|
50
|
-
def autocapitalization_type
|
52
|
+
def autocapitalization_type
|
51
53
|
if !query('textView index:0').empty?
|
52
54
|
query('textView index:0', :autocapitalizationType).first.to_i
|
53
55
|
elsif !query('textField index:0').empty?
|
@@ -57,7 +59,7 @@ module Briar
|
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
60
|
-
def auto_correct_type
|
62
|
+
def auto_correct_type
|
61
63
|
if !query('textView index:0').empty?
|
62
64
|
query('textView index:0', :autocorrectionType).first.to_i
|
63
65
|
elsif !query('textField index:0').empty?
|
@@ -68,8 +70,9 @@ module Briar
|
|
68
70
|
end
|
69
71
|
|
70
72
|
|
73
|
+
#noinspection RubyUnusedLocalVariable
|
71
74
|
def briar_clear_text(view_id, timeout=5)
|
72
|
-
|
75
|
+
deprecated('0.1.1', "will remove 'timeout' argument in a future release", :warn)
|
73
76
|
clear_text("view marked:'#{view_id}'")
|
74
77
|
|
75
78
|
# i really wanted this to work, but there are too many issues with the
|
@@ -88,8 +91,9 @@ module Briar
|
|
88
91
|
|
89
92
|
### deprecated ###
|
90
93
|
|
94
|
+
#noinspection RubyUnusedLocalVariable
|
91
95
|
def set_autocapitalization (type)
|
92
|
-
|
96
|
+
deprecated('0.1.1', 'does not work', :pending)
|
93
97
|
#if !query('textView index:0').empty?
|
94
98
|
# query('textView index:0', [{setAutocapitalizationType: type}])
|
95
99
|
#elsif !query('textField index:0').empty?
|
@@ -100,12 +104,13 @@ module Briar
|
|
100
104
|
end
|
101
105
|
|
102
106
|
def turn_autocapitalization_off
|
103
|
-
|
107
|
+
deprecated('0.1.1', 'does not work', :pending)
|
104
108
|
#set_autocapitalization UITextAutocapitalizationTypeNone
|
105
109
|
end
|
106
110
|
|
111
|
+
#noinspection RubyUnusedLocalVariable
|
107
112
|
def set_autocorrect (type)
|
108
|
-
|
113
|
+
deprecated('0.1.1', 'does not work', :pending)
|
109
114
|
#if !query('textView index:0').empty?
|
110
115
|
# query('textView index:0', [{setAutocorrectionType: type}])
|
111
116
|
#elsif !query('textField index:0').empty?
|
@@ -116,12 +121,12 @@ module Briar
|
|
116
121
|
end
|
117
122
|
|
118
123
|
def turn_autocorrect_off
|
119
|
-
|
124
|
+
deprecated('0.1.1', 'does not work', :pending)
|
120
125
|
# set_autocorrect UITextAutocorrectionTypeNo
|
121
126
|
end
|
122
127
|
|
123
128
|
def turn_spell_correct_off
|
124
|
-
|
129
|
+
deprecated('0.1.1', 'does not work', :pending)
|
125
130
|
#if !query('textView index:0').empty?
|
126
131
|
# query('textView index:0', [{setSpellCheckingType: UITextSpellCheckingTypeNo}])
|
127
132
|
#elsif !query('textField index:0').empty?
|