Skip to content

Commit 20c0c4d

Browse files
Merge pull request #289 from sofaking/master
Green tests on iOS 8.1/Xcode 6.1/ruby 2.0
2 parents 99c0b12 + 0e223ac commit 20c0c4d

File tree

8 files changed

+30
-23
lines changed

8 files changed

+30
-23
lines changed

ios_tests/appium.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[caps]
22
platformName = "ios"
3+
platformVersion = "8.1"
34
deviceName ="iPhone Simulator"
45
app = "./UICatalog.app"
56

67
[appium_lib]
78
sauce_username = ""
8-
sauce_access_key = ""
9+
sauce_access_key = ""

ios_tests/lib/ios/specs/common/helper.rb

+8-8
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,11 @@ def before_first
9292
end
9393

9494
t 'xpaths' do
95-
xpaths('//UIAStaticText').length.must_equal 13
95+
xpaths('//UIAStaticText').length.must_equal 25
9696
end
9797

9898
def uibutton_text
99-
'Buttons, Various uses of UIButton'
99+
'Buttons'
100100
end
101101

102102
t 'ele_index' do
@@ -135,7 +135,7 @@ def uibutton_text
135135

136136
t 'find_eles_by_attr_include' do
137137
ele_count = find_eles_by_attr_include('UIAStaticText', :name, 'e').length
138-
ele_count.must_equal 12
138+
ele_count.must_equal 19
139139
end
140140

141141
t 'first_ele' do
@@ -144,8 +144,8 @@ def uibutton_text
144144

145145
t 'last_ele' do
146146
el = last_ele('UIAStaticText')
147-
el.text.must_equal 'Transitions, Shows UIViewAnimationTransitions'
148-
el.name.must_equal 'Transitions, Shows UIViewAnimationTransitions'
147+
el.text.must_equal 'Transitions'
148+
el.name.must_equal 'Transitions'
149149
end
150150

151151
# t 'source' do # tested by get_source
@@ -166,15 +166,15 @@ def uibutton_text
166166
end
167167

168168
t 'tag' do
169-
tag('UIATableCell').name.must_equal 'Buttons, Various uses of UIButton'
169+
tag('UIATableCell').name.must_equal uibutton_text
170170
end
171171

172172
t 'tags' do
173173
tags('UIATableCell').length.must_equal 12
174174
end
175175

176176
t 'find_eles_by_attr_include' do
177-
find_eles_by_attr_include('UIATableCell', 'name', 'Use').length.must_equal 7
177+
find_eles_by_attr_include('UIAStaticText', 'name', 'Use').length.must_equal 7
178178
end
179179

180180
t 'get_page_class' do
@@ -200,4 +200,4 @@ def uibutton_text
200200
xpaths_visible_exact
201201
raise_no_element_error
202202
=end
203-
end
203+
end

ios_tests/lib/ios/specs/common/web_context.rb

+7-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,15 @@
22
describe 'the web context' do
33

44
t 'get_android_inspect' do
5-
text('Web, Use of UIWebView').click
5+
text('Web').click
66
set_context 'WEBVIEW'
77
current_context.must_equal 'WEBVIEW_1'
88
sleep 1 #Give a chance to load
99
page.start_with?("\nhtml\n").must_equal true
1010
end
11-
end
11+
12+
t 'after_last' do
13+
set_context 'NATIVE_APP'
14+
back_click
15+
end
16+
end

ios_tests/lib/ios/specs/driver.rb

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def is_sauce
3636
actual = driver_attributes
3737
actual[:caps][:app] = File.basename actual[:caps][:app]
3838
expected = { caps: { platformName: 'ios',
39+
platformVersion: '8.1',
3940
deviceName: 'iPhone Simulator',
4041
app: 'UICatalog.app' },
4142
custom_url: false,

ios_tests/lib/ios/specs/ios/element/button.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def gray
3030
t 'buttons' do
3131
exp = ['Back', 'Back', 'Gray', 'Right pointing arrow']
3232
buttons('a').map { |e| e.name }.must_equal exp
33-
buttons.length.must_equal exp.length
33+
buttons('a').length.must_equal exp.length
3434
end
3535

3636
t 'first_button' do
@@ -52,4 +52,4 @@ def gray
5252
t 'after_last' do
5353
after_last
5454
end
55-
end
55+
end

ios_tests/lib/ios/specs/ios/element/generic.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def before_first
55
end
66

77
def uibutton_text
8-
'Buttons, Various uses of UIButton'
8+
'Buttons'
99
end
1010

1111
def verify element
@@ -32,4 +32,4 @@ def verify element
3232
t 'finds_exact' do
3333
verify finds_exact uibutton_text
3434
end
35-
end
35+
end

ios_tests/lib/ios/specs/ios/element/text.rb

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ def ui_catalog
55
end
66

77
def uiview_transitions
8-
'Transitions, Shows UIViewAnimationTransitions'
8+
'Transitions'
99
end
1010

1111
def before_first
@@ -26,14 +26,14 @@ def before_first
2626
end
2727

2828
t 'text' do
29-
text('mat').text.must_equal uiview_transitions
29+
text('siti').text.must_equal uiview_transitions
3030
text(1).text.must_equal ui_catalog
31-
text('mat').name.must_equal uiview_transitions
31+
text('siti').name.must_equal uiview_transitions
3232
end
3333

3434
t 'texts' do
35-
exp = ['Controls, Various uses of UIControl', 'Segments, Various uses of UISegmentedControl']
36-
texts.length.must_equal 13
35+
exp = ['Controls', 'Various uses of UIControl', 'Various uses of UISegmentedControl']
36+
texts.length.must_equal 24
3737
texts('trol').map { |e| e.name }.must_equal exp
3838
texts('uses').length.must_equal 7
3939
end
@@ -55,4 +55,4 @@ def before_first
5555
t 'texts_exact' do
5656
texts_exact('UICatalog').length.must_equal 1
5757
end
58-
end
58+
end

lib/appium_lib/common/helper.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def reset
8181
# http://nokogiri.org/Nokogiri/XML/SAX/Document.html
8282
def start_element name, attrs = []
8383
# Count only visible elements. Android is always visible
84-
element_visible = $driver.device_is_android? ? true : attrs.to_h['visible'] == 'true'
84+
element_visible = $driver.device_is_android? ? true : Hash[attrs]['visible'] == 'true'
8585
@result[name] += 1 if element_visible
8686
end
8787

@@ -220,4 +220,4 @@ def _no_such_element
220220
raise Selenium::WebDriver::Error::NoSuchElementError, 'An element could not be located on the page using the given search parameters.'
221221
end
222222
end # module Common
223-
end # module Appium
223+
end # module Appium

0 commit comments

Comments
 (0)