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.
- 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
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.aar.sha512 +1 -0
- 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
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.28.0/detox-20.28.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox/maven-metadata.xml.sha512 +1 -1
- 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
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0-sources.jar.sha512 +1 -0
- 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
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.aar.sha512 +1 -0
- 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
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.28.0/detox-legacy-20.28.0.pom.sha512 +1 -0
- package/Detox-android/com/wix/detox-legacy/maven-metadata.xml +4 -4
- package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.md5 +1 -1
- package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha1 +1 -1
- package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha256 +1 -1
- package/Detox-android/com/wix/detox-legacy/maven-metadata.xml.sha512 +1 -1
- package/Detox-ios-framework.tbz +0 -0
- package/Detox-ios-src.tbz +0 -0
- package/Detox-ios-xcuitest.tbz +0 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/EspressoDetox.java +53 -2
- package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +11 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/IsDisplayingAtLeastDetoxMatcher.kt +2 -2
- package/android/detox/src/full/java/com/wix/detox/espresso/web/DetoxWebAtomMatcher.java +6 -9
- package/android/detox/src/full/java/com/wix/detox/espresso/web/WebElement.java +0 -4
- package/detox.d.ts +39 -0
- package/package.json +3 -3
- package/src/android/espressoapi/EspressoDetox.js +83 -0
- package/src/copilot/detoxCopilotFrameworkDriver.js +27 -15
- package/src/devices/runtime/RuntimeDevice.js +11 -0
- package/src/devices/runtime/drivers/DeviceDriverBase.js +8 -0
- package/src/devices/runtime/drivers/android/AndroidDriver.js +16 -0
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +35 -0
- package/src/utils/assertArgument.js +9 -0
- package/src/utils/invocationTraceDescriptions.js +1 -0
- package/src/utils/mapDeviceLongPressArguments.js +56 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha512 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/web/DetoxDriverAtoms.java +0 -642
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
5f9c61888ac541880ca966b9cf54f996
|
@@ -0,0 +1 @@
|
|
1
|
+
905d3c70363af1ef378373c1337b2a02fb085847
|
@@ -0,0 +1 @@
|
|
1
|
+
9da6d1b24a67e2c3f54e4f85b76d2f308df4f4783a2ead715cacae4078d54198
|
@@ -0,0 +1 @@
|
|
1
|
+
488ca79bd9330a788fe0659818e9256d06908d3c9ff765ddf9ee41e253b78dbbb0db1409f794532019fa39ca3395c8a27396398cbe56d203989afb258c31f1b8
|
Binary file
|
@@ -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.
|
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.
|
7
|
-
<release>20.
|
6
|
+
<latest>20.28.0</latest>
|
7
|
+
<release>20.28.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.
|
9
|
+
<version>20.28.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20241114182711</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
4409ef64d1213179048bfd9fed283361
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
112cd653d1f7777391df1fb10e9a33619f5d0c1b
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2177b496977ac272c3b7333fa2a4505f8756dca0bc265970801d60985a6a8dfd
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
da830892bc25886891e341fe7e167f4aa1138c8fc2c28246d31409c39e82aa64f13c0a0a39bb6394a260ee2f449bf16e5378be6026cf1862759d57cec40fd053
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
d01d2e826e3b99f843a7e444d309d6d2
|
@@ -0,0 +1 @@
|
|
1
|
+
3cf94f158d84d98241e421c64cc5c06142fbf4c0
|
@@ -0,0 +1 @@
|
|
1
|
+
cb302fd2cd81b8ba3a03115ab529d073bb8f223af0088e89e22af90120117412
|
@@ -0,0 +1 @@
|
|
1
|
+
37109f12c35e795d76f25a7c462c143dcedbbd0cb66bdde25364f237754da179307e87b73fae67e5432b7724903abe485c5105ac5667a7f6f26806b6c5229d88
|
Binary file
|
@@ -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.
|
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.
|
7
|
-
<release>20.
|
6
|
+
<latest>20.28.0</latest>
|
7
|
+
<release>20.28.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.
|
9
|
+
<version>20.28.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20241114182808</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
dbb9351f570b2e9f79cd97583cda0e41
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
e043135169acc282528cb1990f80ae8be7fd89b2
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
723c473ca26e2ced79ca5d707aa4e96f068d3bb86577a66d54ae5c41231127f2
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5061e8696bf7b07237dd2b8fc02f65054eaaa87884723ca0f706b3b1de63e153e636db8077c6fdfd29ad8d0ca67433ff6a327bf6ffaddf040e671a2cafb4106e
|
package/Detox-ios-framework.tbz
CHANGED
Binary file
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios-xcuitest.tbz
CHANGED
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 =
|
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
|
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
|
19
|
+
return findMultipleElements(Locator.ID, id);
|
23
20
|
}
|
24
21
|
|
25
22
|
public static Atom<List<ElementReference>> matcherForClassName(String className) {
|
26
|
-
return
|
23
|
+
return findMultipleElements(Locator.CLASS_NAME, className);
|
27
24
|
}
|
28
25
|
|
29
26
|
public static Atom<List<ElementReference>> matcherForCssSelector(String cssSelector) {
|
30
|
-
return
|
27
|
+
return findMultipleElements(Locator.CSS_SELECTOR, cssSelector);
|
31
28
|
}
|
32
29
|
|
33
30
|
public static Atom<List<ElementReference>> matcherForName(String name) {
|
34
|
-
return
|
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.
|
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.
|
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": "
|
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;
|