codingjeremy
codingjeremy

Reputation: 5741

Simple .check(matches(isDisplayed())) fails with "Cannot resolve method 'matches(Matcher<View>)'."

When running some test with this line: onView(withId(R.id.topTextView)).check(matches(isDisplayed()));

I get this error:

Cannot resolve method 'matches(Matcher<View>)'

I can't find any matches online why this doesn't work.

Upvotes: 1

Views: 406

Answers (1)

codingjeremy
codingjeremy

Reputation: 5741

After searching on this forever and not finding answers... I about gave up and started reworking my file.

I happened to noticed I had this import:

import static org.mockito.ArgumentMatchers.matches;

Instead of...

import static androidx.test.espresso.assertion.ViewAssertions.matches;

For the love of... I can't believe I wasted so much time on that... I'm only putting this up here in hopes of someone else avoiding wasting so much time on such a silly problem. :o

End advice, if there are no answers for your quoted error, check your imports.

Upvotes: 1

Related Questions