Skip to content

Commit 5540ffc

Browse files
Update ios_tests
1 parent ecc7d02 commit 5540ffc

File tree

9 files changed

+101
-53
lines changed

9 files changed

+101
-53
lines changed

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

+41-9
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,15 @@ def before_first
3434
proc { wait(*wait_time) { raise NoMemoryError } }.must_raise Timeout::Error
3535
end
3636

37+
t 'ignore' do
38+
# ignore should rescue all exceptions
39+
ignore { true }
40+
ignore { false }
41+
ignore { nil }
42+
ignore { raise }
43+
ignore { raise NoMemoryError }
44+
end
45+
3746
# wait_true is a success unless the value is not true
3847
t 'wait_true' do
3948
# successful wait should not error
@@ -51,15 +60,6 @@ def before_first
5160
proc { wait(*wait_time) { raise NoMemoryError } }.must_raise Timeout::Error
5261
end
5362

54-
t 'ignore' do
55-
# ignore should rescue all exceptions
56-
ignore { true }
57-
ignore { false }
58-
ignore { nil }
59-
ignore { raise }
60-
ignore { raise NoMemoryError }
61-
end
62-
6363
# t 'id' # id is for Selendroid
6464

6565
t 'back' do
@@ -95,6 +95,8 @@ def uibutton_text
9595
ele_index('UIAStaticText', 2).name.must_equal uibutton_text
9696
end
9797

98+
# todo: 'string_attr_exact'
99+
98100
t 'find_ele_by_attr' do
99101
el_id = find_ele_by_attr('UIAStaticText', 'name', uibutton_text).instance_variable_get :@id
100102
el_id.must_match /\d+/
@@ -113,6 +115,8 @@ def uibutton_text
113115
set_wait
114116
end
115117

118+
# todo: 'string_attr_include'
119+
116120
t 'find_ele_by_attr_include' do
117121
el_text = find_ele_by_attr_include('UIAStaticText', :name, 'button').text
118122
el_text.must_equal ''
@@ -170,4 +174,32 @@ def uibutton_text
170174
t 'tags' do
171175
tags('UIATableCell').length.must_equal 12
172176
end
177+
178+
t 'find_eles_by_attr_include' do
179+
find_eles_by_attr_include('UIATableCell', 'name', 'Use').length.must_equal 7
180+
end
181+
182+
t 'get_page_class' do
183+
# 8 local. 9 on sauce.
184+
get_page_class.split("\n").length.must_be :>=, 8
185+
end
186+
=begin
187+
todo:
188+
get_page_class
189+
page_class
190+
tag
191+
tags
192+
px_to_window_rel
193+
lazy_load_strings
194+
xml_keys
195+
xml_values
196+
resolve_id
197+
string_visible_contains
198+
xpath_visible_contains
199+
xpaths_visible_contains
200+
string_visible_exact
201+
xpath_visible_exact
202+
xpaths_visible_exact
203+
raise_no_element_error
204+
=end
173205
end

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

+1-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ def before_first
1818
# Attributes are busted in Android.
1919
# Blocked on https://github.com/appium/appium/issues/628
2020
describe 'Selenium::WebDriver::Element methods' do
21-
# Android supports exactly two string Attributes
22-
# .name and .text
23-
# https://github.com/appium/appium/blob/ea3450e7f78d1794bab42fa396a387e7b86fd3b3/android/bootstrap/src/io/appium/android/bootstrap/handler/GetAttribute.java#L43
24-
# t 'value' do; end # Doesn't work on Android
21+
# todo: t 'value' do; end
2522

2623
t 'name' do
2724
first_s_text.name.must_equal 'UICatalog'

ios_tests/lib/ios/specs/common/device.rb renamed to ios_tests/lib/ios/specs/device/device.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe 'common/device' do
1+
describe 'device/device' do
22
def before_first
33
screen.must_equal catalog
44
end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
describe 'device/multi_touch' do
2+
t { } # place holder test
3+
end
4+
5+
# todo: write tests
6+
=begin
7+
pinch
8+
zoom
9+
initialize
10+
add
11+
perform
12+
=end
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
describe 'device/touch_actions' do
2+
t { } # place holder test
3+
end
4+
# todo: write tests
5+
=begin
6+
move_to
7+
press_for_duration
8+
press
9+
release
10+
tap
11+
wait
12+
swipe
13+
perform
14+
cancel
15+
=end

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

+10-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# encoding: utf-8
22
# rake ios['ios/element/text']
33
describe 'ios/element/text' do
4+
def ui_catalog
5+
'UICatalog'
6+
end
7+
48
def before_first
59
screen.must_equal catalog
610
end
@@ -9,19 +13,10 @@ def before_first
913
before_first
1014
end
1115

12-
t 's_texts' do
13-
exp = ['Controls, Various uses of UIControl', 'Segments, Various uses of UISegmentedControl']
14-
s_texts('trol').map { |e| e.name }.must_equal exp
15-
end
16-
1716
t 'e_s_texts' do
1817
e_s_texts.length.must_equal 13
1918
end
2019

21-
def ui_catalog
22-
'UICatalog'
23-
end
24-
2520
t 'first_s_text' do
2621
first_s_text.text.must_equal ui_catalog
2722
end
@@ -36,6 +31,12 @@ def ui_catalog
3631
s_text('mat').name.must_equal 'Transitions, Shows UIViewAnimationTransitions'
3732
end
3833

34+
t 's_texts' do
35+
exp = ['Controls, Various uses of UIControl', 'Segments, Various uses of UISegmentedControl']
36+
s_texts('trol').map { |e| e.name }.must_equal exp
37+
s_texts('uses').length.must_equal 7
38+
end
39+
3940
t 's_text_exact' do
4041
# should fail
4142
set_wait 0
@@ -47,10 +48,6 @@ def ui_catalog
4748
s_text_exact(ui_catalog).text.must_equal ui_catalog
4849
end
4950

50-
t 's_texts' do
51-
s_texts('uses').length.must_equal 7
52-
end
53-
5451
t 's_texts_exact' do
5552
s_texts_exact('UICatalog').length.must_equal 1
5653
end

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

+14-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
# encoding: utf-8
22
# rake ios[ios/element/textfield]
33
describe 'ios/element/textfield' do
4+
def enter_text
5+
'<enter text>'
6+
end
7+
8+
def enter_password
9+
'<enter password>'
10+
end
11+
412
def before_first
513
go_to_textfields
614
end
@@ -13,28 +21,14 @@ def after_last
1321
before_first
1422
end
1523

16-
t 'textfields' do
17-
values = textfields('enter').map { |e| e.value }
18-
values.include?('<enter text>').must_equal true
19-
values.include?('<enter password>').must_equal true
20-
end
21-
2224
t 'e_textfields' do
2325
e_textfields.length.must_equal 4
2426
end
2527

26-
def enter_text
27-
'<enter text>'
28-
end
29-
3028
t 'first_textfield' do
3129
first_textfield.text.must_equal enter_text
3230
end
3331

34-
def enter_password
35-
'<enter password>'
36-
end
37-
3832
t 'last_textfield' do
3933
last_textfield.text.must_equal enter_password
4034
end
@@ -44,6 +38,12 @@ def enter_password
4438
textfield(enter_text).text.must_equal(enter_text)
4539
end
4640

41+
t 'textfields' do
42+
values = textfields('enter').map { |e| e.value }
43+
values.include?('<enter text>').must_equal true
44+
values.include?('<enter password>').must_equal true
45+
end
46+
4747
t 'textfield_include' do
4848
textfield_include('word').text.must_equal enter_password
4949
end

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

+5-12
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,20 @@ def before_first
99
before_first
1010
end
1111

12-
t 'find_eles_by_attr_include' do
13-
find_eles_by_attr_include('UIATableCell', 'name', 'Use').length.must_equal 7
14-
end
15-
1612
t 'ios_password' do
1713
ios_password.must_equal '•'
1814
ios_password(2).must_equal '•' * 2
1915
end
2016

21-
# t 'get_page' do # prints to stdout
22-
23-
t 'get_page_class' do
24-
# 8 local. 9 on sauce.
25-
get_page_class.split("\n").length.must_be :>=, 8
26-
end
17+
# todo: t 'get_page' do
2718

28-
# t 'page' do # prints to stdout
19+
# t 'page' do # writes to std out
2920

3021
t 'source_window' do
3122
source_window.length.must_equal 11
3223
end
3324

34-
# t 'page_window' do # prints to stdout
25+
# todo: t 'page_window' do
26+
# todo: t 'id' do
27+
# todo: t 'ios_version' do
3528
end

ios_tests/lib/ios/specs/ios/patch.rb

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ def after_last
1414
before_first
1515
end
1616

17+
# todo: test 'label'
18+
1719
t 'type' do
1820
# nav to textfield
1921
s_text('textfields').click

0 commit comments

Comments
 (0)