Test vakamımı çalıştırdığımda istisna izledim.Espresso: Hiyerarşide hiçbir görünüm bulunamadı id ile eşleşme bulundu: android: id/home
android.support.test.espresso.NoMatchingViewException: hiyerarşi görüntüleme yok bulundu eşleştirme: kimliğine sahip: android: id/home
Bu benim TestCase kodudur.
public void nav_to_alarm_test(){
onView(withId(R.id.navigation_notifications)).perform(click());
onView(withId(R.id.rl_reminder)).perform(click());
onView(withId(R.id.item_test)).perform(click());
onView(withId(android.R.id.home)).perform(click());//throw exception here
onView(withId(android.R.id.home)).perform(click());
}
Bu, android.R.id.home neden kaynak id android.R.id.home için hiyerarşisinde görüşlerini bulamıyorum
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
finish();
return true;
case R.id.item_test:
startActivityForResult(CreateOrUpdateReminderActivity.class,CMD_ADD_REMINDER);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
İşlem Çubuğu
tarafından sağlanan düğme aittir? Google'ın benim sorunum var, ancak cevaplar istediğim şey değil.Yardımlarınız için teşekkürler.
yapmaz ise [bu] (https://stackoverflow.com/a/35462828/1083957) yardımcı? – azizbekian
@azizbekian Cevabında bir çözüm buldum, teşekkür ederim! – Cyrus