Skip to content

Commit c2cf5d7

Browse files
authored
test: add allOf example (#274)
* test: add allOf example * fix rubocop
1 parent f7c21b8 commit c2cf5d7

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/functional/android/android/search_context_test.rb

+26
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,34 @@ def test_viewmatcher
6363
class: 'androidx.test.espresso.matcher.ViewMatchers'
6464
}.to_json
6565
e.click
66+
6667
@driver.find_element :accessibility_id, 'Custom View'
6768
@driver.back
69+
70+
# Multiple matchers with 'org.hamcrest.Matchers.allOf'
71+
# https://developer.android.com/training/testing/espresso/recipes
72+
# https://developer.android.com/reference/androidx/test/espresso/matcher/ViewMatchers#withsubstring
73+
e = @driver.find_element :view_matcher, {
74+
name: 'allOf',
75+
args: [
76+
{
77+
name: 'withSubstring',
78+
args: 'Acc',
79+
class: 'androidx.test.espresso.matcher.ViewMatchers'
80+
},
81+
{
82+
name: 'isDisplayed',
83+
class: 'androidx.test.espresso.matcher.ViewMatchers'
84+
},
85+
{
86+
name: 'withSubstring',
87+
args: "'",
88+
class: 'androidx.test.espresso.matcher.ViewMatchers'
89+
}
90+
],
91+
class: 'org.hamcrest.Matchers'
92+
}.to_json
93+
assert_equal "Access'ibility", e.text
6894
end
6995
end
7096
end

0 commit comments

Comments
 (0)