本文整理匯總了Java中android.support.test.espresso.Espresso.pressBack方法的典型用法代碼示例。如果您正苦於以下問題:Java Espresso.pressBack方法的具體用法?Java Espresso.pressBack怎麽用?Java Espresso.pressBack使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.support.test.espresso.Espresso
的用法示例。
在下文中一共展示了Espresso.pressBack方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testLinearFlow
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void testLinearFlow() throws Exception {
goToPaymentListFragment(AMOUNT, EUR);
onView(withText(equalToIgnoringCase("Credit Card"))).perform(scrollTo(), click());
Espresso.pressBack(); // closes the keyboard
Espresso.pressBack();
onView(withText(equalToIgnoringCase("iDEAL"))).perform(scrollTo(), click());
Espresso.pressBack();
onView(withText(equalToIgnoringCase("Credit Card"))).perform(scrollTo(), click());
// TODO: move following to a method
onView(withId(R.id.adyen_credit_card_no)).perform(clearText(), typeText(CARD_NUMBER),
closeSoftKeyboard());
onView(withId(R.id.adyen_credit_card_exp_date)).perform(typeText(CARD_EXP_DATE),
closeSoftKeyboard());
onView(withId(R.id.adyen_credit_card_cvc)).perform(typeText(CARD_CVC_CODE),
closeSoftKeyboard());
onView(withId(R.id.collectCreditCardData)).perform(click());
checkResultString(Payment.PaymentStatus.AUTHORISED.toString());
}
示例2: testActionBarTitle
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void testActionBarTitle() throws Exception {
goToPaymentListFragment(AMOUNT, EUR);
waitForText("Payment Methods");
onView(withText(equalToIgnoringCase("Credit Card"))).perform(scrollTo(), click());
waitForText("Card Details");
Espresso.pressBack();
Espresso.pressBack();
waitForText("Payment Methods");
onView(withText(equalToIgnoringCase("SEPA Direct Debit"))).perform(scrollTo(), click());
waitForText("Holder Name");
waitForText("SEPA Direct Debit");
Espresso.pressBack();
waitForText("Payment Methods");
waitForText("Payment Methods");
onView(withText(equalToIgnoringCase("iDEAL"))).perform(scrollTo(), click());
waitForText("iDEAL");
Espresso.pressBack();
waitForText("Payment Methods");
}
示例3: challengePressBackAndQuit
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void challengePressBackAndQuit() {
onView(withId(R.id.search)).perform(click());
onView(isRoot()).perform(waitForMatch(withId(R.id.empty_layout), UI_TEST_TIMEOUT));
onView(isAssignableFrom(EditText.class)).perform(typeText("R"), pressKey(KeyEvent.KEYCODE_ENTER));
tryIsDisplayed(withText("Runnest IHL"), UI_TEST_TIMEOUT);
onView(withText("Runnest IHL")).perform(click());
//Create challenge
onView(isRoot()).perform(waitForMatch(withId(R.id.main_layout), UI_TEST_TIMEOUT));
onView(withText(R.string.challenge)).perform(click());
tryIsDisplayed(withId(R.id.define_challenge), UI_TEST_TIMEOUT);
onView(withId(R.id.customize_positive_btn)).perform(click());
//Wait
Espresso.pressBack();
tryIsDisplayed(withId(android.R.id.button1), UI_TEST_TIMEOUT);
onView(withText(R.string.quit)).perform(click());
}
示例4: testOrientationChangeOnPaymentMethodList
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void testOrientationChangeOnPaymentMethodList() throws Exception {
goToPaymentListFragment(AMOUNT, EUR);
EspressoTestUtils.rotateScreen();
onView(withText(equalToIgnoringCase("Credit Card"))).perform(scrollTo(), click());
waitForView(R.id.adyen_credit_card_no);
Espresso.pressBack(); // closes the keyboard
Espresso.pressBack();
EspressoTestUtils.rotateScreen();
onView(withText(equalToIgnoringCase("Credit Card"))).perform(scrollTo(), click());
waitForView(R.id.adyen_credit_card_no);
Espresso.pressBack();
cancelCreditCardPayment();
}
示例5: cancelCreditCardPayment
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
private void cancelCreditCardPayment() throws Exception {
Espresso.pressBack();
EspressoTestUtils.waitForView(R.id.activity_payment_method_selection);
Espresso.pressBack();
EspressoTestUtils.waitForView(R.id.verificationTextView);
try {
// Actually this should not be required. However without pressing back one last time; the
// activity cannot be started in the next test. To avoid it; we kill the PaymentResultActivity as well.
Espresso.pressBack();
} catch (final NoActivityResumedException expected) {
// expected
}
}
示例6: verifyResponsesForEndpoints
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test public void verifyResponsesForEndpoints() {
int endpointCount = 0;
Map<String, BarricadeResponseSet> hashMap = barricade.getConfig();
for (String endpoint : hashMap.keySet()) {
int responseCount = 0;
onView(withId(R.id.endpoint_rv)).perform(RecyclerViewActions.actionOnItemAtPosition(endpointCount, click()));
for (BarricadeResponse response : hashMap.get(endpoint).responses) {
onView(withRecyclerView(com.mutualmobile.barricade.R.id.endpoint_responses_rv).atPosition(responseCount)).check(
matches(hasDescendant(withText(response.responseFileName))));
responseCount++;
}
Espresso.pressBack();
}
}
示例7: shouldUpdateLocale_WhenResumed_IfLocaleHasBeenChanged
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void shouldUpdateLocale_WhenResumed_IfLocaleHasBeenChanged() throws Exception {
sampleScreen
.launch()
.changeLocale(LOCALE_ES_ES)
.openNewScreen()
.changeLocale(LOCALE_EN_EN);
Espresso.pressBack();
sampleScreen.verifyLocaleChanged(LOCALE_EN_EN);
}
示例8: backButtonWorks
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void backButtonWorks() {
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
onView(withId(R.id.nav_view)).perform(NavigationViewActions.navigateTo(R.id.nav_run));
onView(isRoot()).perform(waitForMatch(withId(R.id.start_run), UI_TEST_TIMEOUT));
Espresso.pressBack();
onView(isRoot()).perform(waitForMatch(withId(R.id.main_layout), UI_TEST_TIMEOUT));
}
示例9: testCustomTabUI
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void testCustomTabUI() throws Exception {
try {
startWebServer();
// Launch activity with custom tabs intent
activityTestRule.launchActivity(createCustomTabIntent());
// Wait for website to load
onWebView()
.withElement(findElement(Locator.ID, TEST_PAGE_HEADER_ID))
.check(webMatches(getText(), equalTo(TEST_PAGE_HEADER_TEXT)));
// Verify action button is visible
onView(withContentDescription(ACTION_BUTTON_DESCRIPTION))
.check(matches(isDisplayed()));
// Open menu
onView(withId(R.id.menuView))
.perform(click());
// Verify share action is visible
onView(withId(R.id.share))
.check(matches(isDisplayed()));
// Verify custom menu item is visible
onView(withText(MENU_ITEM_LABEL))
.check(matches(isDisplayed()));
// Close the menu again
Espresso.pressBack();
// Verify close button is visible - Click it to close custom tab.
onView(withId(R.id.customtab_close))
.check(matches(isDisplayed()))
.perform(click());
} finally {
stopWebServer();
}
}
示例10: backButtonDoesNothingIfStackEmpty
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void backButtonDoesNothingIfStackEmpty() {
onView(isRoot()).perform(waitForMatch(withId(R.id.main_layout), UI_TEST_TIMEOUT));
Espresso.pressBack();
onView(isRoot()).perform(waitForMatch(withId(R.id.main_layout), UI_TEST_TIMEOUT));
}
示例11: backButtonCloseDrawer
import android.support.test.espresso.Espresso; //導入方法依賴的package包/類
@Test
public void backButtonCloseDrawer() {
onView(withId(R.id.drawer_layout)).perform(DrawerActions.open());
Espresso.pressBack();
onView(isRoot()).perform(waitForMatch(withId(R.id.main_layout), UI_TEST_TIMEOUT));
}