Skip to content

Commit 3f41705

Browse files
Rename s_text to text. Remove e_* methods
1 parent 7909daa commit 3f41705

File tree

6 files changed

+33
-57
lines changed

6 files changed

+33
-57
lines changed

lib/appium_lib/android/element/button.rb

+7-11
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _button_contains_string value
2929
image_button = string_visible_contains ImageButton, value
3030
"#{button} | #{image_button}"
3131
end
32-
32+
3333
public
3434

3535
# Find the first button that contains value or by index.
@@ -49,11 +49,13 @@ def button value
4949
xpath _button_contains_string value
5050
end
5151

52-
# Find all buttons containing value
52+
# Find all buttons containing value.
53+
# If value is omitted, all buttons are returned.
5354
# @param value [String] the value to search for
5455
# @return [Array<Button>]
55-
def buttons value
56-
xpaths _button_contains_string value
56+
def buttons value=false
57+
return xpaths _button_visible_string unless value
58+
xpaths _button_contains_string value
5759
end
5860

5961
# Find the first button.
@@ -65,7 +67,7 @@ def first_button
6567
# Find the last button.
6668
# @return [Button]
6769
def last_button
68-
xpath _button_visible_string index: 'last()'
70+
xpath _button_visible_string index: 'last()'
6971
end
7072

7173
# Find the first button that exactly matches value.
@@ -81,11 +83,5 @@ def button_exact value
8183
def buttons_exact value
8284
xpaths _button_exact_string value
8385
end
84-
85-
# Find all buttons.
86-
# @return [Array<Button>]
87-
def e_buttons
88-
xpaths _button_visible_string
89-
end
9086
end # module Android
9187
end # module Appium

lib/appium_lib/android/element/text.rb

+8-12
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,44 @@ module Android
77
# @param value [String, Integer] the value to find.
88
# If int then the TextView at that index is returned.
99
# @return [TextView]
10-
def s_text value
10+
def text value
1111
return ele_index TextView, value if value.is_a? Numeric
1212
xpath_visible_contains TextView, value
1313
end
1414

1515
# Find all TextViews containing value.
16+
# If value is omitted, all texts are returned.
1617
# @param value [String] the value to search for
1718
# @return [Array<TextView>]
18-
def s_texts value
19+
def texts value=false
20+
return tags TextView unless value
1921
xpaths_visible_contains TextView, value
2022
end
2123

2224
# Find the first TextView.
2325
# @return [TextView]
24-
def first_s_text
26+
def first_text
2527
first_ele TextView
2628
end
2729

2830
# Find the last TextView.
2931
# @return [TextView]
30-
def last_s_text
32+
def last_text
3133
last_ele TextView
3234
end
3335

3436
# Find the first TextView that exactly matches value.
3537
# @param value [String] the value to match exactly
3638
# @return [TextView]
37-
def s_text_exact value
39+
def text_exact value
3840
xpath_visible_exact TextView, value
3941
end
4042

4143
# Find all TextViews that exactly match value.
4244
# @param value [String] the value to match exactly
4345
# @return [Array<TextView>]
44-
def s_texts_exact value
46+
def texts_exact value
4547
xpaths_visible_exact TextView, value
4648
end
47-
48-
# Find all TextViews.
49-
# @return [Array<TextView>]
50-
def e_s_texts
51-
tags TextView
52-
end
5349
end # module Android
5450
end # module Appium

lib/appium_lib/android/element/textfield.rb

+3-7
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@ def textfield value
1212
end
1313

1414
# Find all EditTexts containing value.
15+
# If value is omitted, all EditTexts are returned.
1516
# @param value [String] the value to search for
1617
# @return [Array<EditText>]
17-
def textfields value
18+
def textfields value=false
19+
tags EditText unless value
1820
xpaths_visible_contains EditText, value
1921
end
2022

@@ -43,11 +45,5 @@ def textfield_exact value
4345
def textfields_exact value
4446
xpaths_visible_exact EditText, value
4547
end
46-
47-
# Find all EditTexts.
48-
# @return [Array<EditText>]
49-
def e_textfields
50-
tags EditText
51-
end
5248
end # module Android
5349
end # module Appium

lib/appium_lib/ios/element/button.rb

+4-8
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ def button value
1313
xpath_visible_contains UIAButton, value
1414
end
1515

16-
# Find all UIAButtons containing value
16+
# Find all UIAButtons containing value.
17+
# If value is omitted, all UIAButtons are returned.
1718
# @param value [String] the value to search for
1819
# @return [Array<UIAButton>]
19-
def buttons value
20+
def buttons value=false
21+
return tags UIAButton unless value
2022
xpaths_visible_contains UIAButton, value
2123
end
2224

@@ -45,11 +47,5 @@ def button_exact value
4547
def buttons_exact value
4648
xpaths_visible_exact UIAButton, value
4749
end
48-
49-
# Find all UIAButtons.
50-
# @return [Array<UIAButton>]
51-
def e_buttons
52-
tags UIAButton
53-
end
5450
end # module Ios
5551
end # module Appium

lib/appium_lib/ios/element/text.rb

+8-12
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,44 @@ module Ios
77
# @param value [String, Integer] the value to find.
88
# If int then the UIAStaticText at that index is returned.
99
# @return [UIAStaticText]
10-
def s_text value
10+
def text value
1111
return ele_index UIAStaticText, value if value.is_a? Numeric
1212
xpath_visible_contains UIAStaticText, value
1313
end
1414

1515
# Find all UIAStaticText containing value.
16+
# If value is omitted, all UIAStaticTexts are returned
1617
# @param value [String] the value to search for
1718
# @return [Array<UIAStaticText>]
18-
def s_texts value
19+
def texts value=false
20+
return tags UIAStaticText unless value
1921
xpaths_visible_contains UIAStaticText, value
2022
end
2123

2224
# Find the first UIAStaticText.
2325
# @return [UIAStaticText]
24-
def first_s_text
26+
def first_text
2527
first_ele UIAStaticText
2628
end
2729

2830
# Find the last UIAStaticText.
2931
# @return [UIAStaticText]
30-
def last_s_text
32+
def last_text
3133
last_ele UIAStaticText
3234
end
3335

3436
# Find the first UIAStaticText that exactly matches value.
3537
# @param value [String] the value to match exactly
3638
# @return [UIAStaticText]
37-
def s_text_exact value
39+
def text_exact value
3840
xpath_visible_exact UIAStaticText, value
3941
end
4042

4143
# Find all UIAStaticTexts that exactly match value.
4244
# @param value [String] the value to match exactly
4345
# @return [Array<UIAStaticText>]
44-
def s_texts_exact value
46+
def texts_exact value
4547
xpaths_visible_exact UIAStaticText, value
4648
end
47-
48-
# Find all UIAStaticTexts.
49-
# @return [Array<UIAStaticText>]
50-
def e_s_texts
51-
tags UIAStaticText
52-
end
5349
end # module Ios
5450
end # module Appium

lib/appium_lib/ios/element/textfield.rb

+3-7
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ def textfield value
4949
end
5050

5151
# Find all TextFields containing value.
52+
# If value is omitted, all TextFields are returned.
5253
# @param value [String] the value to search for
5354
# @return [Array<TextField>]
54-
def textfields value
55+
def textfields value=false
56+
return xpaths _textfield_visible_string unless value
5557
xpaths _textfield_contains_string value
5658
end
5759

@@ -80,11 +82,5 @@ def textfield_exact value
8082
def textfields_exact value
8183
xpaths _textfield_exact_string value
8284
end
83-
84-
# Find all TextFields.
85-
# @return [Array<TextField>]
86-
def e_textfields
87-
xpaths _textfield_visible_string
88-
end
8985
end # module Ios
9086
end # module Appium

0 commit comments

Comments
 (0)