detox 20.23.1-smoke.0 → 20.23.2-smoke.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. package/Detox-android/com/wix/detox/{20.23.1-smoke.0/detox-20.23.1-smoke.0-sources.jar → 20.23.2-smoke.0/detox-20.23.2-smoke.0-sources.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0-sources.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0-sources.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0-sources.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0-sources.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.aar +0 -0
  7. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.aar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.aar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.aar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.aar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{20.23.1-smoke.0/detox-20.23.1-smoke.0.pom → 20.23.2-smoke.0/detox-20.23.2-smoke.0.pom} +1 -1
  12. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.pom.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.pom.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.pom.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.23.2-smoke.0/detox-20.23.2-smoke.0.pom.sha512 +1 -0
  16. package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
  17. package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
  18. package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
  19. package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
  20. package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
  21. package/Detox-android/com/wix/detox-legacy/{20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0-sources.jar → 20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0-sources.jar} +0 -0
  22. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0-sources.jar.md5 +1 -0
  23. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0-sources.jar.sha1 +1 -0
  24. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0-sources.jar.sha256 +1 -0
  25. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0-sources.jar.sha512 +1 -0
  26. package/Detox-android/com/wix/detox-legacy/{20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.aar → 20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.aar} +0 -0
  27. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.aar.md5 +1 -0
  28. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.aar.sha1 +1 -0
  29. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.aar.sha256 +1 -0
  30. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.aar.sha512 +1 -0
  31. package/Detox-android/com/wix/detox-legacy/{20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.pom → 20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.pom} +1 -1
  32. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.pom.md5 +1 -0
  33. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.pom.sha1 +1 -0
  34. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.pom.sha256 +1 -0
  35. package/Detox-android/com/wix/detox-legacy/20.23.2-smoke.0/detox-legacy-20.23.2-smoke.0.pom.sha512 +1 -0
  36. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml +4 -4
  37. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.md5 +1 -1
  38. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha1 +1 -1
  39. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha256 +1 -1
  40. package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha512 +1 -1
  41. package/Detox-ios-framework.tbz +0 -0
  42. package/Detox-ios-src.tbz +0 -0
  43. package/Detox-ios-xcuitest.tbz +0 -0
  44. package/android/detox/src/full/java/com/wix/detox/espresso/DetoxMatcher.java +11 -12
  45. package/android/detox/src/full/java/com/wix/detox/espresso/matcher/IsDisplayingAtLeastDetoxMatcher.kt +145 -0
  46. package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +3 -0
  47. package/android/detox/src/testFull/resources/robolectric.properties +1 -1
  48. package/detox.d.ts +0 -2
  49. package/package.json +2 -2
  50. package/src/client/Client.js +0 -4
  51. package/src/client/actions/actions.js +0 -19
  52. package/src/devices/runtime/RuntimeDevice.js +0 -5
  53. package/src/devices/runtime/drivers/DeviceDriverBase.js +0 -4
  54. package/src/devices/runtime/drivers/ios/SimulatorDriver.js +0 -11
  55. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0-sources.jar.md5 +0 -1
  56. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0-sources.jar.sha1 +0 -1
  57. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0-sources.jar.sha256 +0 -1
  58. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0-sources.jar.sha512 +0 -1
  59. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.aar +0 -0
  60. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.aar.md5 +0 -1
  61. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.aar.sha1 +0 -1
  62. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.aar.sha256 +0 -1
  63. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.aar.sha512 +0 -1
  64. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.pom.md5 +0 -1
  65. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.pom.sha1 +0 -1
  66. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.pom.sha256 +0 -1
  67. package/Detox-android/com/wix/detox/20.23.1-smoke.0/detox-20.23.1-smoke.0.pom.sha512 +0 -1
  68. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0-sources.jar.md5 +0 -1
  69. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0-sources.jar.sha1 +0 -1
  70. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0-sources.jar.sha256 +0 -1
  71. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0-sources.jar.sha512 +0 -1
  72. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.aar.md5 +0 -1
  73. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.aar.sha1 +0 -1
  74. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.aar.sha256 +0 -1
  75. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.aar.sha512 +0 -1
  76. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.pom.md5 +0 -1
  77. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.pom.sha1 +0 -1
  78. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.pom.sha256 +0 -1
  79. package/Detox-android/com/wix/detox-legacy/20.23.1-smoke.0/detox-legacy-20.23.1-smoke.0.pom.sha512 +0 -1
@@ -0,0 +1 @@
1
+ ed1be2e6a4a9de036c4c82a3685fb64d
@@ -0,0 +1 @@
1
+ fe5bfc9cdc8a8123e5a531e23e751cf58a74f18e
@@ -0,0 +1 @@
1
+ c5f1e92eff24778043d565adaa667f26393176f02b9e21f2b79a464f3e96ab34
@@ -0,0 +1 @@
1
+ 3c390122f86540122713417396dd8809c09f0c78809a88ce2889ff4c53122ad9e790d48b2d0dfb9475ec067631c1dc661d980eae2eb1005619a716cdf822006c
@@ -0,0 +1 @@
1
+ c30ab5e84a5014b0b81d4faabde6a700
@@ -0,0 +1 @@
1
+ 5bb074cd595fd75e357176cbd1427eb75ed4e8d5
@@ -0,0 +1 @@
1
+ 5fc6ee2c1a19b885d28766a68f924162061b405d79aec808d7c41eb3165bc2b1
@@ -0,0 +1 @@
1
+ 844af749105ed914beb68383c07baf6fd4bdc33b053073f0bd29de638e7474cd66a31bf2df6a0f7824d0f322b742eed9d9376da5ada807a5cd539dd217fe2ab5
@@ -3,7 +3,7 @@
3
3
  <modelVersion>4.0.0</modelVersion>
4
4
  <groupId>com.wix</groupId>
5
5
  <artifactId>detox</artifactId>
6
- <version>20.23.1-smoke.0</version>
6
+ <version>20.23.2-smoke.0</version>
7
7
  <packaging>aar</packaging>
8
8
  <name>Detox</name>
9
9
  <description>Gray box end-to-end testing and automation library for mobile apps</description>
@@ -0,0 +1 @@
1
+ 695ca8c83a9ca9732212ede0b994426d
@@ -0,0 +1 @@
1
+ 01b188846e4b6c7903ad135bbf7dd481d9c49c7b
@@ -0,0 +1 @@
1
+ eac469c94469dbc2f7e132654885574cea14019903725a418ca556a9223d4a07
@@ -0,0 +1 @@
1
+ 4b1eca97bb0bd89458f81c369a2d2e7cdf894a2038b92bbe67a9b1e1feecf69dc605f580dfc5a6b9aee07df7342d95992f83cf50722d2667a235fcd522682f30
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.23.1-smoke.0</latest>
7
- <release>20.23.1-smoke.0</release>
6
+ <latest>20.23.2-smoke.0</latest>
7
+ <release>20.23.2-smoke.0</release>
8
8
  <versions>
9
- <version>20.23.1-smoke.0</version>
9
+ <version>20.23.2-smoke.0</version>
10
10
  </versions>
11
- <lastUpdated>20240702190232</lastUpdated>
11
+ <lastUpdated>20240711082111</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 78f2b041926824a24707f38914c43f3b
1
+ c5d84a01d446af422c8a56081568088e
@@ -1 +1 @@
1
- 0a5ccf369b31c1dc2646174c112032800c51b151
1
+ cad52192217ab8710048332b8da4d7156c1a0a1b
@@ -1 +1 @@
1
- e73d79d7835e7c8e92adee17b55d59f5358632573ef613eed029d6d1d8e41ae9
1
+ 360e627f2037ff7be332f56c9b5803c66717c13a3a3177a89da116ad099c6245
@@ -1 +1 @@
1
- 444712e8a34f88c0b67628807974f4cf399b7c9c98c7687d64e48c89c7dc6a3184b2abce7764f76cb1d2340332257aee377db4617a4f0f30195d20efd0736438
1
+ ca2e0fd044c3bdff63a5bc10274bb81b7b815f7aba16b5736c778910cc1bcb38148afe0db4f78b8009f47068eebe634061fbdbb4ae2ab754d6bdea69d3935a89
@@ -0,0 +1 @@
1
+ 3e1bc603593d47252544ff8304b924a48e6ccc246261db360c8ecbc58172b01e
@@ -0,0 +1 @@
1
+ c12048517a2a252f9caed898f73211a0485e0f5f34879eb4a4b11e492bbe1283a41a8a58345df0dd69ec822684a3a8d36dc86f539297a16c0b0c86f20ac9a617
@@ -0,0 +1 @@
1
+ 697e735f9b859cf2cf8097e9ea2b99ed1b018ef4
@@ -0,0 +1 @@
1
+ b5fa97662e36dee60aa838e47f457705d0145b0243dd2f7eb0076ec53ea42127
@@ -0,0 +1 @@
1
+ cb3be83d53a83577894d9ed9fe8d96c86ebfa960c3be707684d82eb911871aebe33dcfc5fff988dc9a40e99135962a8ac8ac4c9f1be02ac957eb1fd0ddbb2277
@@ -3,7 +3,7 @@
3
3
  <modelVersion>4.0.0</modelVersion>
4
4
  <groupId>com.wix</groupId>
5
5
  <artifactId>detox-legacy</artifactId>
6
- <version>20.23.1-smoke.0</version>
6
+ <version>20.23.2-smoke.0</version>
7
7
  <packaging>aar</packaging>
8
8
  <name>Detox</name>
9
9
  <description>Gray box end-to-end testing and automation library for mobile apps</description>
@@ -0,0 +1 @@
1
+ c40c157385354846dbace7287e4b216e5c8c2018
@@ -0,0 +1 @@
1
+ 5549ceca38b4c6a6fe0dea84247db9eeedb2d3eabacf0630f68038a1d80ac248
@@ -0,0 +1 @@
1
+ 3e7329a64b7d0411765f4620e46cd3f7cd493f6ccf0ce47e5526f83af72ab7a14fd60bf229ae4c6db96245e69d4ea308e2ee5b23d638142057ced5c562d2acd0
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox-legacy</artifactId>
5
5
  <versioning>
6
- <latest>20.23.1-smoke.0</latest>
7
- <release>20.23.1-smoke.0</release>
6
+ <latest>20.23.2-smoke.0</latest>
7
+ <release>20.23.2-smoke.0</release>
8
8
  <versions>
9
- <version>20.23.1-smoke.0</version>
9
+ <version>20.23.2-smoke.0</version>
10
10
  </versions>
11
- <lastUpdated>20240702190316</lastUpdated>
11
+ <lastUpdated>20240711082136</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 5e80efbb940efd225501801a208c0bd9
1
+ 0f436877f2c3b17a186f682bacb2d685
@@ -1 +1 @@
1
- b59718f98d9df2534131223601cc4df557217d9f
1
+ 1c8b1bfd41b9caf20abbff6f9f344a73d91b54b4
@@ -1 +1 @@
1
- 61d2bef87bcbd72ad1689f3a727d50e1804443892ad56374ff090df408bc28e7
1
+ 54a26ecd056ecb46d3468291560a3ab91ead3065c8f71b659cf093fbc755709f
@@ -1 +1 @@
1
- e05e12b2b09681d99f73024edb830303fe0ab6672212fd1321a5e80812f84fb5ffa32fe555885d598ccd6626f2952b4f088d0d522afacb6abd3025146dedcfd2
1
+ 6e91dc08e997b3344ba8b2b6e7ff60177f6b9bd19a94e0b22330373361cdacbe7324b7b8164bf5809877663b573ed1968c36366cf8d3a2d69f15488bc94871e8
Binary file
package/Detox-ios-src.tbz CHANGED
Binary file
Binary file
@@ -1,35 +1,34 @@
1
1
  package com.wix.detox.espresso;
2
2
 
3
- import android.view.View;
4
-
5
- import org.hamcrest.Matcher;
6
-
7
- import androidx.test.espresso.matcher.ViewMatchers.Visibility;
8
-
9
3
  import static androidx.test.espresso.matcher.ViewMatchers.hasDescendant;
10
4
  import static androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom;
11
5
  import static androidx.test.espresso.matcher.ViewMatchers.isChecked;
12
6
  import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
13
7
  import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
14
- import static androidx.test.espresso.matcher.ViewMatchers.isDisplayingAtLeast;
15
8
  import static androidx.test.espresso.matcher.ViewMatchers.isFocused;
16
9
  import static androidx.test.espresso.matcher.ViewMatchers.isNotChecked;
17
10
  import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
18
- import static com.wix.detox.espresso.matcher.ViewMatchers.withTagValue;
19
- import static com.wix.detox.espresso.matcher.ViewMatchers.withContentDescription;
20
- import static com.wix.detox.espresso.matcher.ViewMatchers.withText;
11
+ import static com.wix.detox.espresso.matcher.ViewMatchers.matcherForDisplayingAtLeast;
21
12
  import static com.wix.detox.espresso.matcher.ViewMatchers.isMatchingAtIndex;
22
13
  import static com.wix.detox.espresso.matcher.ViewMatchers.isOfClassName;
23
14
  import static com.wix.detox.espresso.matcher.ViewMatchers.toHaveSliderPosition;
24
15
  import static com.wix.detox.espresso.matcher.ViewMatchers.withAccessibilityLabel;
16
+ import static com.wix.detox.espresso.matcher.ViewMatchers.withContentDescription;
25
17
  import static com.wix.detox.espresso.matcher.ViewMatchers.withShallowAccessibilityLabel;
18
+ import static com.wix.detox.espresso.matcher.ViewMatchers.withTagValue;
19
+ import static com.wix.detox.espresso.matcher.ViewMatchers.withText;
26
20
  import static org.hamcrest.Matchers.allOf;
27
21
  import static org.hamcrest.Matchers.anyOf;
28
- import static org.hamcrest.Matchers.is;
29
22
  import static org.hamcrest.Matchers.not;
30
23
  import static org.hamcrest.Matchers.notNullValue;
31
24
  import static org.hamcrest.Matchers.nullValue;
32
25
 
26
+ import android.view.View;
27
+
28
+ import androidx.test.espresso.matcher.ViewMatchers.Visibility;
29
+
30
+ import org.hamcrest.Matcher;
31
+
33
32
  /**
34
33
  * Created by simonracz on 10/07/2017.
35
34
  */
@@ -90,7 +89,7 @@ public class DetoxMatcher {
90
89
  }
91
90
 
92
91
  public static Matcher<View> matcherForSufficientlyVisible(int pct) {
93
- return isDisplayingAtLeast(pct);
92
+ return matcherForDisplayingAtLeast(pct);
94
93
  }
95
94
 
96
95
  public static Matcher<View> matcherForNotVisible() {
@@ -0,0 +1,145 @@
1
+ package com.wix.detox.espresso.matcher
2
+
3
+ import android.R
4
+ import android.annotation.SuppressLint
5
+ import android.content.Context
6
+ import android.graphics.Rect
7
+ import android.util.DisplayMetrics
8
+ import android.util.TypedValue
9
+ import android.view.View
10
+ import android.view.WindowManager
11
+ import androidx.test.espresso.matcher.ViewMatchers
12
+ import org.hamcrest.Description
13
+ import org.hamcrest.TypeSafeDiagnosingMatcher
14
+ import kotlin.math.abs
15
+ import kotlin.math.min
16
+
17
+ /**
18
+ * This matcher is a workaround for the issue with the `isDisplayingAtLeast` matcher.
19
+ * Because of an issue with [View.getGlobalVisibleRect], the `isDisplayingAtLeast` matcher does not work
20
+ * as expected with React Native views.
21
+ * @see [React Native Issue](https://github.com/facebook/react-native/issues/23870)
22
+ * The implementation of this matcher is based on the [isDisplayingAtLeast] matcher.
23
+ *
24
+ * This hack can be removed after proper fix in React Native.
25
+ */
26
+ class IsDisplayingAtLeastDetoxMatcher(private val areaPercentage: Int) : TypeSafeDiagnosingMatcher<View>() {
27
+
28
+ private val visibilityMatchers = ViewMatchers.withEffectiveVisibility(ViewMatchers.Visibility.VISIBLE)
29
+
30
+ override fun describeTo(description: Description) {
31
+ description
32
+ .appendText("(")
33
+ .appendDescriptionOf(visibilityMatchers)
34
+ .appendText(" and view.getGlobalVisibleRect() covers at least ")
35
+ .appendValue(areaPercentage)
36
+ .appendText(" percent of the view's area)")
37
+ }
38
+
39
+ override fun matchesSafely(item: View, mismatchDescription: Description): Boolean {
40
+ // First check if the view is visible using the default matcher
41
+ if (!ViewMatchers.isDisplayingAtLeast(areaPercentage).matches(item)) {
42
+ return false
43
+ }
44
+
45
+ // In case it is, we need to check if the view is actually visible by running intersection of all parent views rects
46
+ return isDisplayingAtLeast(item, mismatchDescription)
47
+ }
48
+
49
+ private fun isDisplayingAtLeast(view: View, mismatchDescription: Description): Boolean {
50
+ val viewVisibleRect = getGlobalVisibleRectWorkaround(view)
51
+ val maxArea = getViewMaxArea(view)
52
+ val visibleArea: Double = getViewVisibleArea(viewVisibleRect)
53
+ val displayedPercentage = (visibleArea / maxArea * 100).toInt()
54
+
55
+ if (displayedPercentage < areaPercentage) {
56
+ mismatchDescription
57
+ .appendText("view was ")
58
+ .appendValue(displayedPercentage)
59
+ .appendText(" percent visible to the user")
60
+ return false
61
+ }
62
+ return true
63
+ }
64
+
65
+ /**
66
+ * Calculate the actual visible area of the view.
67
+ */
68
+ private fun getViewVisibleArea(viewVisibleRect: Rect): Double {
69
+ return (viewVisibleRect.height() * viewVisibleRect.width()).toDouble()
70
+ }
71
+
72
+ /**
73
+ * Calculate the maximum possible area of the view (including the not visible part).
74
+ */
75
+ private fun getViewMaxArea(view: View): Double {
76
+ val (viewWidth, viewHeight) = getViewSize(view)
77
+ return viewWidth * viewHeight
78
+ }
79
+
80
+ /**
81
+ * Calculate the actual size of the view, taking into account the scaling factor and the screen size.
82
+ */
83
+ private fun getViewSize(view: View): Pair<Double, Double> {
84
+ val screenSize = getScreenWithoutStatusBarActionBar(view)
85
+ val viewWidth = min((view.width * abs(view.scaleX.toDouble())), screenSize.width().toDouble())
86
+ val viewHeight = min((view.height * abs(view.scaleY.toDouble())), screenSize.height().toDouble())
87
+ return Pair(viewWidth, viewHeight)
88
+ }
89
+
90
+ /**
91
+ * Traverse the view hierarchy and calculate the intersection of all parent views with the given view.
92
+ *
93
+ * @return The actual visible rectangle of the view.
94
+ */
95
+ private fun getGlobalVisibleRectWorkaround(view: View): Rect {
96
+ var currentParent = view.parent as? View
97
+
98
+ val calculatedVisibleRect = Rect()
99
+ view.getGlobalVisibleRect(calculatedVisibleRect)
100
+
101
+ while (currentParent != null) {
102
+ val parentVisibleRectangle = Rect()
103
+ // Fill the visible rectangle of the parent view
104
+ currentParent.getGlobalVisibleRect(parentVisibleRectangle)
105
+
106
+ // The viewVisibleRect will be replaced with the intersection of the viewVisibleRect and the parentVisibleRectangle
107
+ if (!calculatedVisibleRect.intersect(parentVisibleRectangle)) {
108
+ return Rect()
109
+ }
110
+
111
+ currentParent = currentParent.parent as? View
112
+ }
113
+
114
+ return calculatedVisibleRect
115
+ }
116
+
117
+ private fun getScreenWithoutStatusBarActionBar(view: View): Rect {
118
+ val m = DisplayMetrics()
119
+ (view.context.getSystemService(Context.WINDOW_SERVICE) as WindowManager)
120
+ .defaultDisplay
121
+ .getMetrics(m)
122
+
123
+ val statusBarHeight = getStatusBarHeight(view)
124
+ val actionBarHeight = getActionBarHeight(view)
125
+ return Rect(0, 0, m.widthPixels, m.heightPixels - (statusBarHeight + actionBarHeight))
126
+ }
127
+
128
+ private fun getActionBarHeight(view: View): Int {
129
+ val tv = TypedValue()
130
+ val actionBarHeight = if (view.context.theme.resolveAttribute(R.attr.actionBarSize, tv, true)) {
131
+ TypedValue.complexToDimensionPixelSize(
132
+ tv.data, view.context.resources.displayMetrics
133
+ )
134
+ } else {
135
+ 0
136
+ }
137
+ return actionBarHeight
138
+ }
139
+
140
+ @SuppressLint("InternalInsetResource", "DiscouragedApi")
141
+ private fun getStatusBarHeight(view: View): Int {
142
+ val resourceId = view.context.resources.getIdentifier("status_bar_height", "dimen", "android")
143
+ return if (resourceId > 0) view.context.resources.getDimensionPixelSize(resourceId) else 0
144
+ }
145
+ }
@@ -66,6 +66,9 @@ fun toHaveSliderPosition(expectedValuePct: Double, tolerance: Double): Matcher<V
66
66
  }
67
67
  }
68
68
 
69
+ fun matcherForDisplayingAtLeast(percents: Int): Matcher<View> =
70
+ IsDisplayingAtLeastDetoxMatcher(percents)
71
+
69
72
  /**
70
73
  * Same as [androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom], but accepts any class. Needed
71
74
  * in order to avoid warning when passing 'any' class.
@@ -1 +1 @@
1
- sdk=28
1
+ sdk=34
package/detox.d.ts CHANGED
@@ -905,8 +905,6 @@ declare global {
905
905
  */
906
906
  captureViewHierarchy(name?: string): Promise<string>;
907
907
 
908
- getUIHierarchy(): Promise<string>;
909
-
910
908
  /**
911
909
  * Simulate shake (iOS Only)
912
910
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "detox",
3
3
  "description": "E2E tests and automation for mobile",
4
- "version": "20.23.1-smoke.0",
4
+ "version": "20.23.2-smoke.0",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -115,5 +115,5 @@
115
115
  "browserslist": [
116
116
  "node 14"
117
117
  ],
118
- "gitHead": "42054f0e139f94f61d6209abc239aba2e7296dd7"
118
+ "gitHead": "eb228ba5b8e7da7d9e41ed17d51d6a59c497e640"
119
119
  }
@@ -225,10 +225,6 @@ class Client {
225
225
  }));
226
226
  }
227
227
 
228
- async getUIHierarchy() {
229
- return await this.sendAction(new actions.GetUIHierarchy());
230
- }
231
-
232
228
  async currentStatus() {
233
229
  return await this.sendAction(new actions.CurrentStatus());
234
230
  }
@@ -292,24 +292,6 @@ class SetInstrumentsRecordingState extends Action {
292
292
  }
293
293
  }
294
294
 
295
- class GetUIHierarchy extends Action {
296
- constructor(params) {
297
- super('getUIHierarchy', params);
298
- }
299
-
300
- get isAtomic() {
301
- return false;
302
- }
303
-
304
- get timeout() {
305
- return 0;
306
- }
307
-
308
- async handle(response) {
309
- throw response.params.viewHierarchy;
310
- }
311
- }
312
-
313
295
  class CaptureViewHierarchy extends Action {
314
296
  constructor(params) {
315
297
  super('captureViewHierarchy', params);
@@ -354,5 +336,4 @@ module.exports = {
354
336
  SetOrientation,
355
337
  SetInstrumentsRecordingState,
356
338
  CaptureViewHierarchy,
357
- GetUIHierarchy
358
339
  };
@@ -17,7 +17,6 @@ class RuntimeDevice {
17
17
  }, deviceDriver) {
18
18
  const methodNames = [
19
19
  'captureViewHierarchy',
20
- 'getUIHierarchy',
21
20
  'clearKeychain',
22
21
  'disableSynchronization',
23
22
  'enableSynchronization',
@@ -196,10 +195,6 @@ class RuntimeDevice {
196
195
  return this.deviceDriver.captureViewHierarchy(name);
197
196
  }
198
197
 
199
- async getUIHierarchy() {
200
- return this.deviceDriver.getUIHierarchy();
201
- }
202
-
203
198
  async sendToHome() {
204
199
  await this.deviceDriver.sendToHome();
205
200
  await this.deviceDriver.waitForBackground();
@@ -222,10 +222,6 @@ class DeviceDriverBase {
222
222
  async captureViewHierarchy() {
223
223
  return '';
224
224
  }
225
-
226
- async getUIHierarchy() {
227
- return '';
228
- }
229
225
  }
230
226
 
231
227
  module.exports = DeviceDriverBase;
@@ -194,17 +194,6 @@ class SimulatorDriver extends IosDriver {
194
194
  return viewHierarchyURL;
195
195
  }
196
196
 
197
- async getUIHierarchy() {
198
- try {
199
- await this.client.getUIHierarchy();
200
- } catch (e) {
201
- const stringError = e.toString();
202
- return stringError.replace('Error: ', '');
203
- }
204
-
205
- return 'Failed to get UI hierarchy.';
206
- }
207
-
208
197
  async setStatusBar(flags) {
209
198
  await this._applesimutils.statusBarOverride(this.udid, flags);
210
199
  }
@@ -1 +0,0 @@
1
- 3cbe3c2ef1168a85e65018616c3c9c2d
@@ -1 +0,0 @@
1
- d9e4001dfed9843862dcd3eacfce380b177b1161
@@ -1 +0,0 @@
1
- 0453539940fe7b824fb7b2ed4b725ff1ccae3d35d4c98c741cf638e45e151aa8
@@ -1 +0,0 @@
1
- 5119091b389062bdbe5362404aac05146ca72612e12ef72f68edc9db9896f76341758de5aec6b0a80229d7298355871ffa38a95a0b52c99a8b7f5f40ab6caf96
@@ -1 +0,0 @@
1
- 31bc3655525c5e1de60651828dbe4b23
@@ -1 +0,0 @@
1
- 05e3d3c1fb1dfe0ef619885bd89f3e23ad265c14
@@ -1 +0,0 @@
1
- 4c664be552f9844c390dcf9843c16195ee71ae5fac82340fc2fa26d7f98f97da
@@ -1 +0,0 @@
1
- b9a385a9b94cf5b0bec34751c9c7e03fd7cd8f6f094beac31df31bed89dbe93895289e45a08cf230a9806c71786ae74c75e8f58f3f57814624af8fa28e6b76d6
@@ -1 +0,0 @@
1
- 017e9d844845cc4a2ac9d45254bc7245
@@ -1 +0,0 @@
1
- 85d50fab694c4c2b584a34aa93c0f0c2ccd92817
@@ -1 +0,0 @@
1
- af22551004fbd36ce90c88c1dc15a4a251f8c04d632a5a86ca7c88b232717d6b
@@ -1 +0,0 @@
1
- 8d84e75f245e862cac9b238b0d05f694fccead467a2ef068bc916439296acddb722d92d080073e499068b838058b1494f833c1ff59ee3619a4fc778b166190fa
@@ -1 +0,0 @@
1
- 12947f11c87377b69ece03b176bd0cdd12365a79
@@ -1 +0,0 @@
1
- e2390ac05c82b451775e28ba1373930517f773dc2acdad23c6bf5bafa5424cbb
@@ -1 +0,0 @@
1
- 8f87831adb51b07edbd75a011bdb18ceb066e72b2929432ccd4898ecf894e2a296352586374215bb0cddb639d93225c058e52b2e1cb2afc72e73d66074c6166b
@@ -1 +0,0 @@
1
- 95b13b9d33524b8c704258c314a3e21572086d45
@@ -1 +0,0 @@
1
- a40f50e7629a8076af5698aa1a533523ea1bc53782240ff01be641911d8865b2
@@ -1 +0,0 @@
1
- c3c9d8eca84ce4da0e1a75a7364ec0a8df8fd1b910db22769b719d4c222fbb726ba973a41c35eeab77db3603c87a31d8b85bb71cd6c5d25bdb36d48f72733fa4
@@ -1 +0,0 @@
1
- 447671b6658af9ac9590ad9d868d2466057b3ccb
@@ -1 +0,0 @@
1
- ff44b7647039efb82df8d4ed884cbdf5c065daf35e64220ebc8f8d54e50ea597
@@ -1 +0,0 @@
1
- c97bbed56a568c1b55da6b16d91431544fad55f1df463052977e367fe2bd9409f6c773d25d5125416d76709260a0cc3b2234b85ddc2ddeeda661a4561496c5ad