Skip to content

Commit cc36ba2

Browse files
committed
Loose conditions to match view in CategoryLifecycleTest
1 parent f6a06f0 commit cc36ba2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

omniNotes/src/androidTest/java/it/feio/android/omninotes/ui/CategoryLifecycleTest.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
import androidx.appcompat.widget.AppCompatImageView;
4545
import androidx.test.espresso.matcher.ViewMatchers;
4646
import androidx.test.ext.junit.runners.AndroidJUnit4;
47+
import androidx.test.filters.FlakyTest;
4748
import androidx.test.filters.LargeTest;
4849
import it.feio.android.omninotes.R;
4950
import java.util.Calendar;
@@ -76,8 +77,7 @@ public void addNewCategory () throws InterruptedException {
7677
onView(allOf(withId(R.id.menu_category), withContentDescription(R.string.category), isDisplayed())).perform(
7778
click());
7879

79-
onView(allOf(withId(R.id.md_buttonDefaultPositive), withText(R.string.add_category), isDisplayed())).perform(
80-
click());
80+
onView((withText(R.string.add_category))).perform(click());
8181

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

103103
@Test
104+
@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"
105+
+ "\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}")
104106
public void checkCategoryCreation () throws InterruptedException {
105107

106108
addNewCategory();
@@ -172,7 +174,7 @@ public void categoryDeletion () throws InterruptedException {
172174

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

175-
onView(allOf(withId(R.id.md_buttonDefaultPositive), withText(R.string.confirm), isDisplayed())).perform(click());
177+
onView(withText(R.string.confirm)).perform(click());
176178

177179
// Waiting a little to ensure Eventbus post propagation
178180
try {

0 commit comments

Comments
 (0)