use of androidx.test.espresso.ViewInteraction in project BetterBatteryStats by asksven.
the class ClickThroughTest method clickThroughTest.
@Test
public void clickThroughTest() {
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
ViewInteraction appCompatTextView = onView(allOf(withId(R.id.title), withText("Set Custom Ref."), isDisplayed()));
appCompatTextView.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
ViewInteraction appCompatTextView2 = onView(allOf(withId(R.id.title), withText("Graphs"), isDisplayed()));
appCompatTextView2.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction appCompatImageButton = onView(allOf(withContentDescription("Navigate up"), withParent(withId(R.id.toolbar)), isDisplayed()));
appCompatImageButton.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
ViewInteraction appCompatTextView3 = onView(allOf(withId(R.id.title), withText("Raw Stats"), isDisplayed()));
appCompatTextView3.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction appCompatImageButton2 = onView(allOf(withContentDescription("Navigate up"), withParent(withId(R.id.toolbar)), isDisplayed()));
appCompatImageButton2.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
ViewInteraction appCompatTextView4 = onView(allOf(withId(R.id.title), withText("Settings"), isDisplayed()));
appCompatTextView4.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction appCompatImageButton3 = onView(allOf(withContentDescription("Navigate up"), withParent(withId(R.id.toolbar)), isDisplayed()));
appCompatImageButton3.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
ViewInteraction appCompatTextView5 = onView(allOf(withId(R.id.title), withText("About"), isDisplayed()));
appCompatTextView5.perform(click());
// https://google.github.io/android-testing-support-library/docs/espresso/idling-resource/index.html
try {
Thread.sleep(2000);
} catch (InterruptedException e) {
e.printStackTrace();
}
ViewInteraction appCompatImageButton4 = onView(allOf(withContentDescription("Navigate up"), withParent(withId(R.id.toolbar)), isDisplayed()));
appCompatImageButton4.perform(click());
}
use of androidx.test.espresso.ViewInteraction in project BetterBatteryStats by asksven.
the class ShareActivityTestAll method shareActivityTestAll.
@Test
public void shareActivityTestAll() {
ViewInteraction actionMenuItemView = onView(allOf(withId(R.id.share), withContentDescription("Share"), isDisplayed()));
actionMenuItemView.perform(click());
ViewInteraction appCompatCheckedTextView = onView(allOf(withId(android.R.id.text1), withText("logcat"), childAtPosition(allOf(withClassName(is("com.android.internal.app.AlertController$RecycleListView")), withParent(withClassName(is("android.widget.LinearLayout")))), 1), isDisplayed()));
appCompatCheckedTextView.perform(click());
ViewInteraction appCompatCheckedTextView2 = onView(allOf(withId(android.R.id.text1), withText("dmesg"), childAtPosition(allOf(withClassName(is("com.android.internal.app.AlertController$RecycleListView")), withParent(withClassName(is("android.widget.LinearLayout")))), 2), isDisplayed()));
appCompatCheckedTextView2.perform(click());
ViewInteraction editText = onView(allOf(withClassName(is("android.widget.EditText")), isDisplayed()));
editText.perform(click());
ViewInteraction appCompatButton = onView(allOf(withId(android.R.id.button3), withText("Save"), isDisplayed()));
appCompatButton.perform(click());
}
Aggregations