diff --git a/detox/.eslintrc b/detox/.eslintrc index 58f7e76605..14b26f4e54 100644 --- a/detox/.eslintrc +++ b/detox/.eslintrc @@ -3,7 +3,10 @@ "extends": ["plugin:node/recommended"], "parserOptions": { "ecmaVersion": 2018, - "sourceType": "module" + "sourceType": "module", + "ecmaFeatures": { + "experimentalObjectRestSpread": true + } }, "rules": { "no-mixed-spaces-and-tabs": "error", diff --git a/detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxMatcher.java b/detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxMatcher.java index 1fa0e16e80..606c5527ec 100644 --- a/detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxMatcher.java +++ b/detox/android/detox/src/main/java/com/wix/detox/espresso/DetoxMatcher.java @@ -33,15 +33,15 @@ private DetoxMatcher() { public static Matcher matcherForText(String text) { // return anyOf(withText(text), withContentDescription(text)); - return withText(text); + return allOf(withText(text), isDisplayed()); } public static Matcher matcherForContentDescription(String contentDescription) { - return withContentDescription(contentDescription); + return allOf(withContentDescription(contentDescription), isDisplayed()); } public static Matcher matcherForTestId(String testId) { - return withTagValue(is((Object) testId)); + return allOf(withTagValue(is((Object) testId)), isDisplayed()); } public static Matcher matcherForAnd(Matcher m1, Matcher m2) { @@ -67,7 +67,7 @@ public static Matcher matcherWithDescendant(Matcher m, Matcher public static Matcher matcherForClass(final String className) { try { Class cls = Class.forName(className); - return isAssignableFrom(cls); + return allOf(isAssignableFrom(cls), isDisplayed()); } catch (ClassNotFoundException e) { // empty }