Skip to content

Commit

Permalink
androidTest: disable Toast check if android device have android 11 or…
Browse files Browse the repository at this point in the history
… upper
  • Loading branch information
Binnette committed Nov 25, 2024
1 parent d403490 commit f12694c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions app/src/androidTest/java/net/osmtracker/util/TestUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Environment;
import android.preference.PreferenceManager;
import androidx.test.platform.app.InstrumentationRegistry;
Expand Down Expand Up @@ -118,8 +119,12 @@ public static File getLayoutsDirectory(){
}

public static void checkToastIsShownWith(String text){
onView(withText(text)).inRoot(new ToastMatcher())
.check(matches(isDisplayed()));
// Espresso can not check Toast for android >= 11
// https://github.com/android/android-test/issues/803
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.R) {
onView(withText(text)).inRoot(new ToastMatcher())
.check(matches(isDisplayed()));
}
}

public static String getStringResource(int resourceId){
Expand Down
4 changes: 4 additions & 0 deletions app/src/androidTest/java/net/osmtracker/util/WaitForView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package net.osmtracker.util;

public class WaitForView {
}

0 comments on commit f12694c

Please sign in to comment.