Search in sources :

Example 31 with ViewInteraction

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

the class WifiExpertUITests method checkCancelledTestState.

private void checkCancelledTestState() {
    captureScreenshot("cancelled_state");
    ViewInteraction textView4 = onView(allOf(withId(R.id.user_text_tv), withText("Cancel"), childAtPosition(childAtPosition(withId(R.id.user_chat_layout), 1), 0), isDisplayed()));
    textView4.check(matches(withText("Cancel")));
    ViewInteraction textView3 = onView(allOf(withId(R.id.dobbyTextTv), withText("Ok sure. I am cancelling the tests. You can run it anytime by simply typing \"run tests\""), childAtPosition(allOf(withId(R.id.dobbyChatLayout), childAtPosition(withId(R.id.chatRv), 5)), 1), isDisplayed()));
    textView3.check(matches(withText("Ok sure. I am cancelling the tests. You can run it anytime by simply typing \"run tests\"")));
    checkSlowInternetCheckWifiAndRunSpeedTestButtons();
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction)

Example 32 with ViewInteraction

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

the class WifiExpertUITests method checkRunningDownloadSpeedTestState.

private void checkRunningDownloadSpeedTestState() {
    //Commenting this out to reduce the delay and see if the issues are gone
    captureScreenshot("running_download_test_state");
    DobbyLog.v("Checking for download guage text value");
    onView(allOf(withParent(withId(R.id.cg_download_test)), withId(R.id.gauge_tv), isDisplayed())).check(matches(withText(not(containsString(Utils.ZERO_POINT_ZERO)))));
    onView(allOf(withParent(withId(R.id.cg_upload_test)), withId(R.id.gauge_tv), isDisplayed())).check(matches(withText(containsString(Utils.ZERO_POINT_ZERO))));
    ViewInteraction linearLayout = onView(allOf(withId(R.id.bw_gauge_ll), childAtPosition(childAtPosition(withId(R.id.placeholder_fl), 0), 0), isDisplayed()));
    linearLayout.check(matches(isDisplayed()));
    //cancel button
    ViewInteraction button3 = onView(allOf(withText("Cancel"), childAtPosition(allOf(withId(R.id.action_menu), childAtPosition(withId(R.id.scrollview_buttons), 0)), 0), isDisplayed()));
    button3.check(matches(isDisplayed()));
    captureScreenshot("after_checking_running_download_test_state");
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction)

Example 33 with ViewInteraction

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

the class WifiExpertUITests method checkSlowInternetCheckWifiAndRunSpeedTestButtons.

private void checkSlowInternetCheckWifiAndRunSpeedTestButtons() {
    ViewInteraction button = onView(allOf(withText("Slow internet"), childAtPosition(allOf(ViewMatchers.withId(R.id.action_menu), childAtPosition(withId(R.id.scrollview_buttons), 0)), 0), isDisplayed()));
    button.check(matches(isDisplayed()));
    ViewInteraction button2 = onView(allOf(withText("Run speed test"), childAtPosition(allOf(withId(R.id.action_menu), childAtPosition(withId(R.id.scrollview_buttons), 0)), 1), isDisplayed()));
    button2.check(matches(isDisplayed()));
    ViewInteraction button3 = onView(allOf(withText("Check wifi"), childAtPosition(allOf(withId(R.id.action_menu), childAtPosition(withId(R.id.scrollview_buttons), 0)), 2), isDisplayed()));
    button3.check(matches(isDisplayed()));
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction)

Example 34 with ViewInteraction

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

the class WifiExpertUITests method checkOneFullRun.

private void checkOneFullRun(boolean initialAppLaunch) {
    checkIdleState(initialAppLaunch);
    //Press slow internet
    ViewInteraction button4 = onView(allOf(withText("Slow internet"), withParent(allOf(withId(R.id.action_menu), withParent(withId(R.id.scrollview_buttons))))));
    button4.perform(scrollTo(), click());
    Utils.safeSleep(2000);
    checkShowingWifiAnalysisState();
    //Press yes for running full tests
    ViewInteraction button7 = onView(allOf(withText("Yes"), withParent(allOf(withId(R.id.action_menu), withParent(withId(R.id.scrollview_buttons))))));
    button7.perform(scrollTo(), click());
    //Utils.safeSleep(2000);
    //checkRunningDownloadSpeedTestState();
    Utils.safeSleep(30000);
    checkShowingSpeedTestAnalysisState();
    //Click yes button
    ViewInteraction button11 = onView(allOf(withText("Yes"), withParent(allOf(withId(R.id.action_menu), withParent(withId(R.id.scrollview_buttons))))));
    button11.perform(scrollTo(), click());
    Utils.safeSleep(2000);
    checkShowingDetailedSuggestionState();
    ViewInteraction appCompatButton = onView(allOf(withId(R.id.more_suggestions_dismiss_button), withText("DISMISS"), isDisplayed()));
    appCompatButton.perform(click());
    checkSlowInternetCheckWifiAndRunSpeedTestButtons();
    checkDetailsButton(3);
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction)

Example 35 with ViewInteraction

use of android.support.test.espresso.ViewInteraction in project chefly_android by chef-ly.

the class RecipeDetailTest method recipeDetailTest.

@Test
public void recipeDetailTest() {
    ViewInteraction appCompatButton = onView(allOf(withId(R.id.skipBtn), withText("Skip"), isDisplayed()));
    appCompatButton.perform(click());
    // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    ViewInteraction appCompatTextView = onView(allOf(withId(R.id.continueAsGuest), withText("Skip"), withParent(allOf(withId(R.id.activity_main), withParent(withId(android.R.id.content)))), isDisplayed()));
    appCompatTextView.perform(click());
    // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
    try {
        Thread.sleep(10000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    ViewInteraction relativeLayout = onView(allOf(childAtPosition(withId(R.id.list), 0), isDisplayed()));
    relativeLayout.perform(click());
    // https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
    try {
        Thread.sleep(5000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    ViewInteraction appCompatImageButton = onView(withId(R.id.directionsDropdown));
    appCompatImageButton.perform(scrollTo(), click());
}
Also used : ViewInteraction(android.support.test.espresso.ViewInteraction) LargeTest(android.test.suitebuilder.annotation.LargeTest) Test(org.junit.Test)

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