brazenhead 0.4.4 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,3 +13,18 @@ Feature: Using the Brazenhead target
13
13
  Given I'm on the controls screen
14
14
  When I select item "6" from the spinner view with id "spinner1"
15
15
  Then the text "Uranus" is selected in the spinner
16
+
17
+ Scenario: Finding list items by text
18
+ Given I'm on the custom lists screen
19
+ When I select the list item that contains "Lorem ipsum"
20
+ Then the found list item should be a "android.widget.RelativeLayout"
21
+
22
+ Scenario: Finding list items by index
23
+ Given I'm on the arrays list
24
+ When I select the list item at index "12"
25
+ Then the text of the found list item should be "Aisy Cendre"
26
+
27
+ Scenario: Pressing list items by index
28
+ When I'm on the lists screen
29
+ Then I can select list item "18" even if it is off of the screen
30
+ And I should see "Views.Lists.18. Custom items"
@@ -16,6 +16,10 @@ Feature: Calling Robotium methods
16
16
  When I call a method with a float
17
17
  Then I should receive a successful result
18
18
 
19
+ Scenario: Calling a method with longs
20
+ When I call a method with a long
21
+ Then I should receive a successful result
22
+
19
23
  Scenario: Calling a method with booleans
20
24
  When I call a method with a boolean
21
25
  Then I should receive a successful result
@@ -4,6 +4,11 @@ Feature: Serializing Information
4
4
  When I call a method that returns a view
5
5
  Then we should have basic information about a view
6
6
 
7
- # Scenario: Getting text view information
8
- # When I call a method that returns a text view
9
- # Then the text for the view should be returned
7
+ Scenario: Getting text view information
8
+ When I call a method that returns a text view
9
+ Then the text for the view should be returned
10
+
11
+ Scenario: Getting image view information
12
+ Given I'm on the image view screen
13
+ When I call a method that returns an image view
14
+ Then information about the image should be returned
@@ -7,11 +7,30 @@ Then /^I should receive an id value back from the Brazenhead module$/ do
7
7
  end
8
8
 
9
9
  Given /^I'm on the controls screen$/ do
10
- @driver.click_on_text "Views"
11
- @driver.click_on_text "Controls"
12
- @driver.click_on_text "Light Theme"
10
+ @navigation.controls_screen
13
11
  end
14
12
 
13
+ Given /^I'm on the lists screen$/ do
14
+ @navigation.lists_screen
15
+ end
16
+
17
+ Given /^I'm on the custom lists screen$/ do
18
+ @navigation.custom_lists_screen
19
+ end
20
+
21
+ Given /^I'm on the views list$/ do
22
+ @navigation.view_list
23
+ end
24
+
25
+ Given /^I'm on the arrays list$/ do
26
+ @navigation.arrays_list
27
+ end
28
+
29
+ Given /^I'm on the image view screen$/ do
30
+ @navigation.image_view_screen
31
+ end
32
+
33
+
15
34
  When /^I select item "(.*?)" from the spinner with id "(.*?)"$/ do |index, id|
16
35
  @driver.chain_calls do |device|
17
36
  device.id_from_name id, :variable => '@@the_id@@', :target => 'Brazenhead'
@@ -30,3 +49,34 @@ end
30
49
  Then /^the text "(.*?)" is selected in the spinner$/ do |spinner_text|
31
50
  @driver.is_spinner_text_selected(spinner_text).should be_true
32
51
  end
52
+
53
+ When /^I select the list item that contains "(.*?)"$/ do |item_text|
54
+ @driver.list_item_by_text item_text, :target => 'Brazenhead'
55
+ end
56
+
57
+ Then /^the found list item should be a "(.*?)"$/ do |class_type|
58
+ @driver.last_json["classType"].should eq(class_type)
59
+ end
60
+
61
+ Then /^I can select list item "(.*?)" even if it is off of the screen$/ do |index|
62
+ @driver.press_list_item_by_index index.to_i, :target => 'Brazenhead'
63
+ @driver.last_response.code.should eq('200')
64
+ end
65
+
66
+ Then /^I should be on the "(.*?)" activity$/ do |activity|
67
+ @driver.chain_calls do |device|
68
+ device.get_current_activity
69
+ device.get_class
70
+ device.to_string
71
+ end
72
+ @driver.last_json.should match(activity)
73
+ end
74
+
75
+ When /^I select the list item at index "(.*?)"$/ do |index|
76
+ @driver.list_item_by_index index.to_i, :target => 'Brazenhead'
77
+ end
78
+
79
+ Then /^the text of the found list item should be "(.*?)"$/ do |text|
80
+ @driver.last_json['text'].should eq(text)
81
+ end
82
+
@@ -14,6 +14,10 @@ When /^I call a method with a string$/ do
14
14
  @driver.search_button('will not find')
15
15
  end
16
16
 
17
+ When /^I call a method with a long$/ do
18
+ @driver.wait_for_text('Views', 1, 5000)
19
+ end
20
+
17
21
  When /^I call a method with a float$/ do
18
22
  @driver.click_on_screen(100.0, 100.0)
19
23
  end
@@ -39,6 +43,6 @@ end
39
43
 
40
44
  Then /^I should see "(.*?)"$/ do |text|
41
45
  @driver.search_text text
42
- @last_response.body.should eq 'true'
46
+ @driver.last_json.should be_true
43
47
  end
44
48
 
@@ -28,3 +28,14 @@ end
28
28
  Then /^the text for the view should be returned$/ do
29
29
  @driver.json_response.should have_key "text"
30
30
  end
31
+
32
+ When /^I call a method that returns an image view$/ do
33
+ @driver.get_image 0
34
+ end
35
+
36
+ Then /^information about the image should be returned$/ do
37
+ response = @driver.json_response
38
+ response.should have_key "hasDrawable"
39
+ response.should have_key "drawableRect"
40
+ end
41
+
@@ -29,6 +29,7 @@ end
29
29
 
30
30
  Before do
31
31
  @driver = Driver.new
32
+ @navigation = Navigation.new @driver
32
33
  server.start("ApiDemos")
33
34
  end
34
35
 
@@ -0,0 +1,74 @@
1
+ class Navigation
2
+ def initialize(driver)
3
+ @driver = driver
4
+ end
5
+
6
+ def controls_screen
7
+ views
8
+ controls
9
+ light_theme
10
+ end
11
+
12
+ def lists_screen
13
+ views
14
+ lists
15
+ end
16
+
17
+ def custom_lists_screen
18
+ lists_screen
19
+ custom_list_items
20
+ end
21
+
22
+ def arrays_list
23
+ lists_screen
24
+ arrays
25
+ end
26
+
27
+ def image_view_screen
28
+ views
29
+ image_view
30
+ end
31
+
32
+ private
33
+ def press_list_item(locator)
34
+ press_by_text(locator[:text]) if locator[:text]
35
+ press_by_index(locator[:index]) if locator[:index]
36
+ end
37
+
38
+ def press_by_text(text)
39
+ @driver.click_on_text text
40
+ end
41
+
42
+ def press_by_index(index)
43
+ @driver.press_list_item_by_index index, :target => 'Brazenhead'
44
+ end
45
+
46
+ def views
47
+ press_list_item(:text => 'Views')
48
+ end
49
+
50
+ def controls
51
+ press_list_item(:text => 'Controls')
52
+ end
53
+
54
+ def light_theme
55
+ press_list_item(:text => 'Light Theme')
56
+ end
57
+
58
+ def lists
59
+ press_list_item(:text => '^Lists$')
60
+ end
61
+
62
+ def custom_list_items
63
+ press_list_item(:text => "18\..*Custom")
64
+ end
65
+
66
+ def arrays
67
+ press_list_item(:text => "01\. Array")
68
+ end
69
+
70
+ def image_view
71
+ press_list_item(:text => 'ImageView')
72
+ end
73
+
74
+ end
@@ -35,7 +35,13 @@ module Brazenhead
35
35
  end
36
36
 
37
37
  def reinstall(apk, timeout=90)
38
- install apk, "-r", {}, timeout
38
+ begin
39
+ install apk, "-r", {}, timeout
40
+ rescue ADB::ADBError => e
41
+ $stdout.puts last_stdout
42
+ $stderr.puts last_stderr
43
+ raise e
44
+ end
39
45
  end
40
46
 
41
47
  def copy_base_files
@@ -1,3 +1,3 @@
1
1
  module Brazenhead
2
- VERSION = "0.4.4"
2
+ VERSION = "0.4.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brazenhead
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.4
4
+ version: 0.4.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-10-18 00:00:00.000000000 Z
13
+ date: 2012-10-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: childprocess
@@ -99,6 +99,7 @@ files:
99
99
  - features/support/ApiDemos.apk
100
100
  - features/support/debug.keystore
101
101
  - features/support/env.rb
102
+ - features/support/navigation.rb
102
103
  - lib/brazenhead.rb
103
104
  - lib/brazenhead/android.rb
104
105
  - lib/brazenhead/builder.rb
@@ -137,12 +138,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
137
138
  - - ! '>='
138
139
  - !ruby/object:Gem::Version
139
140
  version: '0'
141
+ segments:
142
+ - 0
143
+ hash: -4246091597289591092
140
144
  required_rubygems_version: !ruby/object:Gem::Requirement
141
145
  none: false
142
146
  requirements:
143
147
  - - ! '>='
144
148
  - !ruby/object:Gem::Version
145
149
  version: '0'
150
+ segments:
151
+ - 0
152
+ hash: -4246091597289591092
146
153
  requirements: []
147
154
  rubyforge_project:
148
155
  rubygems_version: 1.8.24
@@ -164,6 +171,7 @@ test_files:
164
171
  - features/support/ApiDemos.apk
165
172
  - features/support/debug.keystore
166
173
  - features/support/env.rb
174
+ - features/support/navigation.rb
167
175
  - spec/lib/brazenhead/android_spec.rb
168
176
  - spec/lib/brazenhead/builder_spec.rb
169
177
  - spec/lib/brazenhead/call_accumulator_spec.rb