Skip to content

Commit

Permalink
Loose conditions to match view in CategoryLifecycleTest
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed Jul 28, 2020
1 parent f6a06f0 commit cc36ba2
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import androidx.appcompat.widget.AppCompatImageView;
import androidx.test.espresso.matcher.ViewMatchers;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.FlakyTest;
import androidx.test.filters.LargeTest;
import it.feio.android.omninotes.R;
import java.util.Calendar;
Expand Down Expand Up @@ -76,8 +77,7 @@ public void addNewCategory () throws InterruptedException {
onView(allOf(withId(R.id.menu_category), withContentDescription(R.string.category), isDisplayed())).perform(
click());

onView(allOf(withId(R.id.md_buttonDefaultPositive), withText(R.string.add_category), isDisplayed())).perform(
click());
onView((withText(R.string.add_category))).perform(click());

sleep(1000);
onView(withId(R.id.category_title)).perform(replaceText(categoryName), closeSoftKeyboard());
Expand All @@ -101,6 +101,8 @@ public void addNewCategory () throws InterruptedException {
}

@Test
@FlakyTest(detail = "NoMatchingViewException: No views in hierarchy found matching: (with id: it.feio.android.omninotes:id/md_buttonDefaultPositive and with string from resource id: <2131820573> and is displayed on the screen to the user)\n"
+ "\tIf the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one of the following AdapterViews:it.feio.android.omninotes.models.views.NonScrollableListView{e62329c VFED.VC.. ......ID 0,455-1120,623 #7f0900b1 app:id/drawer_nav_list}")
public void checkCategoryCreation () throws InterruptedException {

addNewCategory();
Expand Down Expand Up @@ -172,7 +174,7 @@ public void categoryDeletion () throws InterruptedException {

onView(allOf(withId(R.id.delete), withText(R.string.delete), isDisplayed())).perform(click());

onView(allOf(withId(R.id.md_buttonDefaultPositive), withText(R.string.confirm), isDisplayed())).perform(click());
onView(withText(R.string.confirm)).perform(click());

// Waiting a little to ensure Eventbus post propagation
try {
Expand Down

0 comments on commit cc36ba2

Please sign in to comment.