briar 0.1.1 → 0.1.2
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 +5 -13
- data/features/step_definitions/bars/navbar_steps.rb +1 -0
- data/features/step_definitions/bars/toolbar_steps.rb +1 -1
- data/features/step_definitions/table_steps.rb +2 -0
- data/lib/briar.rb +2 -10
- data/lib/briar/alerts_and_sheets/alert_view.rb +5 -5
- data/lib/briar/bars/navbar.rb +16 -9
- data/lib/briar/bars/toolbar.rb +102 -19
- data/lib/briar/briar_core.rb +0 -8
- data/lib/briar/briar_uia.rb +85 -0
- data/lib/briar/cucumber.rb +1 -1
- data/lib/briar/email.rb +8 -2
- data/lib/briar/image_view.rb +26 -8
- data/lib/briar/table.rb +50 -5
- data/lib/briar/version.rb +1 -1
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YzBjM2M5M2RmMDlmZWQwNDFiYWJhZTk1MWJkNjk5NDU3NjY5ZmE5Zg==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 93314dd49766ff68b61036af263bdb9493a37ae9
|
4
|
+
data.tar.gz: a8caf27e07199bdcf4e5d954d190649ecd7d6d44
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MDQwNzNhYjJiNzMzMDg2YmIxYTE1OGVmMGMwODc3Y2NkZWJkY2UwZjE3ZGM4
|
11
|
-
MzQxMGJmZjMyYTUwZjEwNTgzNjYzZDRlMDg1YWJlZDI4YWUzNzE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTBhYjhmYTAyZTQxM2IxMmUwNmUzOTVlMzQ2ZmJjYmY0NjhlMzk4NmNhNjBl
|
14
|
-
NjM4M2RlNzc0ZTRhNTgyM2Y4YTIwZGFjODBmYTM1MWFjMzQ0YzNlNjMzOGIw
|
15
|
-
MjllNjgxMjExZTM3NDc2ZDEwYTk3ZWZhNDJhN2Y4NTBhOGRkYTY=
|
6
|
+
metadata.gz: 368c8b7088534f878a18ab4aad6f2150d42804f9eccf18da6a8f3eaed2adeca9ac38a0278486209b797aacb580fd2be316d44074576cd32a9b5979968918fb8d
|
7
|
+
data.tar.gz: 78c34ffbf187dcc6a773937b9f6c4fb819a51fe32117e387a66ee7c8779477540f75c6f360eaf158bbd85ec599ceb2f093f0dcf00ba0796cea7aaad137618727
|
@@ -37,6 +37,7 @@ Then /^I should (not see|see) (?:the|an?) "([^"]*)" button in the navbar$/ do |v
|
|
37
37
|
else
|
38
38
|
should_not_see_navbar_button name
|
39
39
|
end
|
40
|
+
step_pause
|
40
41
|
end
|
41
42
|
|
42
43
|
When /^I touch the "([^"]*)" navbar button, then I should see the "([^"]*)" view$/ do |button_name, view_id|
|
@@ -3,6 +3,6 @@ Then /^I touch the "([^"]*)" toolbar button$/ do |name|
|
|
3
3
|
end
|
4
4
|
|
5
5
|
When /^I touch the "([^"]*)" toolbar button, then I should see the "([^"]*)" view$/ do |button_name, view_id|
|
6
|
-
touch_toolbar_button button_name, view_id
|
6
|
+
touch_toolbar_button button_name, {:wait_for_view => view_id}
|
7
7
|
end
|
8
8
|
|
@@ -130,6 +130,7 @@ Then /^I touch the "([^"]*)" button in the "([^"]*)" row$/ do |button_id, row_id
|
|
130
130
|
end
|
131
131
|
|
132
132
|
Then /^I should see a switch for "([^"]*)" in the "([^"]*)" row that is in the "([^"]*)" position$/ do |switch_id, row_id, on_off|
|
133
|
+
warn 'WARN: deprecated 0.1.1 - write a custom step'
|
133
134
|
should_see_switch_in_row_with_state switch_id, row_id, (on_off.eql? 'on') ? 1 : 0
|
134
135
|
end
|
135
136
|
|
@@ -138,6 +139,7 @@ Then /^I should see a detail disclosure chevron in the "([^"]*)" row$/ do |row_i
|
|
138
139
|
end
|
139
140
|
|
140
141
|
Then /^I touch the "([^"]*)" switch in the "([^"]*)" row$/ do |switch_id, row_id|
|
142
|
+
warn 'WARN: deprecated 0.1.1 - write a custom step'
|
141
143
|
touch_switch_in_row switch_id, row_id
|
142
144
|
end
|
143
145
|
|
data/lib/briar.rb
CHANGED
@@ -8,7 +8,7 @@ TOUCH_TRANSITION_RETRY_FREQ = 0.5
|
|
8
8
|
##################
|
9
9
|
|
10
10
|
BRIAR_STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.5).to_f
|
11
|
-
BRIAR_WAIT_TIMEOUT = (ENV['WAIT_TIMEOUT'] ||
|
11
|
+
BRIAR_WAIT_TIMEOUT = (ENV['WAIT_TIMEOUT'] || 4.0).to_f
|
12
12
|
BRIAR_RETRY_FREQ = (ENV['RETRY_FREQ'] || 0.1).to_f
|
13
13
|
BRIAR_POST_TIMEOUT = (ENV['POST_TIMEOUT'] || 0.2).to_f
|
14
14
|
|
@@ -21,6 +21,7 @@ AL = :accessibilityLabel
|
|
21
21
|
|
22
22
|
require 'briar/version'
|
23
23
|
require 'briar/briar_core'
|
24
|
+
require 'briar/briar_uia'
|
24
25
|
|
25
26
|
require 'briar/alerts_and_sheets/alert_view'
|
26
27
|
require 'briar/alerts_and_sheets/action_sheet'
|
@@ -71,15 +72,6 @@ def device ()
|
|
71
72
|
end
|
72
73
|
end
|
73
74
|
|
74
|
-
def uia_available?
|
75
|
-
# proxy for testing if run_loop exists
|
76
|
-
if default_device.nil?
|
77
|
-
false
|
78
|
-
else
|
79
|
-
true
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
75
|
#noinspection RubyDefParenthesesInspection
|
84
76
|
def gestalt ()
|
85
77
|
pending("deprecated 0.0.8: replaced with Calabash::Cucumber::Device implementation - from now on use use 'device.*'")
|
@@ -39,8 +39,8 @@ module Briar
|
|
39
39
|
end
|
40
40
|
|
41
41
|
def should_see_alert_with_title (title, timeout=BRIAR_WAIT_TIMEOUT)
|
42
|
-
warn 'cannot distinguish between alert titles and messages'
|
43
42
|
if device.ios7?
|
43
|
+
warn 'WARN: cannot distinguish between alert titles and messages'
|
44
44
|
should_see_alert()
|
45
45
|
if uia_query(:view, marked:"#{title}").empty?
|
46
46
|
screenshot_and_raise "expected to see alert with title '#{title}'"
|
@@ -57,10 +57,10 @@ module Briar
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
def should_see_alert_with_message (message)
|
61
|
-
warn 'cannot distinguish between alert titles and messages'
|
60
|
+
def should_see_alert_with_message (message, timeout=BRIAR_WAIT_TIMEOUT)
|
62
61
|
if device.ios7?
|
63
|
-
|
62
|
+
warn 'WARN: cannot distinguish between alert titles and messages'
|
63
|
+
should_see_alert
|
64
64
|
if uia_query(:view, marked:"#{message}").empty?
|
65
65
|
screenshot_and_raise "expected to see alert with title '#{message}'"
|
66
66
|
end
|
@@ -71,7 +71,7 @@ module Briar
|
|
71
71
|
:retry_frequency => BRIAR_RETRY_FREQ,
|
72
72
|
:post_timeout => BRIAR_POST_TIMEOUT,
|
73
73
|
:timeout_message => msg) do
|
74
|
-
query(qstr, :text).include?(
|
74
|
+
query(qstr, :text).include?(message)
|
75
75
|
end
|
76
76
|
end
|
77
77
|
end
|
data/lib/briar/bars/navbar.rb
CHANGED
@@ -46,22 +46,29 @@ module Briar
|
|
46
46
|
titles.index(name)
|
47
47
|
end
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
# bar_button_type options =>
|
50
|
+
# button <= the button is a UIButton
|
51
|
+
# bar_item <= the button is UIBarButtonItem
|
52
|
+
def should_see_navbar_button (mark, opts={})
|
53
|
+
default_opts = {:bar_button_type => :bar_item,
|
54
|
+
:timeout => BRIAR_WAIT_TIMEOUT}
|
55
|
+
opts = default_opts.merge(opts)
|
56
|
+
if opts[:bar_button_type] == :button
|
57
|
+
queries = ["buttonLabel marked:'#{mark}' parent navigationBar",
|
58
|
+
"button marked:'#{mark}' parent navigationBar"]
|
59
|
+
timeout = opts[:timeout]
|
60
|
+
msg = "waited for '#{timeout}' seconds but did not see '#{mark}' in navigation bar"
|
54
61
|
wait_for(:timeout => timeout,
|
55
62
|
:retry_frequency => BRIAR_RETRY_FREQ,
|
56
63
|
:post_timeout => BRIAR_POST_TIMEOUT,
|
57
64
|
:timeout_message => msg) do
|
58
|
-
element_exists
|
65
|
+
queries.any? { |query| element_exists query }
|
59
66
|
end
|
60
67
|
else
|
61
|
-
idx = index_of_navbar_button
|
68
|
+
idx = index_of_navbar_button mark
|
62
69
|
if idx.nil?
|
63
70
|
# check to see if it is a ui button
|
64
|
-
should_see_navbar_button
|
71
|
+
should_see_navbar_button mark, {:bar_button_type => :button}
|
65
72
|
end
|
66
73
|
end
|
67
74
|
end
|
@@ -69,7 +76,7 @@ module Briar
|
|
69
76
|
|
70
77
|
def should_not_see_navbar_button (name, is_ui_button=false)
|
71
78
|
if is_ui_button
|
72
|
-
qstr = "
|
79
|
+
qstr = "buttonLabel marked:'#{name}' parent navigationBar"
|
73
80
|
timeout = 1.0
|
74
81
|
msg = "waited for '#{timeout}' seconds but i still see '#{name}' in navigation bar"
|
75
82
|
wait_for(:timeout => timeout,
|
data/lib/briar/bars/toolbar.rb
CHANGED
@@ -2,20 +2,37 @@ require 'calabash-cucumber'
|
|
2
2
|
|
3
3
|
module Briar
|
4
4
|
module Bars
|
5
|
+
|
6
|
+
def toolbar_qstr(toolbar_id=nil)
|
7
|
+
if toolbar_id.nil?
|
8
|
+
'toolbar'
|
9
|
+
else
|
10
|
+
"toolbar marked:'#{toolbar_id}'"
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
5
14
|
def toolbar_exists? (id)
|
6
15
|
!query("toolbar marked:'#{id}'").empty?
|
7
16
|
end
|
8
17
|
|
9
|
-
def should_see_toolbar (
|
10
|
-
|
18
|
+
def should_see_toolbar (toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
|
19
|
+
wait_for_toolbar(toolbar_id, timeout)
|
11
20
|
end
|
12
21
|
|
13
|
-
def should_not_see_toolbar (
|
14
|
-
|
22
|
+
def should_not_see_toolbar (toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
|
23
|
+
wait_for_toolbar_to_disappear toolbar_id, timeout
|
24
|
+
screenshot_and_raise "did not expect to see toolbar with id '#{toolbar_id}'" if toolbar_exists? toolbar_id
|
15
25
|
end
|
16
26
|
|
17
|
-
def toolbar_button_exists?
|
18
|
-
|
27
|
+
def toolbar_button_exists?(button_id, opts={:toolbar_id => nil})
|
28
|
+
toolbar_id = opts[:toolbar_id]
|
29
|
+
if toolbar_id.nil?
|
30
|
+
not query("toolbar descendant view marked:'#{button_id}'").empty?
|
31
|
+
else
|
32
|
+
not query("toolbar marked:'#{toolbar_id}' descendant view marked:'#{button_id}'").empty?
|
33
|
+
end
|
34
|
+
|
35
|
+
# the problem here is that toolbar buttons come in many different flavors
|
19
36
|
## look for text button
|
20
37
|
#text_button_arr = query("toolbar child toolbarTextButton child button child buttonLabel", :text)
|
21
38
|
#has_text_button = text_button_arr.index(name_or_id) != nil
|
@@ -26,24 +43,90 @@ module Briar
|
|
26
43
|
#has_text_button or has_toolbar_button
|
27
44
|
end
|
28
45
|
|
29
|
-
def
|
30
|
-
|
31
|
-
|
32
|
-
|
46
|
+
def wait_for_toolbar_button(button_id, opts={})
|
47
|
+
default_opts = {:timeout => BRIAR_WAIT_TIMEOUT,
|
48
|
+
:toolbar_id => nil}
|
49
|
+
opts = default_opts.merge(opts)
|
50
|
+
timeout=opts[:timeout]
|
51
|
+
toolbar_id = opts[:toolbar_id]
|
52
|
+
if toolbar_id.nil?
|
53
|
+
msg = "waited for '#{timeout}' seconds but did not see toolbar button marked: '#{button_id}'"
|
54
|
+
else
|
55
|
+
msg = "waited for '#{timeout}' seconds but did not see toolbar button marked: '#{button_id}' in toolbar '#{toolbar_id}'"
|
56
|
+
end
|
57
|
+
|
58
|
+
options = {:timeout => timeout,
|
59
|
+
:retry_frequency => BRIAR_RETRY_FREQ,
|
60
|
+
:post_timeout => BRIAR_POST_TIMEOUT,
|
61
|
+
:timeout_message => msg}
|
62
|
+
wait_for(options) do
|
63
|
+
toolbar_button_exists? button_id, opts
|
33
64
|
end
|
65
|
+
|
34
66
|
end
|
35
67
|
|
36
|
-
def
|
37
|
-
|
38
|
-
|
39
|
-
|
68
|
+
def should_see_toolbar_button (button_id, opts={:timeout => BRIAR_WAIT_TIMEOUT,
|
69
|
+
:toolbar_id => nil})
|
70
|
+
wait_for_toolbar_button button_id, opts
|
71
|
+
end
|
72
|
+
|
73
|
+
def wait_for_toolbar_to_disappear(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
|
74
|
+
msg = "waited for '#{timeout}' seconds but i still see toolbar marked: '#{toolbar_id}'"
|
75
|
+
options = {:timeout => timeout,
|
76
|
+
:retry_frequency => BRIAR_RETRY_FREQ,
|
77
|
+
:post_timeout => BRIAR_POST_TIMEOUT,
|
78
|
+
:timeout_message => msg}
|
79
|
+
|
80
|
+
wait_for(options) do
|
81
|
+
not toolbar_exists? toolbar_id
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
def wait_for_toolbar(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
|
87
|
+
msg = "waited for '#{timeout}' seconds but did not see toolbar marked: '#{toolbar_id}'"
|
88
|
+
options = {:timeout => timeout,
|
89
|
+
:retry_frequency => BRIAR_RETRY_FREQ,
|
90
|
+
:post_timeout => BRIAR_POST_TIMEOUT,
|
91
|
+
:timeout_message => msg}
|
92
|
+
wait_for(options) do
|
93
|
+
toolbar_exists? toolbar_id
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
def touch_toolbar_button(button_id, opts={})
|
100
|
+
|
101
|
+
if opts.is_a?(Hash)
|
102
|
+
default_opts ={:wait_for_view => nil,
|
103
|
+
:timeout => BRIAR_WAIT_TIMEOUT,
|
104
|
+
:toolbar_id => nil}
|
105
|
+
opts = default_opts.merge(opts)
|
40
106
|
else
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
107
|
+
warn("WARN: deprecated 0.1.2: second argument should be a hash - found '#{opts}'")
|
108
|
+
opts = {:wait_for_view => opts[:wait_for_view],
|
109
|
+
:timeout => BRIAR_WAIT_TIMEOUT,
|
110
|
+
:toolbar_id => nil}
|
111
|
+
end
|
112
|
+
|
113
|
+
should_see_toolbar_button button_id, opts
|
114
|
+
|
115
|
+
toolbar_qstr = toolbar_qstr(opts[:toolbar_id])
|
116
|
+
touch("#{toolbar_qstr} descendant view marked:'#{button_id}'")
|
117
|
+
|
118
|
+
wait_for_view = opts[:wait_for_view]
|
119
|
+
unless wait_for_view.nil?
|
120
|
+
timeout = opts[:timeout]
|
121
|
+
msg = "touched '#{button_id}' and waited for '#{timeout}' sec but did not see '#{wait_for_view}'"
|
122
|
+
options = {:timeout => timeout,
|
123
|
+
:retry_frequency => BRIAR_RETRY_FREQ,
|
124
|
+
:post_timeout => BRIAR_POST_TIMEOUT,
|
125
|
+
:timeout_message => msg}
|
126
|
+
wait_for(options) do
|
127
|
+
view_exists? wait_for_view
|
128
|
+
end
|
45
129
|
end
|
46
|
-
step_pause
|
47
130
|
end
|
48
131
|
end
|
49
132
|
end
|
data/lib/briar/briar_core.rb
CHANGED
@@ -11,14 +11,6 @@ module Briar
|
|
11
11
|
sleep(ANIMATION_PAUSE)
|
12
12
|
end
|
13
13
|
|
14
|
-
def uia_not_available
|
15
|
-
env('NO_LAUNCH') == '1'
|
16
|
-
end
|
17
|
-
|
18
|
-
def uia_available
|
19
|
-
not uia_not_available
|
20
|
-
end
|
21
|
-
|
22
14
|
def view_exists? (view_id)
|
23
15
|
!query("view marked:'#{view_id}'").empty?
|
24
16
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
require 'calabash-cucumber'
|
2
|
+
|
3
|
+
module Briar
|
4
|
+
module UIA
|
5
|
+
|
6
|
+
def uia_available?
|
7
|
+
# proxy for testing if run_loop exists
|
8
|
+
not uia_not_available?
|
9
|
+
end
|
10
|
+
|
11
|
+
def uia_not_available?
|
12
|
+
default_device.nil?
|
13
|
+
end
|
14
|
+
|
15
|
+
def uia_handle_target_command(cmd, *query_args)
|
16
|
+
args = query_args.map do |part|
|
17
|
+
if part.is_a?(String)
|
18
|
+
"#{escape_uia_string(part)}"
|
19
|
+
else
|
20
|
+
"#{escape_uia_string(part.to_edn)}"
|
21
|
+
end
|
22
|
+
end
|
23
|
+
command = %Q[target.#{cmd}(#{args.join(', ')})]
|
24
|
+
if ENV['DEBUG'] == '1'
|
25
|
+
puts 'Sending UIA command'
|
26
|
+
puts command
|
27
|
+
end
|
28
|
+
s=send_uia_command :command => command
|
29
|
+
if ENV['DEBUG'] == '1'
|
30
|
+
puts 'Result'
|
31
|
+
p s
|
32
|
+
end
|
33
|
+
if s['status'] == 'success'
|
34
|
+
s['value']
|
35
|
+
else
|
36
|
+
raise s
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def uia_touch_with_options(point, opts={})
|
41
|
+
defaults = {:tap_count => 1,
|
42
|
+
:touch_count => 1,
|
43
|
+
:duration => 1.0}
|
44
|
+
opts = defaults.merge(opts)
|
45
|
+
pt = "{x: #{point[:x]}, y: #{point[:y]}}"
|
46
|
+
args = "{tapCount: #{opts[:tap_count]}, touchCount: #{opts[:touch_count]}, duration: #{opts[:duration]}}"
|
47
|
+
uia_handle_target_command(:tapWithOptions, pt, args)
|
48
|
+
end
|
49
|
+
|
50
|
+
def dismiss_ipad_keyboard
|
51
|
+
screenshot_and_raise 'cannot dismiss keyboard on iphone' if iphone?
|
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()"
|
54
|
+
step_pause
|
55
|
+
end
|
56
|
+
|
57
|
+
def make_ipad_emulation_1x
|
58
|
+
device = device()
|
59
|
+
unless device.ipad?
|
60
|
+
pending 'this trick only works on the iPad'
|
61
|
+
end
|
62
|
+
|
63
|
+
unless device.ios7?
|
64
|
+
pending 'this trick only works on iOS 7'
|
65
|
+
end
|
66
|
+
|
67
|
+
unless uia_available?
|
68
|
+
pending 'this trick requires the app be launched with instruments'
|
69
|
+
end
|
70
|
+
|
71
|
+
# this only works because iPhone apps emulated on iPads in iOS 7 _always_
|
72
|
+
# launch at 2x
|
73
|
+
uia_touch_with_options({x:738, y:24})
|
74
|
+
step_pause
|
75
|
+
end
|
76
|
+
|
77
|
+
def ensure_ipad_emulation_1x
|
78
|
+
device = device()
|
79
|
+
if device.ipad? and device.ios7? and uia_available?
|
80
|
+
uia_touch_with_options({x:738, y:24})
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
data/lib/briar/cucumber.rb
CHANGED
@@ -2,6 +2,7 @@ require 'briar'
|
|
2
2
|
|
3
3
|
World(Briar)
|
4
4
|
World(Briar::Core)
|
5
|
+
World(Briar::UIA)
|
5
6
|
World(Briar::Alerts_and_Sheets)
|
6
7
|
World(Briar::Bars)
|
7
8
|
World(Briar::Control::Button)
|
@@ -22,7 +23,6 @@ World(Briar::TextField)
|
|
22
23
|
World(Briar::TextView)
|
23
24
|
|
24
25
|
|
25
|
-
|
26
26
|
AfterConfiguration do
|
27
27
|
require 'briar/briar_steps'
|
28
28
|
end
|
data/lib/briar/email.rb
CHANGED
@@ -121,14 +121,20 @@ module Briar
|
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
124
|
-
def delete_draft_and_wait_for (view_id)
|
124
|
+
def delete_draft_and_wait_for (view_id, opts={})
|
125
|
+
|
126
|
+
|
125
127
|
if email_not_testable?
|
126
128
|
warn_about_no_ios5_email_view
|
127
129
|
return
|
128
130
|
end
|
129
131
|
|
132
|
+
default_opts = {:timeout => BRIAR_WAIT_TIMEOUT,
|
133
|
+
:email_view_mark => 'compose email'}
|
134
|
+
opts = default_opts.merge(opts)
|
135
|
+
|
130
136
|
# does a wait for iOS > 5 + uia available
|
131
|
-
should_see_mail_view
|
137
|
+
should_see_mail_view opts
|
132
138
|
|
133
139
|
device = device()
|
134
140
|
|
data/lib/briar/image_view.rb
CHANGED
@@ -2,8 +2,8 @@ require 'calabash-cucumber'
|
|
2
2
|
|
3
3
|
module Briar
|
4
4
|
module ImageView
|
5
|
-
def image_view_exists?
|
6
|
-
query_str = "imageView marked:'#{
|
5
|
+
def image_view_exists?(iv_id)
|
6
|
+
query_str = "imageView marked:'#{iv_id}'"
|
7
7
|
exists = !query(query_str).empty?
|
8
8
|
if exists
|
9
9
|
alpha = query(query_str, :alpha).first.to_i
|
@@ -12,15 +12,33 @@ module Briar
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
def should_see_image_view
|
16
|
-
|
17
|
-
|
15
|
+
def should_see_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
|
16
|
+
wait_for_image_view iv_id, timeout
|
17
|
+
end
|
18
|
+
|
19
|
+
def should_not_see_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
|
20
|
+
wait_for_image_view_to_disappear iv_id, timeout
|
21
|
+
end
|
22
|
+
|
23
|
+
def wait_for_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
|
24
|
+
msg = "waited for '#{timeout}' seconds but did not see image view marked: '#{iv_id}'"
|
25
|
+
options = {:timeout => timeout,
|
26
|
+
:retry_frequency => BRIAR_RETRY_FREQ,
|
27
|
+
:post_timeout => BRIAR_POST_TIMEOUT,
|
28
|
+
:timeout_message => msg}
|
29
|
+
wait_for(options) do
|
30
|
+
image_view_exists? iv_id
|
18
31
|
end
|
19
32
|
end
|
20
33
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
34
|
+
def wait_for_image_view_to_disappear(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
|
35
|
+
msg = "waited for '#{timeout}' seconds but i still see image view marked: '#{iv_id}'"
|
36
|
+
options = {:timeout => timeout,
|
37
|
+
:retry_frequency => BRIAR_RETRY_FREQ,
|
38
|
+
:post_timeout => BRIAR_POST_TIMEOUT,
|
39
|
+
:timeout_message => msg}
|
40
|
+
wait_for(options) do
|
41
|
+
not image_view_exists? iv_id
|
24
42
|
end
|
25
43
|
end
|
26
44
|
end
|
data/lib/briar/table.rb
CHANGED
@@ -312,10 +312,33 @@ module Briar
|
|
312
312
|
should_see_delete_confirmation_in_row row_id
|
313
313
|
end
|
314
314
|
|
315
|
-
def should_see_switch_in_row_with_state (switch_id, row_id, state,
|
315
|
+
def should_see_switch_in_row_with_state (switch_id, row_id, state, opts={})
|
316
|
+
|
317
|
+
if (not opts.is_a?(Hash)) and (not opts.nil?)
|
318
|
+
warn "WARN: deprecated 0.1.1 - you should no longer pass a table_id '#{table_id}' at an arg, pass opts hash instead"
|
319
|
+
opts = {:table_id => opts}
|
320
|
+
end
|
321
|
+
|
322
|
+
default_opts = {:table_id => nil,
|
323
|
+
:switch_class => nil,
|
324
|
+
:switch_state_selector => :isOn}
|
325
|
+
|
326
|
+
opts = default_opts.merge(opts)
|
327
|
+
|
328
|
+
table_id = opts[:table_id]
|
329
|
+
|
316
330
|
should_see_row row_id, table_id
|
317
|
-
|
318
|
-
|
331
|
+
row_content_qstr = query_str_for_row_content row_id, table_id
|
332
|
+
|
333
|
+
switch_class = opts[:switch_class]
|
334
|
+
if switch_class.nil?
|
335
|
+
switch_qstr = "switch marked:'#{switch_id}'"
|
336
|
+
else
|
337
|
+
switch_qstr = "view:'#{switch_class}' marked:'#{switch_id}'"
|
338
|
+
end
|
339
|
+
|
340
|
+
qstr = "#{row_content_qstr} #{switch_qstr}"
|
341
|
+
res = query(qstr, opts[:switch_state_selector]).first
|
319
342
|
unless res
|
320
343
|
screenshot_and_raise "expected to find a switch marked '#{switch_id}' in row '#{row_id}'"
|
321
344
|
end
|
@@ -357,10 +380,32 @@ module Briar
|
|
357
380
|
should_not_see_row row_id, table_id
|
358
381
|
end
|
359
382
|
|
360
|
-
def touch_switch_in_row (switch_id, row_id,
|
383
|
+
def touch_switch_in_row (switch_id, row_id, opts={})
|
384
|
+
if (not opts.is_a?(Hash)) and (not table_id.nil?)
|
385
|
+
warn "WARN: deprecated 0.1.1 - passing a table_id '#{table_id}' has been deprecated pass a hash instead"
|
386
|
+
opts = {:table_id => table_id}
|
387
|
+
end
|
388
|
+
|
389
|
+
default_opts = {:table_id => nil,
|
390
|
+
:switch_class => nil}
|
391
|
+
|
392
|
+
opts = default_opts.merge(opts)
|
393
|
+
|
394
|
+
table_id = opts[:table_id]
|
395
|
+
|
396
|
+
switch_class = opts[:switch_class]
|
397
|
+
|
398
|
+
|
399
|
+
if switch_class.nil?
|
400
|
+
switch_query = "switch marked:'#{switch_id}'"
|
401
|
+
else
|
402
|
+
switch_query = "view:'#{switch_class}' marked:'#{switch_id}'"
|
403
|
+
end
|
404
|
+
|
405
|
+
|
361
406
|
should_see_row row_id, table_id
|
362
407
|
query_str = query_str_for_row_content row_id, table_id
|
363
|
-
touch("#{query_str}
|
408
|
+
touch("#{query_str} #{switch_query}")
|
364
409
|
step_pause
|
365
410
|
end
|
366
411
|
|
data/lib/briar/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: briar
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joshua Moody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: calabash-cucumber
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: syntax
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
description: extends calabash-ios steps
|
@@ -101,6 +101,7 @@ files:
|
|
101
101
|
- lib/briar/bars/toolbar.rb
|
102
102
|
- lib/briar/briar_core.rb
|
103
103
|
- lib/briar/briar_steps.rb
|
104
|
+
- lib/briar/briar_uia.rb
|
104
105
|
- lib/briar/control/button.rb
|
105
106
|
- lib/briar/control/segmented_control.rb
|
106
107
|
- lib/briar/control/slider.rb
|
@@ -131,20 +132,20 @@ require_paths:
|
|
131
132
|
- lib
|
132
133
|
required_ruby_version: !ruby/object:Gem::Requirement
|
133
134
|
requirements:
|
134
|
-
- -
|
135
|
+
- - '>='
|
135
136
|
- !ruby/object:Gem::Version
|
136
137
|
version: '0'
|
137
138
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
139
|
requirements:
|
139
|
-
- -
|
140
|
+
- - '>='
|
140
141
|
- !ruby/object:Gem::Version
|
141
142
|
version: '0'
|
142
143
|
requirements: []
|
143
144
|
rubyforge_project:
|
144
|
-
rubygems_version: 2.1.
|
145
|
+
rubygems_version: 2.1.11
|
145
146
|
signing_key:
|
146
147
|
specification_version: 4
|
147
|
-
summary: briar-0.1.
|
148
|
+
summary: briar-0.1.2
|
148
149
|
test_files:
|
149
150
|
- features/step_definitions/alerts_and_sheets/action_sheet_steps.rb
|
150
151
|
- features/step_definitions/alerts_and_sheets/alert_view_steps.rb
|