briar 0.0.7 → 0.0.8
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 +8 -8
- data/Rakefile +6 -11
- data/bin/briar +58 -0
- data/bin/briar_helpers.rb +28 -2
- data/briar.gemspec +3 -2
- data/features/step_definitions/alerts_and_sheets/action_sheet_steps.rb +10 -4
- data/features/step_definitions/alerts_and_sheets/alert_view_steps.rb +3 -10
- data/features/step_definitions/bars/navbar_steps.rb +1 -9
- data/features/step_definitions/bars/tabbar_steps.rb +2 -4
- data/features/step_definitions/bars/toolbar_steps.rb +2 -11
- data/features/step_definitions/control/button_steps.rb +3 -8
- data/features/step_definitions/control/segmented_control_steps.rb +20 -58
- data/features/step_definitions/email_steps.rb +10 -7
- data/features/step_definitions/keyboard_steps.rb +7 -2
- data/features/step_definitions/picker/date_picker_steps.rb +21 -177
- data/features/step_definitions/table_steps.rb +35 -71
- data/features/step_definitions/text_field_steps.rb +1 -5
- data/features/step_definitions/text_view_steps.rb +2 -2
- data/install-calabash-framework.sh.example +10 -0
- data/lib/briar.rb +31 -5
- data/lib/briar/alerts_and_sheets/action_sheet.rb +99 -0
- data/lib/briar/alerts_and_sheets/alert_view.rb +25 -4
- data/lib/briar/bars/navbar.rb +30 -19
- data/lib/briar/bars/tabbar.rb +7 -4
- data/lib/briar/bars/toolbar.rb +14 -1
- data/lib/briar/briar_core.rb +46 -15
- data/lib/briar/control/button.rb +35 -1
- data/lib/briar/control/segmented_control.rb +69 -8
- data/lib/briar/control/slider.rb +2 -2
- data/lib/briar/cucumber.rb +3 -1
- data/lib/briar/email.rb +19 -13
- data/lib/briar/keyboard.rb +50 -10
- data/lib/briar/label.rb +20 -0
- data/lib/briar/picker/date_picker.rb +88 -584
- data/lib/briar/picker/date_picker_core.rb +293 -0
- data/lib/briar/picker/date_picker_manipulation.rb +255 -0
- data/lib/briar/picker/picker.rb +10 -0
- data/lib/briar/table.rb +261 -93
- data/lib/briar/version.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- metadata +14 -13
- data/lib/briar/gestalt.rb +0 -87
- data/spec/briar/gestalt_spec.rb +0 -66
@@ -21,11 +21,7 @@ Then /^I should see a clear button in the text field in the "([^"]*)" row$/ do |
|
|
21
21
|
end
|
22
22
|
|
23
23
|
Then /^I touch the clear button in the text field in the "([^"]*)" row$/ do |row_id|
|
24
|
-
|
25
|
-
res = query(query_str)
|
26
|
-
screenshot_and_raise "expected to see text field in '#{row_id}' row" if res.empty?
|
27
|
-
touch("#{query_str} child button")
|
28
|
-
step_pause
|
24
|
+
touch_text_field_clear_button_in_row row_id
|
29
25
|
end
|
30
26
|
|
31
27
|
Then(/^I should see "(.*?)" text field with text "(.*?)"$/) do |text_field_id, text|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
Then /^I clear text view named "([^\"]*)"$/ do |name|
|
2
2
|
res = query("textView marked:'#{name}'")
|
3
3
|
if res
|
4
|
-
|
4
|
+
clear_text("textView marked:'#{name}'")
|
5
5
|
end
|
6
6
|
end
|
7
7
|
|
@@ -34,5 +34,5 @@ end
|
|
34
34
|
|
35
35
|
Then /^I touch text view "([^"]*)"$/ do |text_view|
|
36
36
|
touch("textView marked:'#{text_view}'")
|
37
|
-
|
37
|
+
step_pause
|
38
38
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
current_dir=`pwd`
|
3
|
+
cd ~/git/calabash-ios/calabash-cucumber
|
4
|
+
rake build_server
|
5
|
+
cd "$current_dir"
|
6
|
+
briar rm-cal-targets
|
7
|
+
cp ~/git/calabash-ios/calabash-cucumber/staticlib/calabash.framework.zip ./
|
8
|
+
rm -rf calabash.framework
|
9
|
+
unzip calabash.framework.zip
|
10
|
+
rm -rf calabash.framework.zip
|
data/lib/briar.rb
CHANGED
@@ -1,15 +1,18 @@
|
|
1
1
|
#$:.unshift File.dirname(__FILE__)
|
2
2
|
|
3
3
|
DEVICE_ENDPOINT = (ENV['DEVICE_ENDPOINT'] || 'http://localhost:37265')
|
4
|
-
AI = :accessibilityIdentifier
|
5
4
|
TOUCH_TRANSITION_TIMEOUT = 30.0
|
6
5
|
TOUCH_TRANSITION_RETRY_FREQ = 0.5
|
6
|
+
BRIAR_STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.4).to_f
|
7
|
+
ANIMATION_PAUSE = (ENV['ANIMATION_PAUSE'] || 0.6).to_f
|
8
|
+
AI = :accessibilityIdentifier
|
9
|
+
AL = :accessibilityLabel
|
7
10
|
|
8
11
|
require 'briar/version'
|
9
|
-
require 'briar/gestalt'
|
10
12
|
require 'briar/briar_core'
|
11
13
|
|
12
14
|
require 'briar/alerts_and_sheets/alert_view'
|
15
|
+
require 'briar/alerts_and_sheets/action_sheet'
|
13
16
|
|
14
17
|
require 'briar/bars/tabbar'
|
15
18
|
require 'briar/bars/navbar'
|
@@ -21,6 +24,8 @@ require 'briar/control/slider'
|
|
21
24
|
|
22
25
|
require 'briar/picker/picker_shared'
|
23
26
|
require 'briar/picker/picker'
|
27
|
+
require 'briar/picker/date_picker_core'
|
28
|
+
require 'briar/picker/date_picker_manipulation'
|
24
29
|
require 'briar/picker/date_picker'
|
25
30
|
|
26
31
|
require 'briar/email'
|
@@ -33,10 +38,31 @@ require 'briar/table'
|
|
33
38
|
require 'briar/text_field'
|
34
39
|
require 'briar/text_view'
|
35
40
|
|
41
|
+
#noinspection RubyDefParenthesesInspection
|
42
|
+
def device ()
|
43
|
+
url = URI.parse(ENV['DEVICE_ENDPOINT']|| 'http://localhost:37265/')
|
44
|
+
http = Net::HTTP.new(url.host, url.port)
|
45
|
+
res = http.start do |sess|
|
46
|
+
sess.request Net::HTTP::Get.new(ENV['CALABASH_VERSION_PATH'] || 'version')
|
47
|
+
end
|
48
|
+
status = res.code
|
49
|
+
|
50
|
+
#noinspection RubyUnusedLocalVariable
|
51
|
+
begin
|
52
|
+
http.finish if http and http.started?
|
53
|
+
rescue Exception => e
|
54
|
+
# ignored
|
55
|
+
end
|
56
|
+
|
57
|
+
if status=='200'
|
58
|
+
version_body = JSON.parse(res.body)
|
59
|
+
Calabash::Cucumber::Device.new(url, version_body)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#noinspection RubyDefParenthesesInspection
|
36
64
|
def gestalt ()
|
37
|
-
|
38
|
-
res = Net::HTTP.get(uri)
|
39
|
-
Briar::Gestalt.new(res)
|
65
|
+
pending("deprecated 0.0.8: replaced with Calabash::Cucumber::Device implementation - from now on use use 'device.*'")
|
40
66
|
end
|
41
67
|
|
42
68
|
|
@@ -0,0 +1,99 @@
|
|
1
|
+
module Briar
|
2
|
+
module Alerts_and_Sheets
|
3
|
+
|
4
|
+
def query_str_for_sheet(sheet_id)
|
5
|
+
if sheet_id
|
6
|
+
"actionSheet marked:'#{sheet_id}'"
|
7
|
+
else
|
8
|
+
'actionSheet'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
def sheet_exists? (sheet_id)
|
13
|
+
!query(query_str_for_sheet sheet_id).empty?
|
14
|
+
end
|
15
|
+
|
16
|
+
def should_see_sheet (sheet_id, button_titles=nil, sheet_title=nil)
|
17
|
+
unless sheet_exists? (sheet_id)
|
18
|
+
screenshot_and_raise "should see sheet marked '#{sheet_id}'"
|
19
|
+
end
|
20
|
+
|
21
|
+
if button_titles
|
22
|
+
button_titles.each { |title| should_see_button_on_sheet title, sheet_id }
|
23
|
+
end
|
24
|
+
|
25
|
+
if sheet_title
|
26
|
+
should_see_sheet_title sheet_title, sheet_id
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def should_not_see_sheet(sheet_id)
|
31
|
+
if sheet_exists? (sheet_id)
|
32
|
+
screenshot_and_raise "should not see sheet marked '#{sheet_id}'"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def wait_for_sheet (sheet_id, timeout=1.0)
|
37
|
+
msg = "waited for '#{timeout}' seconds but did not see '#{sheet_id}'"
|
38
|
+
wait_for(:timeout => timeout,
|
39
|
+
:retry_frequency => 0.2,
|
40
|
+
:post_timeout => 0.1,
|
41
|
+
:timeout_message => msg ) do
|
42
|
+
sheet_exists? sheet_id
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def wait_for_sheet_to_disappear(sheet_id, timeout=1.0)
|
47
|
+
msg = "waited for '#{timeout}' seconds for '#{sheet_id}' to disappear but it is still visible"
|
48
|
+
options = {:timeout => timeout,
|
49
|
+
:retry_frequency => 0.2,
|
50
|
+
:post_timeout => 0.1,
|
51
|
+
:timeout_message => msg}
|
52
|
+
wait_for(options) do
|
53
|
+
not sheet_exists? sheet_id
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def error_msg_for_sheet_button(button_title, visible, sheet_id=nil)
|
58
|
+
vis_str = visible ? 'see' : 'not see'
|
59
|
+
sheet_str = sheet_id ? sheet_id : ''
|
60
|
+
"should #{vis_str} button with title '#{button_title}' on sheet '#{sheet_str}'"
|
61
|
+
end
|
62
|
+
|
63
|
+
def sheet_button_exists? (button_title, sheet_id=nil)
|
64
|
+
sheet_query = query_str_for_sheet sheet_id
|
65
|
+
query("#{sheet_query} child button child label", :text).include?(button_title)
|
66
|
+
end
|
67
|
+
|
68
|
+
def should_see_button_on_sheet(button_title, sheet_id=nil)
|
69
|
+
unless sheet_button_exists? button_title, sheet_id
|
70
|
+
screenshot_and_raise error_msg_for_sheet_button button_title, true, sheet_id
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def should_not_see_button_on_sheet(button_title, sheet_id=nil)
|
75
|
+
if sheet_button_exists? button_title, sheet_id
|
76
|
+
screenshot_and_raise error_msg_for_sheet_button button_title, false, sheet_id
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def should_see_sheet_title(label_title, sheet_id=nil)
|
81
|
+
sheet_query = query_str_for_sheet sheet_id
|
82
|
+
res = query("#{sheet_query} child label", :text).include?(label_title)
|
83
|
+
unless res
|
84
|
+
"should see sheet #{sheet_id ? "'#{sheet_id}'" : ''} with title '#{label_title}'"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def touch_sheet_button (button_title, sheet_id=nil)
|
89
|
+
sheet_query = query_str_for_sheet sheet_id
|
90
|
+
should_see_button_on_sheet button_title, sheet_id
|
91
|
+
touch("#{sheet_query} child button child label marked:'#{button_title}'")
|
92
|
+
end
|
93
|
+
|
94
|
+
def touch_sheet_button_and_wait_for_view(button_title, view_id, sheet_id=nil)
|
95
|
+
touch_sheet_button button_title, sheet_id
|
96
|
+
wait_for_view view_id
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
@@ -1,16 +1,20 @@
|
|
1
1
|
module Briar
|
2
2
|
module Alerts_and_Sheets
|
3
|
-
def alert_exists? (alert_id)
|
4
|
-
|
3
|
+
def alert_exists? (alert_id=nil)
|
4
|
+
if alert_id.nil?
|
5
|
+
!query('alertView').empty?
|
6
|
+
else
|
7
|
+
!query("alertView marked:'#{alert_id}'").empty?
|
8
|
+
end
|
5
9
|
end
|
6
10
|
|
7
|
-
def should_see_alert (alert_id)
|
11
|
+
def should_see_alert (alert_id=nil)
|
8
12
|
unless alert_exists? alert_id
|
9
13
|
screenshot_and_raise "should see alert view marked '#{alert_id}'"
|
10
14
|
end
|
11
15
|
end
|
12
16
|
|
13
|
-
def should_not_see_alert (alert_id)
|
17
|
+
def should_not_see_alert (alert_id=nil)
|
14
18
|
if alert_exists? alert_id
|
15
19
|
screenshot_and_raise "should not see alert view marked '#{alert_id}'"
|
16
20
|
end
|
@@ -28,7 +32,24 @@ module Briar
|
|
28
32
|
|
29
33
|
def dismiss_alert_with_button (button_label)
|
30
34
|
touch("alertView child button marked:'#{button_label}'")
|
35
|
+
wait_for_view_to_disappear 'alertView'
|
36
|
+
end
|
37
|
+
|
38
|
+
def should_see_alert_with_title (title)
|
39
|
+
unless query('alertView child label', :text).include?(title)
|
40
|
+
screenshot_and_raise "i do not see an alert view with title '#{title}'"
|
41
|
+
end
|
31
42
|
end
|
32
43
|
|
44
|
+
def should_see_alert_with_message (message)
|
45
|
+
unless query('alertView descendant label', :text).include?(message)
|
46
|
+
screenshot_and_raise "i do not see an alert view with message '#{message}'"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def touch_alert_button(button_title)
|
51
|
+
touch("alertView child button marked:'#{button_title}'")
|
52
|
+
step_pause
|
53
|
+
end
|
33
54
|
end
|
34
55
|
end
|
data/lib/briar/bars/navbar.rb
CHANGED
@@ -19,7 +19,7 @@ module Briar
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def navbar_has_back_button?
|
22
|
-
|
22
|
+
!query('navigationItemButtonView').empty?
|
23
23
|
end
|
24
24
|
|
25
25
|
def should_see_navbar_back_button
|
@@ -37,7 +37,7 @@ module Briar
|
|
37
37
|
|
38
38
|
# will not work to detect left/right buttons
|
39
39
|
def index_of_navbar_button (name)
|
40
|
-
titles = query('navigationButton',
|
40
|
+
titles = query('navigationButton', AL)
|
41
41
|
titles.index(name)
|
42
42
|
end
|
43
43
|
|
@@ -58,54 +58,65 @@ module Briar
|
|
58
58
|
def date_is_in_navbar (date)
|
59
59
|
with_leading = date.strftime('%a %b %d')
|
60
60
|
without_leading = date.strftime("%a %b #{date.day}")
|
61
|
-
items = query('navigationItemView',
|
61
|
+
items = query('navigationItemView', AL)
|
62
62
|
items.include?(with_leading) || items.include?(without_leading)
|
63
63
|
end
|
64
64
|
|
65
65
|
|
66
66
|
def go_back_after_waiting
|
67
|
-
|
67
|
+
sleep(0.2)
|
68
|
+
wait_for(:timeout => 1.0,
|
69
|
+
:retry_frequency => 0.2) do
|
70
|
+
not query('navigationItemButtonView first').empty?
|
71
|
+
end
|
68
72
|
touch('navigationItemButtonView first')
|
69
73
|
step_pause
|
70
74
|
end
|
71
75
|
|
72
76
|
def go_back_and_wait_for_view (view)
|
73
|
-
|
77
|
+
sleep(0.2)
|
78
|
+
wait_for(:timeout => 1.0,
|
79
|
+
:retry_frequency => 0.2) do
|
80
|
+
not query('navigationItemButtonView first').empty?
|
81
|
+
end
|
82
|
+
|
74
83
|
touch_transition('navigationItemButtonView first',
|
75
84
|
"view marked:'#{view}'",
|
76
85
|
{:timeout=>TOUCH_TRANSITION_TIMEOUT,
|
77
86
|
:retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
|
87
|
+
step_pause
|
78
88
|
end
|
79
89
|
|
80
|
-
def touch_navbar_item(
|
90
|
+
def touch_navbar_item(item_name, wait_for_view_id=nil)
|
81
91
|
wait_for(:timeout => 1.0,
|
82
92
|
:retry_frequency => 0.4) do
|
83
|
-
index_of_navbar_button(
|
93
|
+
(index_of_navbar_button(item_name) != nil) || button_exists?(item_name)
|
84
94
|
end
|
85
|
-
|
86
|
-
idx = index_of_navbar_button
|
95
|
+
sleep(0.2)
|
96
|
+
idx = index_of_navbar_button item_name
|
97
|
+
|
87
98
|
if idx
|
88
99
|
touch("navigationButton index:#{idx}")
|
100
|
+
unless wait_for_view_id.nil?
|
101
|
+
wait_for_view wait_for_view_id
|
102
|
+
end
|
89
103
|
step_pause
|
104
|
+
elsif button_exists? item_name
|
105
|
+
touch_button_and_wait_for_view item_name, wait_for_view_id
|
90
106
|
else
|
91
|
-
screenshot_and_raise "could not find navbar item '#{
|
107
|
+
screenshot_and_raise "could not find navbar item '#{item_name}'"
|
92
108
|
end
|
93
109
|
end
|
94
110
|
|
95
111
|
|
96
|
-
def touch_navbar_item_and_wait_for_view(
|
97
|
-
|
98
|
-
idx = index_of_navbar_button item
|
99
|
-
touch_transition("navigationButton index:#{idx}",
|
100
|
-
"view marked:'#{view}'",
|
101
|
-
{:timeout=>TOUCH_TRANSITION_TIMEOUT,
|
102
|
-
:retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
|
112
|
+
def touch_navbar_item_and_wait_for_view(item_name, view_id)
|
113
|
+
touch_navbar_item item_name, view_id
|
103
114
|
end
|
104
115
|
|
105
116
|
|
106
117
|
def navbar_has_title? (title)
|
107
|
-
|
108
|
-
query('navigationItemView',
|
118
|
+
sleep(0.2)
|
119
|
+
query('navigationItemView', AL).include?(title)
|
109
120
|
end
|
110
121
|
|
111
122
|
def should_see_navbar_with_title(title)
|
data/lib/briar/bars/tabbar.rb
CHANGED
@@ -19,20 +19,23 @@ module Briar
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def index_of_tabbar_item(name)
|
22
|
-
tabs = query('tabBarButton',
|
22
|
+
tabs = query('tabBarButton', AL)
|
23
23
|
tabs.index(name)
|
24
24
|
end
|
25
25
|
|
26
|
-
def touch_tabbar_item(name)
|
26
|
+
def touch_tabbar_item(name, wait_for_view_id=nil)
|
27
|
+
sleep(0.2)
|
27
28
|
wait_for(:timeout => 1.0,
|
28
29
|
:retry_frequency => 0.4) do
|
29
30
|
index_of_tabbar_item(name) != nil
|
30
31
|
end
|
31
|
-
wait_for_animation
|
32
32
|
should_see_tabbar
|
33
33
|
idx = index_of_tabbar_item name
|
34
34
|
if idx
|
35
35
|
touch "tabBarButton index:#{idx}"
|
36
|
+
unless wait_for_view_id.nil?
|
37
|
+
wait_for_view wait_for_view_id
|
38
|
+
end
|
36
39
|
step_pause
|
37
40
|
else
|
38
41
|
screenshot_and_raise "tabbar button with name #{name} does not exist"
|
@@ -41,7 +44,7 @@ module Briar
|
|
41
44
|
|
42
45
|
def should_see_tab_at_index(name, index)
|
43
46
|
should_see_tabbar
|
44
|
-
tabs = query('tabBarButton',
|
47
|
+
tabs = query('tabBarButton', AL)
|
45
48
|
unless tabs.index(name) == index.to_i
|
46
49
|
screenshot_and_raise "should have seen tab named '#{name}' at index '#{index}' but found these: '#{tabs}'"
|
47
50
|
end
|
data/lib/briar/bars/toolbar.rb
CHANGED
@@ -20,7 +20,7 @@ module Briar
|
|
20
20
|
#text_button_arr = query("toolbar child toolbarTextButton child button child buttonLabel", :text)
|
21
21
|
#has_text_button = text_button_arr.index(name_or_id) != nil
|
22
22
|
## look for non_text button
|
23
|
-
#toolbar_button_arr = query("toolbar child toolbarButton",
|
23
|
+
#toolbar_button_arr = query("toolbar child toolbarButton", AL)
|
24
24
|
#has_toolbar_button = toolbar_button_arr.index(name_or_id) != nil
|
25
25
|
#
|
26
26
|
#has_text_button or has_toolbar_button
|
@@ -32,5 +32,18 @@ module Briar
|
|
32
32
|
screenshot_and_raise "could not see toolbar button with name '#{name_or_id}'"
|
33
33
|
end
|
34
34
|
end
|
35
|
+
|
36
|
+
def touch_toolbar_button(button_name, and_wait_for_view_id=nil)
|
37
|
+
should_see_toolbar_button button_name
|
38
|
+
if and_wait_for_view_id.nil?
|
39
|
+
touch("toolbar descendant view marked:'#{button_name}'")
|
40
|
+
else
|
41
|
+
touch_transition("toolbar descendant view marked:'#{button_name}'",
|
42
|
+
"view marked:'#{and_wait_for_view_id}'",
|
43
|
+
{:timeout=>TOUCH_TRANSITION_TIMEOUT,
|
44
|
+
:retry_frequency=>TOUCH_TRANSITION_RETRY_FREQ})
|
45
|
+
end
|
46
|
+
step_pause
|
47
|
+
end
|
35
48
|
end
|
36
49
|
end
|
data/lib/briar/briar_core.rb
CHANGED
@@ -1,12 +1,11 @@
|
|
1
1
|
require 'calabash-cucumber'
|
2
2
|
|
3
|
+
|
3
4
|
module Briar
|
4
5
|
module Core
|
5
|
-
STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.4).to_f
|
6
|
-
ANIMATION_PAUSE = (ENV['ANIMATION_PAUSE'] || 0.6).to_f
|
7
6
|
|
8
7
|
def step_pause
|
9
|
-
sleep(
|
8
|
+
sleep(BRIAR_STEP_PAUSE)
|
10
9
|
end
|
11
10
|
|
12
11
|
def wait_for_animation
|
@@ -36,15 +35,12 @@ module Briar
|
|
36
35
|
|
37
36
|
|
38
37
|
def should_see_view_after_animation (view_id)
|
39
|
-
|
40
|
-
|
38
|
+
pending "WARN: deprecated 0.0.8 - use 'wait_for_view #{view_id}' instead"
|
39
|
+
|
41
40
|
end
|
42
41
|
|
43
42
|
def should_not_see_view_after_animation (view_id)
|
44
|
-
|
45
|
-
if view_exists? view_id
|
46
|
-
screenshot_and_raise "should not see view with id '#{view_id}'"
|
47
|
-
end
|
43
|
+
pending "WARN: deprecated 0.0.8 - use 'wait_for_view_to_disappear #{view_id}' instead"
|
48
44
|
end
|
49
45
|
|
50
46
|
def should_see_view_with_text (text)
|
@@ -58,6 +54,10 @@ module Briar
|
|
58
54
|
touch("view marked:'#{view_id}'")
|
59
55
|
end
|
60
56
|
|
57
|
+
def touch_and_wait_for_view(view_id, view_to_wait_for, timeout=1.0)
|
58
|
+
touch_view_named(view_id)
|
59
|
+
wait_for_view(view_to_wait_for, timeout)
|
60
|
+
end
|
61
61
|
|
62
62
|
def wait_for_view (view_id, timeout=1.0)
|
63
63
|
msg = "waited for '#{timeout}' seconds but did not see '#{view_id}'"
|
@@ -69,18 +69,49 @@ module Briar
|
|
69
69
|
end
|
70
70
|
end
|
71
71
|
|
72
|
+
def wait_for_views(views, timeout=1.0)
|
73
|
+
msg = "waited for '#{timeout}' seconds but did not see '#{views}'"
|
74
|
+
options = {:timeout => timeout,
|
75
|
+
:retry_frequency => 0.2,
|
76
|
+
:post_timeout => 0.1,
|
77
|
+
:timeout_message => msg}
|
78
|
+
wait_for(options) do
|
79
|
+
views.all? { |view_id| view_exists?(view_id) }
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
72
83
|
def wait_for_view_to_disappear(view_id, timeout=1.0)
|
73
|
-
views = [view_id]
|
74
84
|
msg = "waited for '#{timeout}' seconds for '#{view_id}' to disappear but it is still visible"
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
85
|
+
options = {:timeout => timeout,
|
86
|
+
:retry_frequency => 0.2,
|
87
|
+
:post_timeout => 0.1,
|
88
|
+
:timeout_message => msg}
|
89
|
+
wait_for(options) do
|
90
|
+
not view_exists? view_id
|
91
|
+
end
|
79
92
|
end
|
80
93
|
|
94
|
+
|
81
95
|
def touch_and_wait_to_disappear(view_id, timeout=1.0)
|
82
|
-
|
96
|
+
touch_view_named(view_id)
|
83
97
|
wait_for_view_to_disappear view_id, timeout
|
84
98
|
end
|
99
|
+
|
100
|
+
# backdoor helpers
|
101
|
+
# canonical backdoor command: 'calabash_backdoor_handle_command'
|
102
|
+
# selector key = :selector
|
103
|
+
# args key = :args
|
104
|
+
def send_backdoor_command(command, args=[])
|
105
|
+
if args.empty?
|
106
|
+
json = "{\":selector\" : \"#{command}\"}"
|
107
|
+
return backdoor('calabash_backdoor_handle_command:', json)
|
108
|
+
end
|
109
|
+
|
110
|
+
array = args.kind_of?(Array) ? args : [args]
|
111
|
+
json = "{\":selector\" : \"#{command}\", \":args\" : #{array}}"
|
112
|
+
backdoor('calabash_backdoor_handle_command:', json)
|
113
|
+
end
|
85
114
|
end
|
86
115
|
end
|
116
|
+
|
117
|
+
|