Search in sources :

Example 11 with ViewInteraction

use of android.support.test.espresso.ViewInteraction in project dobby-android by InceptAi.

the class WifiExpertUITests method checkShowingSpeedTestAnalysisState.

private void checkShowingSpeedTestAnalysisState() {
    captureScreenshot("speed_test_analysis_state");
    ViewInteraction frameLayout2 = onView(withId(R.id.bandwidth_results_cardview));
    frameLayout2.check(matches(isDisplayed()));
    ViewInteraction textView3 = onView(allOf(withId(R.id.dobbyTextTv), withText(containsString("detail"))));
    textView3.check(matches(isDisplayed()));
    ViewInteraction button9 = onView(allOf(withText("Yes"), childAtPosition(allOf(withId(R.id.action_menu), childAtPosition(withId(R.id.scrollview_buttons), 0)), 0), isDisplayed()));
    button9.check(matches(isDisplayed()));
    ViewInteraction button10 = onView(allOf(withText("No"), childAtPosition(allOf(withId(R.id.action_menu), childAtPosition(withId(R.id.scrollview_buttons), 0)), 1), isDisplayed()));
    button10.check(matches(isDisplayed()));
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction)

Example 12 with ViewInteraction

use of android.support.test.espresso.ViewInteraction in project dobby-android by InceptAi.

the class WifiExpertUITests method checkDecliningFullSpeedTestState.

private void checkDecliningFullSpeedTestState() {
    captureScreenshot("declining_speed_test_state");
    ViewInteraction textView2 = onView(allOf(withId(R.id.user_text_tv), withText("No"), childAtPosition(childAtPosition(withId(R.id.user_chat_layout), 1), 0), isDisplayed()));
    textView2.check(matches(withText("No")));
    checkSlowInternetCheckWifiAndRunSpeedTestButtons();
    ViewInteraction textView = onView(allOf(withId(R.id.dobbyTextTv), withText("Ok no worries. Let me know if you want to run tests at any time.")));
    textView.check(matches(isDisplayed()));
    checkSlowInternetCheckWifiAndRunSpeedTestButtons();
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction)

Example 13 with ViewInteraction

use of android.support.test.espresso.ViewInteraction in project dobby-android by InceptAi.

the class WifiExpertUITests method checkDetailsButton.

private void checkDetailsButton(int positionInScrollView) {
    ViewInteraction button = onView(allOf(withText("Details"), childAtPosition(allOf(ViewMatchers.withId(R.id.action_menu), childAtPosition(withId(R.id.scrollview_buttons), 0)), positionInScrollView), isDisplayed()));
    button.check(matches(isDisplayed()));
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction)

Example 14 with ViewInteraction

use of android.support.test.espresso.ViewInteraction in project appium-espresso-driver by appium.

the class Finder method findBy.

///Find By different strategies
private ViewInteraction findBy(Strategy strategy, String selector) throws InvalidStrategyException {
    ViewInteraction matcher;
    switch(strategy) {
        case // with ID
        ID:
            // find id from target context
            Context context = InstrumentationRegistry.getTargetContext();
            int id = context.getResources().getIdentifier(selector, "Id", InstrumentationRegistry.getTargetContext().getPackageName());
            matcher = onView(withId(id));
            break;
        case CLASS_NAME:
            // with class name
            // TODO: improve this finder with instanceOf
            matcher = onView(withClassName(endsWith(selector)));
            break;
        case TEXT:
            // with text
            matcher = onView(withText(selector));
            break;
        case ACCESSIBILITY_ID:
            // with content description
            matcher = onView(withContentDescription(selector));
            break;
        default:
            throw new InvalidStrategyException("Strategy is not implemented: " + strategy.getStrategyName());
    }
    return matcher;
}
Also used : Context(android.content.Context) ViewInteraction(android.support.test.espresso.ViewInteraction) InvalidStrategyException(io.appium.espressoserver.lib.handlers.exceptions.InvalidStrategyException)

Example 15 with ViewInteraction

use of android.support.test.espresso.ViewInteraction in project appium-espresso-driver by appium.

the class ScrollTo method handle.

@Override
@Nullable
public Void handle(ScrollToParams params) throws AppiumException {
    try {
        ViewInteraction viewInteraction = onView(withText(params.getText()));
        viewInteraction.perform(scrollTo());
    } catch (NoMatchingViewException e) {
        throw new NoSuchElementException("Could not find element with text " + params.getText());
    }
    return null;
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction) NoMatchingViewException(android.support.test.espresso.NoMatchingViewException) NoSuchElementException(io.appium.espressoserver.lib.handlers.exceptions.NoSuchElementException) Nullable(javax.annotation.Nullable)

Aggregations

ViewInteraction (android.support.test.espresso.ViewInteraction)38 Test (org.junit.Test)19 LargeTest (android.test.suitebuilder.annotation.LargeTest)13 Espresso.onView (android.support.test.espresso.Espresso.onView)5 View (android.view.View)5 NoMatchingViewException (android.support.test.espresso.NoMatchingViewException)4 RecyclerView (android.support.v7.widget.RecyclerView)4 ViewAction (android.support.test.espresso.ViewAction)2 ChipsEntity (com.beloo.chipslayoutmanager.sample.entity.ChipsEntity)2 InvalidStrategyException (io.appium.espressoserver.lib.handlers.exceptions.InvalidStrategyException)2 NoSuchElementException (io.appium.espressoserver.lib.handlers.exceptions.NoSuchElementException)2 Nullable (javax.annotation.Nullable)2 Context (android.content.Context)1 PerformException (android.support.test.espresso.PerformException)1 ViewAssertion (android.support.test.espresso.ViewAssertion)1 ViewAssertions.matches (android.support.test.espresso.assertion.ViewAssertions.matches)1 ViewMatchers.isDisplayed (android.support.test.espresso.matcher.ViewMatchers.isDisplayed)1 ViewMatchers.withId (android.support.test.espresso.matcher.ViewMatchers.withId)1 ActivityTestRule (android.support.test.rule.ActivityTestRule)1 AndroidJUnit4 (android.support.test.runner.AndroidJUnit4)1