briar 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +9 -9
- data/README.md +15 -17
- data/bin/briar +94 -55
- data/bin/briar_helpers.rb +18 -5
- data/bin/briar_resign.rb +272 -0
- data/briar.gemspec +3 -6
- data/cucumber.yml.example +20 -3
- data/features/step_definitions/briar_core_steps.rb +1 -1
- data/features/step_definitions/control/button_steps.rb +1 -1
- data/features/step_definitions/control/slider_steps.rb +2 -0
- data/features/step_definitions/email_steps.rb +12 -12
- data/features/step_definitions/keyboard_steps.rb +1 -0
- data/features/step_definitions/label_steps.rb +1 -1
- data/features/step_definitions/picker/date_picker_steps.rb +22 -3
- data/features/step_definitions/table_steps.rb +17 -6
- data/features/step_definitions/text_view_steps.rb +4 -10
- data/lib/briar.rb +10 -1
- data/lib/briar/alerts_and_sheets/action_sheet.rb +2 -2
- data/lib/briar/alerts_and_sheets/alert_view.rb +78 -19
- data/lib/briar/bars/navbar.rb +56 -20
- data/lib/briar/briar_core.rb +80 -9
- data/lib/briar/control/button.rb +16 -19
- data/lib/briar/email.rb +88 -30
- data/lib/briar/keyboard.rb +40 -40
- data/lib/briar/label.rb +1 -3
- data/lib/briar/picker/date_picker.rb +9 -1
- data/lib/briar/picker/date_picker_manipulation.rb +2 -2
- data/lib/briar/table.rb +56 -25
- data/lib/briar/text_field.rb +6 -4
- data/lib/briar/text_view.rb +33 -8
- data/lib/briar/version.rb +1 -1
- metadata +6 -34
- data/install-calabash-framework.sh.example +0 -10
data/briar.gemspec
CHANGED
@@ -14,15 +14,12 @@ Gem::Specification.new do |gem|
|
|
14
14
|
gem.homepage = 'https://github.com/jmoody/briar'
|
15
15
|
gem.license = 'MIT'
|
16
16
|
|
17
|
-
|
18
|
-
gem.add_runtime_dependency 'calabash-cucumber', '0.9.
|
19
|
-
gem.add_runtime_dependency 'rake'
|
20
|
-
gem.add_runtime_dependency 'bundler'
|
21
|
-
gem.add_runtime_dependency 'lesspainful'
|
17
|
+
gem.add_runtime_dependency 'calabash-cucumber'
|
18
|
+
#gem.add_runtime_dependency 'calabash-cucumber', '0.9.159'
|
19
|
+
gem.add_runtime_dependency 'rake'
|
22
20
|
gem.add_runtime_dependency 'syntax'
|
23
21
|
gem.add_runtime_dependency 'rspec'
|
24
22
|
|
25
|
-
|
26
23
|
# rubymine is not picking up development dependencies in the gemspec
|
27
24
|
#gem.add_development_dependency 'rspec'
|
28
25
|
|
data/cucumber.yml.example
CHANGED
@@ -1,4 +1,21 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
<%
|
2
|
+
|
3
|
+
date = Time.now.strftime('%Y-%m-%d-%H%M-%S')
|
4
|
+
default_report = "./reports/calabash-#{date}.html"
|
5
|
+
|
6
|
+
ss_path = "#{Dir.pwd}/screenshots/"
|
7
|
+
|
8
|
+
`mkdir ./screenshots` unless File.exists?("./screenshots")
|
9
|
+
`mkdir ./reports` unless File.exists?("./reports")
|
10
|
+
|
11
|
+
%>
|
12
|
+
|
13
|
+
ss_path: SCREENSHOT_PATH=<%= ss_path %>
|
14
|
+
html_report: -f html -o <%= default_report %>
|
15
|
+
|
16
|
+
uai: DEVICE_TARGET=simulator
|
17
|
+
|
18
|
+
default: -p ss_path -p html_report -p uai
|
19
|
+
|
20
|
+
|
4
21
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
#include Briar::Core
|
2
1
|
|
3
2
|
Then /^I should (see|not see) (?:the|) "([^\"]*)" view$/ do |visibility, view_id|
|
4
3
|
if visibility.eql? 'see'
|
@@ -7,3 +6,4 @@ Then /^I should (see|not see) (?:the|) "([^\"]*)" view$/ do |visibility, view_id
|
|
7
6
|
should_not_see_view view_id
|
8
7
|
end
|
9
8
|
end
|
9
|
+
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
When /^I touch (?:the|a) "([^"]*)" button, then I should see the "([^"]*)" view$/ do |button_id, view_id|
|
2
|
+
When /^I touch (?:the|a) "([^"]*)" button, (?:then I|I) should see (?:the|a) "([^"]*)" view$/ do |button_id, view_id|
|
3
3
|
touch_button_and_wait_for_view button_id, view_id
|
4
4
|
end
|
5
5
|
|
@@ -1,7 +1,9 @@
|
|
1
1
|
#include Briar::Control::Slider
|
2
2
|
|
3
3
|
When /^I change the "([^"]*)" slider to (\d+)$/ do |slider_id, value|
|
4
|
+
wait_for_query("slider marked:'#{slider_id}'")
|
4
5
|
change_slider_value_to slider_id, value
|
6
|
+
step_pause
|
5
7
|
@slider_that_was_changed = slider_id
|
6
8
|
@slider_new_value = value
|
7
9
|
end
|
@@ -5,8 +5,8 @@ Then /^I should see email body that contains "([^"]*)"$/ do |text|
|
|
5
5
|
end
|
6
6
|
|
7
7
|
Then /^I should see email view with body that contains "([^"]*)"$/ do |text|
|
8
|
-
|
9
|
-
|
8
|
+
unless device.ios5?
|
9
|
+
warn_about_no_ios5_email_view
|
10
10
|
else
|
11
11
|
wait_for_animation
|
12
12
|
unless email_body_contains? text
|
@@ -23,8 +23,8 @@ Then /^I touch the "([^"]*)" row and wait to see the email view$/ do |row_id|
|
|
23
23
|
should_see_row row_id
|
24
24
|
touch("tableViewCell marked:'#{row_id}'")
|
25
25
|
wait_for_animation
|
26
|
-
|
27
|
-
|
26
|
+
unless device.ios5?
|
27
|
+
warn_about_no_ios5_email_view
|
28
28
|
else
|
29
29
|
should_see_mail_view
|
30
30
|
end
|
@@ -34,8 +34,8 @@ Then /^I touch the "([^"]*)" row and wait to see the email view$/ do |row_id|
|
|
34
34
|
end
|
35
35
|
|
36
36
|
Then /^I should see email view with "([^"]*)" in the subject$/ do |text|
|
37
|
-
|
38
|
-
|
37
|
+
unless device.ios5?
|
38
|
+
warn_about_no_ios5_email_view
|
39
39
|
else
|
40
40
|
wait_for_animation
|
41
41
|
should_see_mail_view
|
@@ -46,8 +46,8 @@ Then /^I should see email view with "([^"]*)" in the subject$/ do |text|
|
|
46
46
|
end
|
47
47
|
|
48
48
|
Then /^I should see email view with recipients? "([^"]*)"$/ do |comma_sep_addrs|
|
49
|
-
|
50
|
-
|
49
|
+
unless device.ios5?
|
50
|
+
warn_about_no_ios5_email_view
|
51
51
|
else
|
52
52
|
should_see_recipients comma_sep_addrs
|
53
53
|
end
|
@@ -59,8 +59,8 @@ Then /^I should see email view with to field set to "([^"]*)"$/ do |text|
|
|
59
59
|
end
|
60
60
|
|
61
61
|
Then /^I should see email view with text like "([^"]*)" in the subject$/ do |text|
|
62
|
-
|
63
|
-
|
62
|
+
unless device.ios5?
|
63
|
+
warn_about_no_ios5_email_view
|
64
64
|
else
|
65
65
|
should_see_mail_view
|
66
66
|
wait_for_animation
|
@@ -71,10 +71,10 @@ Then /^I should see email view with text like "([^"]*)" in the subject$/ do |tex
|
|
71
71
|
end
|
72
72
|
|
73
73
|
When /^I cancel email editing I should see the "([^"]*)" view$/ do |view_id|
|
74
|
-
|
74
|
+
unless device.ios5?
|
75
75
|
delete_draft_and_wait_for view_id
|
76
76
|
else
|
77
|
-
|
77
|
+
warn_about_no_ios5_email_view
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
@@ -9,7 +9,7 @@ Then /^I should (see|not see) "([^"]*)" in label "([^"]*)"$/ do |visibility, tex
|
|
9
9
|
end
|
10
10
|
|
11
11
|
Then /^I should (see|not see) label "([^"]*)" with text "([^"]*)"$/ do |visibility, name, text|
|
12
|
-
if visibility.eql?
|
12
|
+
if visibility.eql? 'see'
|
13
13
|
should_see_label_with_text(name, text)
|
14
14
|
else
|
15
15
|
should_not_see_label_with_text(name, text)
|
@@ -39,9 +39,23 @@ Then /^I change the picker date time to "([^"]*)"$/ do |target_time|
|
|
39
39
|
end
|
40
40
|
|
41
41
|
|
42
|
-
Then /^I should see that the date picker is in time mode$/ do
|
43
|
-
|
44
|
-
|
42
|
+
Then /^I should see that the date picker is in (time|date|date and time) mode$/ do |mode|
|
43
|
+
if mode.eql? 'time'
|
44
|
+
unless picker_is_in_time_mode
|
45
|
+
screenshot_and_raise 'expected to see picker with time mode'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
if mode.eql? 'date'
|
50
|
+
unless picker_is_in_date_mode
|
51
|
+
screenshot_and_raise 'expected to see picker with date mode'
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
if mode.eql? 'date and time'
|
56
|
+
unless picker_is_in_date_and_time_mode
|
57
|
+
screenshot_and_raise 'expected to see picker with date and time mode'
|
58
|
+
end
|
45
59
|
end
|
46
60
|
end
|
47
61
|
|
@@ -55,6 +69,11 @@ Then /^I should see that the "([^"]*)" row has the time I just entered in the "(
|
|
55
69
|
should_see_row_has_time_i_just_entered row_id, label_id
|
56
70
|
end
|
57
71
|
|
72
|
+
When(/^I change the time on the picker to "([^"]*)", I should see the "([^"]*)" label has the correct time$/) do |time_str, label_id|
|
73
|
+
change_time_on_picker_with_time_str time_str
|
74
|
+
should_see_label_has_time_i_just_entered label_id
|
75
|
+
end
|
76
|
+
|
58
77
|
# does not require a time or date change. picker needs to be visible
|
59
78
|
Then /^I should see that the "([^"]*)" row has the same time as the picker in the "([^"]*)" label$/ do |row_id, label_id|
|
60
79
|
should_see_row_has_label_with_time_on_picker row_id, label_id
|
@@ -20,6 +20,7 @@ end
|
|
20
20
|
|
21
21
|
Then /^I touch (?:the) "([^"]*)" row and wait for (?:the) "([^"]*)" view to appear$/ do |row_id, view_id|
|
22
22
|
wait_for_row row_id
|
23
|
+
step_pause
|
23
24
|
touch_row_and_wait_to_see row_id, view_id
|
24
25
|
end
|
25
26
|
|
@@ -94,12 +95,17 @@ Then /^I should see that the text I just entered is in the "([^"]*)" row "([^"]*
|
|
94
95
|
end
|
95
96
|
|
96
97
|
Then /^I move the "([^"]*)" row (up|down) (\d+) times? using the reorder edit control$/ do |row_id, dir, n|
|
98
|
+
if device.ios7?
|
99
|
+
pending 'reordering on iOS 7 (more specifically playback) is not supported'
|
100
|
+
end
|
101
|
+
|
97
102
|
should_see_row row_id
|
98
103
|
dir_str = (dir.eql?('up')) ? 'drag_row_up' : 'drag_row_down'
|
99
|
-
n.to_i.times do
|
100
|
-
|
101
|
-
|
102
|
-
|
104
|
+
n.to_i.times do
|
105
|
+
(
|
106
|
+
playback(dir_str,
|
107
|
+
{:query => "tableViewCell marked:'#{row_id}' descendant tableViewCellReorderControl"})
|
108
|
+
step_pause)
|
103
109
|
end
|
104
110
|
end
|
105
111
|
|
@@ -113,13 +119,13 @@ end
|
|
113
119
|
|
114
120
|
Then /^I should see a "([^"]*)" button in the "([^"]*)" row$/ do |button_id, row_id|
|
115
121
|
should_see_row row_id
|
116
|
-
arr = query("tableViewCell marked:'#{row_id}' descendant
|
122
|
+
arr = query("tableViewCell marked:'#{row_id}' descendant button marked:'#{button_id}'", AI)
|
117
123
|
(arr.length == 1)
|
118
124
|
end
|
119
125
|
|
120
126
|
Then /^I touch the "([^"]*)" button in the "([^"]*)" row$/ do |button_id, row_id|
|
121
127
|
should_see_row row_id
|
122
|
-
touch("tableViewCell marked:'#{row_id}'
|
128
|
+
touch("tableViewCell marked:'#{row_id}' descendant button marked:'#{button_id}'")
|
123
129
|
end
|
124
130
|
|
125
131
|
Then /^I should see a switch for "([^"]*)" in the "([^"]*)" row that is in the "([^"]*)" position$/ do |switch_id, row_id, on_off|
|
@@ -153,3 +159,8 @@ Then /^I should see that the "([^"]*)" row has image "([^"]*)"$/ do |row_id, ima
|
|
153
159
|
should_see_row_with_image row_id, image_id
|
154
160
|
end
|
155
161
|
|
162
|
+
|
163
|
+
Then(/^I should see that the "([^"]*)" row has no text in the "([^"]*)" label$/) do |row_id, label_id|
|
164
|
+
should_see_row_with_label_that_has_no_text
|
165
|
+
end
|
166
|
+
|
@@ -1,8 +1,6 @@
|
|
1
|
-
Then /^I clear text view named "([^\"]*)"$/ do |name|
|
2
|
-
|
3
|
-
|
4
|
-
clear_text("textView marked:'#{name}'")
|
5
|
-
end
|
1
|
+
Then /^I clear (?:text|the text) view named "([^\"]*)"$/ do |name|
|
2
|
+
wait_for_query "textView marked:'#{name}'"
|
3
|
+
briar_clear_text(name)
|
6
4
|
end
|
7
5
|
|
8
6
|
Then /^I should not see "([^"]*)" text view$/ do |name|
|
@@ -10,11 +8,7 @@ Then /^I should not see "([^"]*)" text view$/ do |name|
|
|
10
8
|
end
|
11
9
|
|
12
10
|
Then /^I should see the text I just entered in the "([^"]*)" text view$/ do |text_view_id|
|
13
|
-
|
14
|
-
text = query("textView marked:'#{text_view_id}'", :text).first
|
15
|
-
unless @text_entered_by_keyboard.eql? text
|
16
|
-
screenshot_and_raise "i expected to see '#{@text_entered_by_keyboard}' in text view '#{text_view_id}' but found '#{text}'"
|
17
|
-
end
|
11
|
+
should_see_text_view_with_text text_view_id, @text_entered_by_keyboard
|
18
12
|
end
|
19
13
|
|
20
14
|
Then /^I should see text view "([^"]*)" with placeholder text "([^"]*)"$/ do |text_view, placeholder|
|
data/lib/briar.rb
CHANGED
@@ -3,9 +3,12 @@
|
|
3
3
|
DEVICE_ENDPOINT = (ENV['DEVICE_ENDPOINT'] || 'http://localhost:37265')
|
4
4
|
TOUCH_TRANSITION_TIMEOUT = 30.0
|
5
5
|
TOUCH_TRANSITION_RETRY_FREQ = 0.5
|
6
|
-
BRIAR_STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.
|
6
|
+
BRIAR_STEP_PAUSE = (ENV['STEP_PAUSE'] || 0.5).to_f
|
7
|
+
BRIAR_WAIT_TIMEOUT = (ENV['WAIT_TIMEOUT'] || 2.0).to_f
|
7
8
|
ANIMATION_PAUSE = (ENV['ANIMATION_PAUSE'] || 0.6).to_f
|
9
|
+
#noinspection RubyConstantNamingConvention
|
8
10
|
AI = :accessibilityIdentifier
|
11
|
+
#noinspection RubyConstantNamingConvention
|
9
12
|
AL = :accessibilityLabel
|
10
13
|
|
11
14
|
require 'briar/version'
|
@@ -60,6 +63,12 @@ def device ()
|
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
66
|
+
def uia_available?
|
67
|
+
launcher = Calabash::Cucumber::Launcher.launcher
|
68
|
+
return false if launcher.nil?
|
69
|
+
launcher.active?
|
70
|
+
end
|
71
|
+
|
63
72
|
#noinspection RubyDefParenthesesInspection
|
64
73
|
def gestalt ()
|
65
74
|
pending("deprecated 0.0.8: replaced with Calabash::Cucumber::Device implementation - from now on use use 'device.*'")
|
@@ -33,7 +33,7 @@ module Briar
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def wait_for_sheet (sheet_id, timeout=
|
36
|
+
def wait_for_sheet (sheet_id, timeout=BRIAR_WAIT_TIMEOUT)
|
37
37
|
msg = "waited for '#{timeout}' seconds but did not see '#{sheet_id}'"
|
38
38
|
wait_for(:timeout => timeout,
|
39
39
|
:retry_frequency => 0.2,
|
@@ -43,7 +43,7 @@ module Briar
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def wait_for_sheet_to_disappear(sheet_id, timeout=
|
46
|
+
def wait_for_sheet_to_disappear(sheet_id, timeout=BRIAR_WAIT_TIMEOUT)
|
47
47
|
msg = "waited for '#{timeout}' seconds for '#{sheet_id}' to disappear but it is still visible"
|
48
48
|
options = {:timeout => timeout,
|
49
49
|
:retry_frequency => 0.2,
|
@@ -1,27 +1,88 @@
|
|
1
1
|
module Briar
|
2
2
|
module Alerts_and_Sheets
|
3
|
+
|
4
|
+
|
5
|
+
# of interest
|
6
|
+
# touch("view:'_UIModalItemAlertContentView' descendant view:'_UIModalItemTableViewCell' marked:'OK'")
|
7
|
+
|
3
8
|
def alert_exists? (alert_id=nil)
|
4
|
-
if
|
5
|
-
|
9
|
+
if device.ios7?
|
10
|
+
res = send_uia_command command:'uia.alert() != null'
|
11
|
+
res['value']
|
6
12
|
else
|
7
|
-
|
13
|
+
if alert_id.nil?
|
14
|
+
!query('alertView').empty?
|
15
|
+
else
|
16
|
+
!query("alertView marked:'#{alert_id}'").empty?
|
17
|
+
end
|
8
18
|
end
|
9
19
|
end
|
10
20
|
|
11
21
|
def should_see_alert (alert_id=nil)
|
12
22
|
unless alert_exists? alert_id
|
13
|
-
|
23
|
+
if alert_id.nil?
|
24
|
+
screenshot_and_raise 'should see alert view'
|
25
|
+
else
|
26
|
+
screenshot_and_raise "should see alert view marked '#{alert_id}'"
|
27
|
+
end
|
14
28
|
end
|
15
29
|
end
|
16
30
|
|
17
31
|
def should_not_see_alert (alert_id=nil)
|
18
32
|
if alert_exists? alert_id
|
19
|
-
|
33
|
+
if alert_id.nil?
|
34
|
+
screenshot_and_raise 'should not see alert view'
|
35
|
+
else
|
36
|
+
screenshot_and_raise "should not see alert view marked '#{alert_id}'"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def should_see_alert_with_title (title, timeout=BRIAR_WAIT_TIMEOUT)
|
42
|
+
warn 'cannot distinguish between alert titles and messages'
|
43
|
+
if device.ios7?
|
44
|
+
should_see_alert()
|
45
|
+
if uia_query(:view, marked:"#{title}").empty?
|
46
|
+
screenshot_and_raise "expected to see alert with title '#{title}'"
|
47
|
+
end
|
48
|
+
else
|
49
|
+
qstr = 'alertView child label'
|
50
|
+
msg = "waited for '#{timeout}' for alert with title '#{title}'"
|
51
|
+
wait_for(:timeout => timeout,
|
52
|
+
:retry_frequency => 0.2,
|
53
|
+
:post_timeout => 0.1,
|
54
|
+
:timeout_message => msg) do
|
55
|
+
query(qstr, :text).include?(title)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def should_see_alert_with_message (message)
|
61
|
+
warn 'cannot distinguish between alert titles and messages'
|
62
|
+
if device.ios7?
|
63
|
+
should_see_alert()
|
64
|
+
if uia_query(:view, marked:"#{message}").empty?
|
65
|
+
screenshot_and_raise "expected to see alert with title '#{message}'"
|
66
|
+
end
|
67
|
+
else
|
68
|
+
qstr = 'alertView child label'
|
69
|
+
msg = "waited for '#{timeout}' for alert with message '#{message}'"
|
70
|
+
wait_for(:timeout => timeout,
|
71
|
+
:retry_frequency => 0.2,
|
72
|
+
:post_timeout => 0.1,
|
73
|
+
:timeout_message => msg) do
|
74
|
+
query(qstr, :text).include?(title)
|
75
|
+
end
|
20
76
|
end
|
21
77
|
end
|
22
78
|
|
23
79
|
def alert_button_exists? (button_id)
|
24
|
-
|
80
|
+
if device.ios7?
|
81
|
+
should_see_alert()
|
82
|
+
not uia_query(:view, marked:"#{button_id}").empty?
|
83
|
+
else
|
84
|
+
query('alertView child button child label', :text).include?(button_id)
|
85
|
+
end
|
25
86
|
end
|
26
87
|
|
27
88
|
def should_see_alert_button (button_id)
|
@@ -31,24 +92,22 @@ module Briar
|
|
31
92
|
end
|
32
93
|
|
33
94
|
def dismiss_alert_with_button (button_label)
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
unless query('alertView child label', :text).include?(title)
|
40
|
-
screenshot_and_raise "i do not see an alert view with title '#{title}'"
|
95
|
+
touch_alert_button(button_label)
|
96
|
+
if device.ios7?
|
97
|
+
wait_for_view_to_disappear button_label
|
98
|
+
else
|
99
|
+
wait_for_view_to_disappear 'alertView'
|
41
100
|
end
|
42
101
|
end
|
43
102
|
|
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
103
|
|
50
104
|
def touch_alert_button(button_title)
|
51
|
-
|
105
|
+
should_see_alert()
|
106
|
+
if device.ios7?
|
107
|
+
touch("view marked:'#{button_title}'")
|
108
|
+
else
|
109
|
+
touch("alertView child button marked:'#{button_title}'")
|
110
|
+
end
|
52
111
|
step_pause
|
53
112
|
end
|
54
113
|
end
|