detox 20.27.7-smoke.0 → 20.28.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. package/Detox-android/com/wix/detox/{20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar → 20.28.0/detox-20.28.0-sources.jar} +0 -0
  2. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.md5 +1 -0
  3. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.sha1 +1 -0
  4. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.sha256 +1 -0
  5. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.sha512 +1 -0
  6. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar +0 -0
  7. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.md5 +1 -0
  8. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.sha1 +1 -0
  9. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.sha256 +1 -0
  10. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.sha512 +1 -0
  11. package/Detox-android/com/wix/detox/{20.27.7-smoke.0/detox-20.27.7-smoke.0.pom → 20.28.0/detox-20.28.0.pom} +1 -1
  12. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.pom.md5 +1 -0
  13. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.pom.sha1 +1 -0
  14. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.pom.sha256 +1 -0
  15. package/Detox-android/com/wix/detox/20.28.0/detox-20.28.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.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar → 20.28.0/detox-legacy-20.28.0-sources.jar} +0 -0
  22. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.md5 +1 -0
  23. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.sha1 +1 -0
  24. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.sha256 +1 -0
  25. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.sha512 +1 -0
  26. package/Detox-android/com/wix/detox-legacy/{20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar → 20.28.0/detox-legacy-20.28.0.aar} +0 -0
  27. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.md5 +1 -0
  28. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.sha1 +1 -0
  29. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.sha256 +1 -0
  30. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.sha512 +1 -0
  31. package/Detox-android/com/wix/detox-legacy/{20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom → 20.28.0/detox-legacy-20.28.0.pom} +1 -1
  32. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.pom.md5 +1 -0
  33. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.pom.sha1 +1 -0
  34. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.pom.sha256 +1 -0
  35. package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.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/EspressoDetox.java +53 -2
  45. package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +11 -0
  46. package/android/detox/src/full/java/com/wix/detox/espresso/matcher/IsDisplayingAtLeastDetoxMatcher.kt +2 -2
  47. package/android/detox/src/full/java/com/wix/detox/espresso/web/DetoxWebAtomMatcher.java +6 -9
  48. package/android/detox/src/full/java/com/wix/detox/espresso/web/WebElement.java +0 -4
  49. package/detox.d.ts +39 -0
  50. package/package.json +3 -3
  51. package/src/android/espressoapi/EspressoDetox.js +83 -0
  52. package/src/copilot/detoxCopilotFrameworkDriver.js +27 -15
  53. package/src/devices/runtime/RuntimeDevice.js +11 -0
  54. package/src/devices/runtime/drivers/DeviceDriverBase.js +8 -0
  55. package/src/devices/runtime/drivers/android/AndroidDriver.js +16 -0
  56. package/src/devices/runtime/drivers/ios/SimulatorDriver.js +35 -0
  57. package/src/utils/assertArgument.js +9 -0
  58. package/src/utils/invocationTraceDescriptions.js +1 -0
  59. package/src/utils/mapDeviceLongPressArguments.js +56 -0
  60. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.md5 +0 -1
  61. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha1 +0 -1
  62. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha256 +0 -1
  63. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha512 +0 -1
  64. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar +0 -0
  65. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.md5 +0 -1
  66. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha1 +0 -1
  67. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha256 +0 -1
  68. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha512 +0 -1
  69. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.md5 +0 -1
  70. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha1 +0 -1
  71. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha256 +0 -1
  72. package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha512 +0 -1
  73. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.md5 +0 -1
  74. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha1 +0 -1
  75. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha256 +0 -1
  76. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha512 +0 -1
  77. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.md5 +0 -1
  78. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha1 +0 -1
  79. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha256 +0 -1
  80. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha512 +0 -1
  81. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.md5 +0 -1
  82. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha1 +0 -1
  83. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha256 +0 -1
  84. package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha512 +0 -1
  85. package/android/detox/src/full/java/com/wix/detox/espresso/web/DetoxDriverAtoms.java +0 -642
@@ -0,0 +1 @@
1
+ 5f9c61888ac541880ca966b9cf54f996
@@ -0,0 +1 @@
1
+ 905d3c70363af1ef378373c1337b2a02fb085847
@@ -0,0 +1 @@
1
+ 9da6d1b24a67e2c3f54e4f85b76d2f308df4f4783a2ead715cacae4078d54198
@@ -0,0 +1 @@
1
+ 488ca79bd9330a788fe0659818e9256d06908d3c9ff765ddf9ee41e253b78dbbb0db1409f794532019fa39ca3395c8a27396398cbe56d203989afb258c31f1b8
@@ -0,0 +1 @@
1
+ 2d6e006f6dc0428fd9be3efb971433cf
@@ -0,0 +1 @@
1
+ 7e71f1e0bd4e0beea5f2c8db164c560255332a30
@@ -0,0 +1 @@
1
+ d0d12c5ecb2c4d760332b168a9237aa1948ac10ea1736a4b75067de6ebaaf6cb
@@ -0,0 +1 @@
1
+ 1ebe46cd76b0bcfdcab9fc6b1a863b257da71ee05bac63f538fab1351f55ba858d97b81aba1d040d5db74c9e27508b12dbeb6ae2e6c09ef469a184516fc82c00
@@ -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.27.7-smoke.0</version>
6
+ <version>20.28.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
+ 72dd9fb9e071a00dfb6b7731da5a8268
@@ -0,0 +1 @@
1
+ 5ea89a7c06c7d3e3ebee78b290422c25471ffccf
@@ -0,0 +1 @@
1
+ 48839af705f5ce69be3f8075367e012c822f2cb9b4d5d66d1466c718f7adecd4
@@ -0,0 +1 @@
1
+ 01b1f663413f39c8f25e81f70669ddce75f2f332f154c531cb5289a646d25e3cc80120580202da5bc3cf1e4fd865a61b0551126be9da37b61eeec6f75fc2b9cf
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox</artifactId>
5
5
  <versioning>
6
- <latest>20.27.7-smoke.0</latest>
7
- <release>20.27.7-smoke.0</release>
6
+ <latest>20.28.0</latest>
7
+ <release>20.28.0</release>
8
8
  <versions>
9
- <version>20.27.7-smoke.0</version>
9
+ <version>20.28.0</version>
10
10
  </versions>
11
- <lastUpdated>20241103220531</lastUpdated>
11
+ <lastUpdated>20241114182711</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- ebda30a3b044d201aaf8fcb02e932cec
1
+ 4409ef64d1213179048bfd9fed283361
@@ -1 +1 @@
1
- 5adda00fd360478449a0754c8f64e7bb3c8e908b
1
+ 112cd653d1f7777391df1fb10e9a33619f5d0c1b
@@ -1 +1 @@
1
- b9d1d0f22516176030945e087241218776c394d2084f3d869c783b634af12911
1
+ 2177b496977ac272c3b7333fa2a4505f8756dca0bc265970801d60985a6a8dfd
@@ -1 +1 @@
1
- fbd2958bf59db3a3305a8af36159033aa962183fc81ef2c43d0f7542b36d9e13b71d7b971a4e33ed958ab57860a1ed2f948d6cdb741420ef3554433f94604a3e
1
+ da830892bc25886891e341fe7e167f4aa1138c8fc2c28246d31409c39e82aa64f13c0a0a39bb6394a260ee2f449bf16e5378be6026cf1862759d57cec40fd053
@@ -0,0 +1 @@
1
+ d01d2e826e3b99f843a7e444d309d6d2
@@ -0,0 +1 @@
1
+ 3cf94f158d84d98241e421c64cc5c06142fbf4c0
@@ -0,0 +1 @@
1
+ cb302fd2cd81b8ba3a03115ab529d073bb8f223af0088e89e22af90120117412
@@ -0,0 +1 @@
1
+ 37109f12c35e795d76f25a7c462c143dcedbbd0cb66bdde25364f237754da179307e87b73fae67e5432b7724903abe485c5105ac5667a7f6f26806b6c5229d88
@@ -0,0 +1 @@
1
+ f3e0e6447e243a7a93b9425d8ca2c34d
@@ -0,0 +1 @@
1
+ 135215a6c872a80b0020ecface42fd07fde6e8a2
@@ -0,0 +1 @@
1
+ 67f6e9df85d01f17887b135aa64b3db8b10afce941b70314fa1cc15580699102
@@ -0,0 +1 @@
1
+ a71be556721d9c7b600914bcbeaff171d0d959a3dbb816d4467c8f52caa5703d9b241c0a76c13e4010c57036fff63b0c157eb126c58a96fe593ef1a71dcd3778
@@ -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.27.7-smoke.0</version>
6
+ <version>20.28.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
+ 2c9a5efdc4cc9949403de29543d189c3
@@ -0,0 +1 @@
1
+ dd1b295394376809aa40565060e7f0068758476d
@@ -0,0 +1 @@
1
+ 28a059a24a50d3e94b75af039c1aee8dd403bb862525cce01876a4a188313eb1
@@ -0,0 +1 @@
1
+ 252cf3d47cd05805ab38367c8b33793b5b7e210a5f7f88717b1439127f168181bd5b3a05fa020c4c444aad0dfb6ad81547a7bc05ce6dc5f8043aff2eea3096f1
@@ -3,11 +3,11 @@
3
3
  <groupId>com.wix</groupId>
4
4
  <artifactId>detox-legacy</artifactId>
5
5
  <versioning>
6
- <latest>20.27.7-smoke.0</latest>
7
- <release>20.27.7-smoke.0</release>
6
+ <latest>20.28.0</latest>
7
+ <release>20.28.0</release>
8
8
  <versions>
9
- <version>20.27.7-smoke.0</version>
9
+ <version>20.28.0</version>
10
10
  </versions>
11
- <lastUpdated>20241103220527</lastUpdated>
11
+ <lastUpdated>20241114182808</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- 8404ed177a718520c6436dd71ce039ab
1
+ dbb9351f570b2e9f79cd97583cda0e41
@@ -1 +1 @@
1
- b925dca17db41378f169a69df552119e5179d329
1
+ e043135169acc282528cb1990f80ae8be7fd89b2
@@ -1 +1 @@
1
- 0c65934b91d9e80b2bed548119d613ef1865249716c95804264e24502938f67f
1
+ 723c473ca26e2ced79ca5d707aa4e96f068d3bb86577a66d54ae5c41231127f2
@@ -1 +1 @@
1
- 22339987979aa7c84c388216b8be30373bc43193452117b4520a61780d3a37b0991ba554d900c5ed6a66d9722e3437a4bdb686863622e8e3d85eb196be2aee63
1
+ 5061e8696bf7b07237dd2b8fc02f65054eaaa87884723ca0f706b3b1de63e153e636db8077c6fdfd29ad8d0ca67433ff6a327bf6ffaddf040e671a2cafb4106e
Binary file
package/Detox-ios-src.tbz CHANGED
Binary file
Binary file
@@ -21,12 +21,11 @@ import java.util.ArrayList;
21
21
 
22
22
  import androidx.test.espresso.UiController;
23
23
  import androidx.test.espresso.ViewAction;
24
- import androidx.test.espresso.ViewInteraction;
25
- import androidx.test.espresso.NoMatchingViewException;
26
24
  import androidx.test.platform.app.InstrumentationRegistry;
27
25
 
28
26
  import static androidx.test.espresso.Espresso.onView;
29
27
  import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
28
+ import static com.wix.detox.espresso.UiAutomatorHelper.getStatusBarHeightDps;
30
29
 
31
30
  /**
32
31
  * Created by rotemm on 26/12/2016.
@@ -34,6 +33,10 @@ import static androidx.test.espresso.matcher.ViewMatchers.isRoot;
34
33
  public class EspressoDetox {
35
34
  private static final String LOG_TAG = "detox";
36
35
 
36
+ private static int calculateAdjustedY(View view, Integer y, boolean shouldIgnoreStatusBar) {
37
+ return shouldIgnoreStatusBar ? y + getStatusBarHeightDps(view) : y;
38
+ }
39
+
37
40
  public static Object perform(Matcher<View> matcher, ViewAction action) {
38
41
  ViewActionPerformer performer = ViewActionPerformer.forAction(action);
39
42
  return performer.performOn(matcher);
@@ -121,5 +124,53 @@ public class EspressoDetox {
121
124
  }
122
125
  });
123
126
  }
127
+
128
+ public static void tap(Integer x, Integer y, boolean shouldIgnoreStatusBar) {
129
+ onView(isRoot()).perform(new ViewAction() {
130
+ @Override
131
+ public Matcher<View> getConstraints() {
132
+ return isRoot();
133
+ }
134
+
135
+ @Override
136
+ public String getDescription() {
137
+ return "tap on screen";
138
+ }
139
+
140
+ @Override
141
+ public void perform(UiController uiController, View view) {
142
+ int adjustedY = calculateAdjustedY(view, y, shouldIgnoreStatusBar);
143
+ ViewAction action = DetoxAction.tapAtLocation(x, adjustedY);
144
+ action.perform(uiController, view);
145
+ uiController.loopMainThreadUntilIdle();
146
+ }
147
+ });
148
+ }
149
+
150
+ public static void longPress(Integer x, Integer y, boolean shouldIgnoreStatusBar) {
151
+ longPress(x, y, null, shouldIgnoreStatusBar);
152
+ }
153
+
154
+ public static void longPress(Integer x, Integer y, Integer duration, boolean shouldIgnoreStatusBar) {
155
+ onView(isRoot()).perform(new ViewAction() {
156
+ @Override
157
+ public Matcher<View> getConstraints() {
158
+ return isRoot();
159
+ }
160
+
161
+ @Override
162
+ public String getDescription() {
163
+ return "long press on screen";
164
+ }
165
+
166
+ @Override
167
+ public void perform(UiController uiController, View view) {
168
+ int adjustedY = calculateAdjustedY(view, y, shouldIgnoreStatusBar);
169
+ ViewAction action = DetoxAction.longPress(x, adjustedY, duration);
170
+ action.perform(uiController, view);
171
+ uiController.loopMainThreadUntilIdle();
172
+ }
173
+ });
174
+ }
124
175
  }
125
176
 
@@ -1,8 +1,13 @@
1
1
  package com.wix.detox.espresso;
2
2
 
3
+ import android.annotation.SuppressLint;
4
+ import android.content.Context;
3
5
  import android.os.Handler;
6
+ import android.util.DisplayMetrics;
4
7
  import android.util.Log;
8
+ import android.util.TypedValue;
5
9
  import android.view.Choreographer;
10
+ import android.view.View;
6
11
 
7
12
  import com.wix.detox.common.UIThread;
8
13
  import com.wix.detox.espresso.action.common.utils.UiControllerUtils;
@@ -111,4 +116,10 @@ public class UiAutomatorHelper {
111
116
  }
112
117
  }
113
118
 
119
+ @SuppressLint({"DiscouragedApi", "InternalInsetResource"})
120
+ public static int getStatusBarHeightDps(View view) {
121
+ Context context = view.getContext();
122
+ int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
123
+ return (int) (context.getResources().getDimensionPixelSize(resourceId) / ((float) context.getResources().getDisplayMetrics().densityDpi / DisplayMetrics.DENSITY_DEFAULT));
124
+ }
114
125
  }
@@ -120,7 +120,7 @@ class IsDisplayingAtLeastDetoxMatcher(private val areaPercentage: Int) : TypeSaf
120
120
  .defaultDisplay
121
121
  .getMetrics(m)
122
122
 
123
- val statusBarHeight = getStatusBarHeight(view)
123
+ val statusBarHeight = getStatusBarHeightPixels(view)
124
124
  val actionBarHeight = getActionBarHeight(view)
125
125
  return Rect(0, 0, m.widthPixels, m.heightPixels - (statusBarHeight + actionBarHeight))
126
126
  }
@@ -138,7 +138,7 @@ class IsDisplayingAtLeastDetoxMatcher(private val areaPercentage: Int) : TypeSaf
138
138
  }
139
139
 
140
140
  @SuppressLint("InternalInsetResource", "DiscouragedApi")
141
- private fun getStatusBarHeight(view: View): Int {
141
+ private fun getStatusBarHeightPixels(view: View): Int {
142
142
  val resourceId = view.context.resources.getIdentifier("status_bar_height", "dimen", "android")
143
143
  return if (resourceId > 0) view.context.resources.getDimensionPixelSize(resourceId) else 0
144
144
  }
@@ -1,16 +1,13 @@
1
1
  package com.wix.detox.espresso.web;
2
2
 
3
3
 
4
- import static androidx.test.espresso.web.webdriver.DriverAtoms.findMultipleElements;
5
-
6
- import static com.wix.detox.espresso.web.DetoxDriverAtoms.findMultipleElementsDetox;
7
-
8
4
  import androidx.test.espresso.web.model.Atom;
9
5
  import androidx.test.espresso.web.model.ElementReference;
10
6
  import androidx.test.espresso.web.webdriver.Locator;
11
7
 
12
8
  import java.util.List;
13
9
 
10
+ import static androidx.test.espresso.web.webdriver.DriverAtoms.findMultipleElements;
14
11
 
15
12
  public class DetoxWebAtomMatcher {
16
13
 
@@ -19,19 +16,19 @@ public class DetoxWebAtomMatcher {
19
16
  }
20
17
 
21
18
  public static Atom<List<ElementReference>> matcherForId(String id) {
22
- return findMultipleElementsDetox(Locator.ID, id);
19
+ return findMultipleElements(Locator.ID, id);
23
20
  }
24
21
 
25
22
  public static Atom<List<ElementReference>> matcherForClassName(String className) {
26
- return findMultipleElementsDetox(Locator.CLASS_NAME, className);
23
+ return findMultipleElements(Locator.CLASS_NAME, className);
27
24
  }
28
25
 
29
26
  public static Atom<List<ElementReference>> matcherForCssSelector(String cssSelector) {
30
- return findMultipleElementsDetox(Locator.CSS_SELECTOR, cssSelector);
27
+ return findMultipleElements(Locator.CSS_SELECTOR, cssSelector);
31
28
  }
32
29
 
33
30
  public static Atom<List<ElementReference>> matcherForName(String name) {
34
- return findMultipleElementsDetox(Locator.NAME, name);
31
+ return findMultipleElements(Locator.NAME, name);
35
32
  }
36
33
 
37
34
  public static Atom<List<ElementReference>> matcherForXPath(String xpath) {
@@ -49,4 +46,4 @@ public class DetoxWebAtomMatcher {
49
46
  public static Atom<List<ElementReference>> matcherForTagName(String tag) {
50
47
  return findMultipleElements(Locator.TAG_NAME, tag);
51
48
  }
52
- }
49
+ }
@@ -1,7 +1,5 @@
1
1
  package com.wix.detox.espresso.web;
2
2
 
3
- import android.util.Log;
4
-
5
3
  import androidx.test.espresso.web.model.Atom;
6
4
  import androidx.test.espresso.web.model.Atoms;
7
5
  import androidx.test.espresso.web.model.ElementReference;
@@ -31,9 +29,7 @@ public class WebElement {
31
29
  }
32
30
 
33
31
  ElementReference get() {
34
- long timestamp = System.currentTimeMillis();
35
32
  List<ElementReference> elements = getWebViewInteraction().withTimeout(30, TimeUnit.SECONDS).perform(matcherAtom).get();
36
- Log.d("WebElement", "Time taken to get element: " + (System.currentTimeMillis() - timestamp) + "ms");
37
33
 
38
34
  if (elements == null || elements.size() == 0 || index >= elements.size()) {
39
35
  throw new RuntimeException(String.format("element was not found at index: %d", index));
package/detox.d.ts CHANGED
@@ -784,6 +784,45 @@ declare global {
784
784
  */
785
785
  setOrientation(orientation: Orientation): Promise<void>;
786
786
 
787
+ /**
788
+ * Perform a tap at arbitrary coordinates on the device's screen.
789
+ * @param point Coordinates in the element's coordinate space. Optional. defaults: x: 100, y: 100
790
+ * @param shouldIgnoreStatusBar Coordinates will be measured starting from under the status bar. this param will affect only in Android tests. Optional. default: true
791
+ * @example await device.tap();
792
+ * @example await device.tap({ x: 100, y: 150 }, false);
793
+ * @example await device.tap({ x: 100, y: 150 });
794
+ * @example await device.tap(false);
795
+ */
796
+ tap(): Promise<void>;
797
+ tap(point: Point2D): Promise<void>;
798
+ tap(point: Point2D, shouldIgnoreStatusBar: boolean): Promise<void>;
799
+ tap(shouldIgnoreStatusBar: boolean): Promise<void>;
800
+
801
+ /**
802
+ * Perform a long press at arbitrary coordinates on the device's screen. Custom press duration if needed.
803
+ * @param point Coordinates in the device's coordinate space. Optional. defaults: x: 100, y: 100
804
+ * @param duration Custom press duration time, in milliseconds. Optional (defaults to the standard long-press duration for Android and 1000 milliseconds for ios).
805
+ * Custom durations should be used cautiously, as they can affect test consistency and user experience expectations.
806
+ * They are typically necessary when testing components that behave differently from the platform's defaults or when simulating unique user interactions.
807
+ * @param shouldIgnoreStatusBar Coordinates will be measured starting from under the status bar. this param will affect only in Android tests. Optional. default: true
808
+ * @example await device.longPress();
809
+ * @example await device.longPress({ x: 100, y: 150 }, 2000, false);
810
+ * @example await device.longPress({ x: 100, y: 150 }, 2000);
811
+ * @example await device.longPress(2000, false);
812
+ * @example await device.longPress({ x: 100, y: 150 }, false);
813
+ * @example await device.longPress({ x: 100, y: 150 });
814
+ * @example await device.longPress(2000);
815
+ * @example await device.longPress(false);
816
+ */
817
+ longPress(): Promise<void>;
818
+ longPress(point: Point2D, duration: number, shouldIgnoreStatusBar: boolean): Promise<void>;
819
+ longPress(point: Point2D, duration: number): Promise<void>;
820
+ longPress(duration: number, shouldIgnoreStatusBar: boolean): Promise<void>;
821
+ longPress(point: Point2D, shouldIgnoreStatusBar: boolean): Promise<void>;
822
+ longPress(point: Point2D): Promise<void>;
823
+ longPress(duration: number): Promise<void>;
824
+ longPress(shouldIgnoreStatusBar: boolean): Promise<void>;
825
+
787
826
  /**
788
827
  * Sets the simulator/emulator location to the given latitude and longitude.
789
828
  *
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.27.7-smoke.0",
4
+ "version": "20.28.0",
5
5
  "bin": {
6
6
  "detox": "local-cli/cli.js"
7
7
  },
@@ -71,7 +71,7 @@
71
71
  "caf": "^15.0.1",
72
72
  "chalk": "^4.0.0",
73
73
  "child-process-promise": "^2.2.0",
74
- "detox-copilot": "^0.0.23",
74
+ "detox-copilot": "^0.0.24",
75
75
  "execa": "^5.1.1",
76
76
  "find-up": "^5.0.0",
77
77
  "fs-extra": "^11.0.0",
@@ -116,5 +116,5 @@
116
116
  "browserslist": [
117
117
  "node 14"
118
118
  ],
119
- "gitHead": "339b51c8b014686628fff6f695b3d79ccf555a12"
119
+ "gitHead": "c97e583d7e33ad9472d5b3e68dda724f1300c83c"
120
120
  }
@@ -73,6 +73,89 @@ class EspressoDetox {
73
73
  };
74
74
  }
75
75
 
76
+ static tap(x, y, shouldIgnoreStatusBar) {
77
+ if (typeof x !== "number") throw new Error("x should be a number, but got " + (x + (" (" + (typeof x + ")"))));
78
+ if (typeof y !== "number") throw new Error("y should be a number, but got " + (y + (" (" + (typeof y + ")"))));
79
+ if (typeof shouldIgnoreStatusBar !== "boolean") throw new Error("shouldIgnoreStatusBar should be a boolean, but got " + (shouldIgnoreStatusBar + (" (" + (typeof shouldIgnoreStatusBar + ")"))));
80
+ return {
81
+ target: {
82
+ type: "Class",
83
+ value: "com.wix.detox.espresso.EspressoDetox"
84
+ },
85
+ method: "tap",
86
+ args: [{
87
+ type: "Integer",
88
+ value: x
89
+ }, {
90
+ type: "Integer",
91
+ value: y
92
+ }, {
93
+ type: "boolean",
94
+ value: shouldIgnoreStatusBar
95
+ }]
96
+ };
97
+ }
98
+
99
+ static longPress(x, y, shouldIgnoreStatusBar) {
100
+ function longPress3(x, y, shouldIgnoreStatusBar) {
101
+ if (typeof x !== "number") throw new Error("x should be a number, but got " + (x + (" (" + (typeof x + ")"))));
102
+ if (typeof y !== "number") throw new Error("y should be a number, but got " + (y + (" (" + (typeof y + ")"))));
103
+ if (typeof shouldIgnoreStatusBar !== "boolean") throw new Error("shouldIgnoreStatusBar should be a boolean, but got " + (shouldIgnoreStatusBar + (" (" + (typeof shouldIgnoreStatusBar + ")"))));
104
+ return {
105
+ target: {
106
+ type: "Class",
107
+ value: "com.wix.detox.espresso.EspressoDetox"
108
+ },
109
+ method: "longPress",
110
+ args: [{
111
+ type: "Integer",
112
+ value: x
113
+ }, {
114
+ type: "Integer",
115
+ value: y
116
+ }, {
117
+ type: "boolean",
118
+ value: shouldIgnoreStatusBar
119
+ }]
120
+ };
121
+ }
122
+
123
+ function longPress4(x, y, duration, shouldIgnoreStatusBar) {
124
+ if (typeof x !== "number") throw new Error("x should be a number, but got " + (x + (" (" + (typeof x + ")"))));
125
+ if (typeof y !== "number") throw new Error("y should be a number, but got " + (y + (" (" + (typeof y + ")"))));
126
+ if (typeof duration !== "number") throw new Error("duration should be a number, but got " + (duration + (" (" + (typeof duration + ")"))));
127
+ if (typeof shouldIgnoreStatusBar !== "boolean") throw new Error("shouldIgnoreStatusBar should be a boolean, but got " + (shouldIgnoreStatusBar + (" (" + (typeof shouldIgnoreStatusBar + ")"))));
128
+ return {
129
+ target: {
130
+ type: "Class",
131
+ value: "com.wix.detox.espresso.EspressoDetox"
132
+ },
133
+ method: "longPress",
134
+ args: [{
135
+ type: "Integer",
136
+ value: x
137
+ }, {
138
+ type: "Integer",
139
+ value: y
140
+ }, {
141
+ type: "Integer",
142
+ value: duration
143
+ }, {
144
+ type: "boolean",
145
+ value: shouldIgnoreStatusBar
146
+ }]
147
+ };
148
+ }
149
+
150
+ if (arguments.length === 3) {
151
+ return longPress3.apply(null, arguments);
152
+ }
153
+
154
+ if (arguments.length === 4) {
155
+ return longPress4.apply(null, arguments);
156
+ }
157
+ }
158
+
76
159
  }
77
160
 
78
161
  module.exports = EspressoDetox;