1
1
# rake android[android/helper]
2
2
describe 'android/helper' do
3
- t 'tag_name_to_android' do
4
- act = tag_name_to_android 'abslist'
5
- exp = [ 'android.widget.AbsListView' ]
6
- act . must_equal exp
7
-
8
- act = tag_name_to_android 'button'
9
- exp = %w( android.widget.Button android.widget.ImageButton )
10
- act . must_equal exp
11
-
12
- msg = ''
13
- begin ; tag_name_to_android 'zz' ; rescue Exception => e ; msg = e . message ; end
14
- msg . must_equal 'Invalid tag name zz'
15
- end
16
-
17
- t 'find_eles_attr' do
3
+ t 'tags' do
18
4
exp = [ "API Demos" , "Accessibility" , "Animation" , "App" , "Content" , "Graphics" , "Media" , "NFC" , "OS" , "Preference" , "Text" , "Views" ]
19
5
20
6
# must wait for page to load
21
- ignore { wait_true ( 10 ) { find_eles_attr ( :text ) == exp } }
22
- act = find_eles_attr : text
7
+ ignore { wait_true ( 10 ) { tags ( 'android.widget.TextView' ) . map { | e | e . text } == exp } }
8
+ act = tags ( 'android.widget.TextView' ) . map { | e | e . text }
23
9
24
10
act . must_equal exp
25
11
end
26
12
27
13
def page_class_data
28
- ( <<-TXT ) . gsub ' ' , ''
29
- 12x android.widget.TextView
30
- 4x android.widget.FrameLayout
31
- 4x android.widget.LinearLayout
32
- 2x android.view.View
33
- 1x android.widget.ListView
34
- 1x android.widget.ImageView
14
+ ( <<-TXT ) . strip
15
+ 12x android.widget.TextView
16
+ 4x android.widget.FrameLayout
17
+ 2x android.widget.LinearLayout
18
+ 2x android.view.View
19
+ 1x android.widget.ListView
20
+ 1x android.widget.ImageView
21
+ 1x hierarchy
35
22
TXT
36
23
end
37
24
38
25
# t 'get_selendroid_inspect' # only works on selendroid
39
26
t 'get_page_class' do
40
27
# digit values change based on screen size
41
- exp = page_class_data . gsub ( /\d +/ , '' )
42
- act = get_page_class . gsub ( ' ' , '' ) . gsub ( /\d +/ , '' )
28
+ # larger screens have more elements
29
+ exp = page_class_data . gsub ( /\d +/ , '' )
30
+ act = get_page_class . gsub ( /\d +/ , '' )
43
31
act . must_equal exp
44
32
end
45
33
@@ -53,10 +41,6 @@ def page_class_data
53
41
# t 'get_inspect' do # tested by get_android_inspect
54
42
# t 'page' do # tested by get_android_inspect
55
43
56
- t 'fast_duration' do
57
- fast_duration . must_equal 0.0357
58
- end
59
-
60
44
def id_key
61
45
'animation_2_instructions'
62
46
end
@@ -84,8 +68,8 @@ def id_value
84
68
end
85
69
86
70
t 'find by id' do
87
- name ( 'accessibility' ) . click
88
- name ( 'accessibility node provider' ) . click
71
+ find ( 'accessibility' ) . click
72
+ find ( 'accessibility node provider' ) . click
89
73
id 'accessibility_node_provider' # Accessibility/Accessibility Node Provider
90
74
2 . times { back }
91
75
end
0 commit comments