Search in sources :

Example 1 with GenericRemoteMessage

use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.

the class DisplayDataMatcherRemoteMsgTest method toProto.

private static DisplayDataMatcherProto toProto() {
    Matcher<View> adapterMatcher = isAssignableFrom(AdapterView.class);
    Matcher<String> stringMatcher = allOf(instanceOf(String.class), equalTo(TEXT_VIEW_TEXT));
    AdapterViewProtocol adapterViewProtocol = AdapterViewProtocols.standardProtocol();
    AdapterDataLoaderAction adapterDataLoaderAction = new AdapterDataLoaderAction(stringMatcher, EspressoOptional.<Integer>absent(), adapterViewProtocol);
    Function<AdapterDataLoaderAction, ViewInteraction> noOpDataLoaderFunction = new Function<AdapterDataLoaderAction, ViewInteraction>() {

        @Override
        public ViewInteraction apply(AdapterDataLoaderAction adapterDataLoaderAction) {
            return null;
        }
    };
    DisplayDataMatcher displayDataMatcher = new DisplayDataMatcher(adapterMatcher, stringMatcher, adapterViewProtocol, adapterDataLoaderAction, noOpDataLoaderFunction);
    return (DisplayDataMatcherProto) new GenericRemoteMessage(displayDataMatcher).toProto();
}
Also used : GenericRemoteMessage(androidx.test.espresso.remote.GenericRemoteMessage) Function(com.google.common.base.Function) AdapterViewProtocol(androidx.test.espresso.action.AdapterViewProtocol) DisplayDataMatcher(androidx.test.espresso.DataInteraction.DisplayDataMatcher) View(android.view.View) AdapterView(android.widget.AdapterView) DisplayDataMatcherProto(androidx.test.espresso.proto.matcher.ViewMatchers.DisplayDataMatcherProto) AdapterDataLoaderAction(androidx.test.espresso.action.AdapterDataLoaderAction)

Example 2 with GenericRemoteMessage

use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.

the class RemoteViewAssertionsTest method noOverlaps_transformationFromProto.

@Test
public void noOverlaps_transformationFromProto() {
    ViewAssertion viewAssertion = noOverlaps();
    NoOverlapsViewAssertionProto viewAssertionProto = (NoOverlapsViewAssertionProto) new GenericRemoteMessage(viewAssertion).toProto();
    ViewAssertion viewAssertionFromProto = (ViewAssertion) GenericRemoteMessage.FROM.fromProto(viewAssertionProto);
    assertThat(viewAssertionFromProto, instanceOf(NoOverlapsViewAssertion.class));
}
Also used : GenericRemoteMessage(androidx.test.espresso.remote.GenericRemoteMessage) NoOverlapsViewAssertionProto(androidx.test.espresso.proto.assertion.ViewAssertions.NoOverlapsViewAssertionProto) DoesNotExistViewAssertion(androidx.test.espresso.assertion.ViewAssertions.DoesNotExistViewAssertion) NoOverlapsViewAssertion(androidx.test.espresso.assertion.LayoutAssertions.NoOverlapsViewAssertion) MatchesViewAssertion(androidx.test.espresso.assertion.ViewAssertions.MatchesViewAssertion) ViewAssertion(androidx.test.espresso.ViewAssertion) SelectedDescendantsMatchViewAssertion(androidx.test.espresso.assertion.ViewAssertions.SelectedDescendantsMatchViewAssertion) NoOverlapsViewAssertion(androidx.test.espresso.assertion.LayoutAssertions.NoOverlapsViewAssertion) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 3 with GenericRemoteMessage

use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.

the class RemoteViewAssertionsTest method selectedDescendantsMatch_transformationToProto.

@Test
public void selectedDescendantsMatch_transformationToProto() {
    ViewAssertion viewAssertion = selectedDescendantsMatch(withText("no content description"), hasContentDescription());
    SelectedDescendantsMatchViewAssertionProto viewAssertionProto = (SelectedDescendantsMatchViewAssertionProto) new GenericRemoteMessage(viewAssertion).toProto();
    assertThat(viewAssertionProto, notNullValue());
}
Also used : GenericRemoteMessage(androidx.test.espresso.remote.GenericRemoteMessage) DoesNotExistViewAssertion(androidx.test.espresso.assertion.ViewAssertions.DoesNotExistViewAssertion) NoOverlapsViewAssertion(androidx.test.espresso.assertion.LayoutAssertions.NoOverlapsViewAssertion) MatchesViewAssertion(androidx.test.espresso.assertion.ViewAssertions.MatchesViewAssertion) ViewAssertion(androidx.test.espresso.ViewAssertion) SelectedDescendantsMatchViewAssertion(androidx.test.espresso.assertion.ViewAssertions.SelectedDescendantsMatchViewAssertion) SelectedDescendantsMatchViewAssertionProto(androidx.test.espresso.proto.assertion.ViewAssertions.SelectedDescendantsMatchViewAssertionProto) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 4 with GenericRemoteMessage

use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.

the class RemoteViewAssertionsTest method matches_transformationFromProto.

@Test
public void matches_transformationFromProto() {
    View view = new View(getInstrumentation().getContext());
    ViewAssertion viewAssertion = matches(withId(view.getId()));
    MatchesViewAssertionProto viewAssertionProto = (MatchesViewAssertionProto) new GenericRemoteMessage(viewAssertion).toProto();
    ((MatchesViewAssertion) GenericRemoteMessage.FROM.fromProto(viewAssertionProto)).viewMatcher.matches(view);
}
Also used : GenericRemoteMessage(androidx.test.espresso.remote.GenericRemoteMessage) DoesNotExistViewAssertion(androidx.test.espresso.assertion.ViewAssertions.DoesNotExistViewAssertion) NoOverlapsViewAssertion(androidx.test.espresso.assertion.LayoutAssertions.NoOverlapsViewAssertion) MatchesViewAssertion(androidx.test.espresso.assertion.ViewAssertions.MatchesViewAssertion) ViewAssertion(androidx.test.espresso.ViewAssertion) SelectedDescendantsMatchViewAssertion(androidx.test.espresso.assertion.ViewAssertions.SelectedDescendantsMatchViewAssertion) MatchesViewAssertionProto(androidx.test.espresso.proto.assertion.ViewAssertions.MatchesViewAssertionProto) View(android.view.View) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Example 5 with GenericRemoteMessage

use of androidx.test.espresso.remote.GenericRemoteMessage in project android-test by android.

the class RemoteViewActionsTest method editorAction_transformationFromProto.

@Test
public void editorAction_transformationFromProto() {
    ViewAction editorAction = pressImeActionButton();
    EditorActionProto editorActionActionProto = (EditorActionProto) new GenericRemoteMessage(editorAction).toProto();
    EditorAction editorActionFromProto = (EditorAction) GenericRemoteMessage.FROM.fromProto(editorActionActionProto);
    assertThat(editorActionFromProto, notNullValue());
}
Also used : GenericRemoteMessage(androidx.test.espresso.remote.GenericRemoteMessage) ViewAction(androidx.test.espresso.ViewAction) EditorActionProto(androidx.test.espresso.proto.action.ViewActions.EditorActionProto) SmallTest(androidx.test.filters.SmallTest) Test(org.junit.Test)

Aggregations

GenericRemoteMessage (androidx.test.espresso.remote.GenericRemoteMessage)162 SmallTest (androidx.test.filters.SmallTest)160 Test (org.junit.Test)160 View (android.view.View)80 TextView (android.widget.TextView)77 IsDisplayingAtLeastMatcher (androidx.test.espresso.matcher.ViewMatchers.IsDisplayingAtLeastMatcher)39 WithClassNameMatcher (androidx.test.espresso.matcher.ViewMatchers.WithClassNameMatcher)39 Matcher (org.hamcrest.Matcher)39 HasChildCountMatcher (androidx.test.espresso.matcher.ViewMatchers.HasChildCountMatcher)38 HasContentDescriptionMatcher (androidx.test.espresso.matcher.ViewMatchers.HasContentDescriptionMatcher)38 HasDescendantMatcher (androidx.test.espresso.matcher.ViewMatchers.HasDescendantMatcher)38 HasErrorTextMatcher (androidx.test.espresso.matcher.ViewMatchers.HasErrorTextMatcher)38 HasFocusMatcher (androidx.test.espresso.matcher.ViewMatchers.HasFocusMatcher)38 HasImeActionMatcher (androidx.test.espresso.matcher.ViewMatchers.HasImeActionMatcher)38 HasLinksMatcher (androidx.test.espresso.matcher.ViewMatchers.HasLinksMatcher)38 HasMinimumChildCountMatcher (androidx.test.espresso.matcher.ViewMatchers.HasMinimumChildCountMatcher)38 HasSiblingMatcher (androidx.test.espresso.matcher.ViewMatchers.HasSiblingMatcher)38 IsClickableMatcher (androidx.test.espresso.matcher.ViewMatchers.IsClickableMatcher)38 IsDescendantOfAMatcher (androidx.test.espresso.matcher.ViewMatchers.IsDescendantOfAMatcher)38 IsDisplayedMatcher (androidx.test.espresso.matcher.ViewMatchers.IsDisplayedMatcher)38