detox 20.27.5 → 20.27.7-smoke.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.5/detox-20.27.5-sources.jar → 20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.27.5/detox-20.27.5.aar → 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 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.27.5/detox-20.27.5.pom → 20.27.7-smoke.0/detox-20.27.7-smoke.0.pom} +1 -1
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.27.7-smoke.0/detox-20.27.7-smoke.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.5/detox-legacy-20.27.5-sources.jar → 20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox-legacy/{20.27.5/detox-legacy-20.27.5.aar → 20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar} +0 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox-legacy/{20.27.5/detox-legacy-20.27.5.pom → 20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom} +1 -1
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.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/web/DetoxDriverAtoms.java +642 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/web/DetoxWebAtomMatcher.java +9 -6
- package/android/detox/src/full/java/com/wix/detox/espresso/web/WebElement.java +4 -0
- package/package.json +2 -2
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.27.5/detox-20.27.5.pom.sha512 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.aar.md5 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.pom.md5 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox-legacy/20.27.5/detox-legacy-20.27.5.pom.sha512 +0 -1
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
390f49d71c399592a5a12dae4d0ba89a
|
@@ -0,0 +1 @@
|
|
1
|
+
bb30d23b09a201006a4d923dffb96a4cb0b44458
|
@@ -0,0 +1 @@
|
|
1
|
+
b3095ae31971d13a41e9225c401066365a7c5c54c0a7313797b7c8818251d569
|
@@ -0,0 +1 @@
|
|
1
|
+
1ca8d245b20bbe78438bbbfc06ac95123dffcaf759d816d6f49a0a4d23989c945686db119fb08967799e7e994e78a7192e7df185d4888e6b5b242a1d0bcd7c8e
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
1a5f2740c1c03528f2d9611aaa4634b6
|
@@ -0,0 +1 @@
|
|
1
|
+
d752c96158c3984c8dfe1cde9ee0b14fbe2ab641
|
@@ -0,0 +1 @@
|
|
1
|
+
3bd563b4fe588be1d4cc5877a0b8464f31a5da309029a4e5703bf5465ee6df2d
|
@@ -0,0 +1 @@
|
|
1
|
+
1682f1d10b78729ebd15fc548860893b9c9585447777ed09e6bf7d5000e85745db9722e2f2d15bee539a2230d8714526d293bb669218e17578cd9461a9dd2446
|
@@ -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.
|
6
|
+
<version>20.27.7-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
|
+
e88738f8b748e72b3381a6e14f7915da
|
@@ -0,0 +1 @@
|
|
1
|
+
75d405e7af82b69cd73b9d990c9b24fb6d909e4a
|
@@ -0,0 +1 @@
|
|
1
|
+
294b1c7cd9cc5eb44f6846594477c422a0fc25e758d3741d61ce85c9c11898a9
|
@@ -0,0 +1 @@
|
|
1
|
+
ab28dbb7a126bdd7cd139f675d1bbe7633555af7e8d73b8449d1532031cbfe331db7e0f56377a6caa09c880b35723d90011c3d1b40890188761461137cc87b15
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<groupId>com.wix</groupId>
|
4
4
|
<artifactId>detox</artifactId>
|
5
5
|
<versioning>
|
6
|
-
<latest>20.27.
|
7
|
-
<release>20.27.
|
6
|
+
<latest>20.27.7-smoke.0</latest>
|
7
|
+
<release>20.27.7-smoke.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.27.
|
9
|
+
<version>20.27.7-smoke.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20241103220531</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
ebda30a3b044d201aaf8fcb02e932cec
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5adda00fd360478449a0754c8f64e7bb3c8e908b
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
b9d1d0f22516176030945e087241218776c394d2084f3d869c783b634af12911
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
fbd2958bf59db3a3305a8af36159033aa962183fc81ef2c43d0f7542b36d9e13b71d7b971a4e33ed958ab57860a1ed2f948d6cdb741420ef3554433f94604a3e
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
cbd254abb70b675f0929c0b3722940d2
|
@@ -0,0 +1 @@
|
|
1
|
+
a781f7f228f72a617c266dc471ae38fe4f83125a
|
@@ -0,0 +1 @@
|
|
1
|
+
f451d882399883eb599d10bd8c59f27f3f48f7b5d9d8b0b64544efcecd2f7e2c
|
@@ -0,0 +1 @@
|
|
1
|
+
a382597f97218664630944f9f014ffbf5dbe2de4a79eec96fb3370c0b418a2fb034b311439b50dc142e38bb2ddce32d049328db0651ae1ccf6316d1afbe7be25
|
Binary file
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.md5
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0bf142d5f16367aa729a059a0157014e
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha1
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
f97c69229516588039e2b4377ce427609242db16
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha256
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
464e93f88371093a2323125b79f3a2a9e97a908614909ff959d2505b971a1150
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.aar.sha512
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
b96a1d21679c252bcf9e8afb71a067eae95fe0716fe9b8e04dd703da9a119f57572f2bf92281f330e301d8683f4cd1ae3ab52a91aec92778ec61514725994b83
|
@@ -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.
|
6
|
+
<version>20.27.7-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>
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.md5
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
86d4c22e728a891a3bd18a58447e720b
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha1
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
fffa571b874d723aa306265eb76fc13d65722655
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha256
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
eca27e544ff60053827726d933d18a00a1cd6d06a24b47a67204b598e3a495b5
|
package/Detox-android/com/wix/detox-legacy/20.27.7-smoke.0/detox-legacy-20.27.7-smoke.0.pom.sha512
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
93aab0e7f56de89d603faafdef30daa99761673ff1aeeb65b3aa968e768ecf8cd82f4867171503044b725f5e47daba016ce50be7156c8c5608abe8253ef2bb30
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<groupId>com.wix</groupId>
|
4
4
|
<artifactId>detox-legacy</artifactId>
|
5
5
|
<versioning>
|
6
|
-
<latest>20.27.
|
7
|
-
<release>20.27.
|
6
|
+
<latest>20.27.7-smoke.0</latest>
|
7
|
+
<release>20.27.7-smoke.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.27.
|
9
|
+
<version>20.27.7-smoke.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20241103220527</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
8404ed177a718520c6436dd71ce039ab
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
b925dca17db41378f169a69df552119e5179d329
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
0c65934b91d9e80b2bed548119d613ef1865249716c95804264e24502938f67f
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
22339987979aa7c84c388216b8be30373bc43193452117b4520a61780d3a37b0991ba554d900c5ed6a66d9722e3437a4bdb686863622e8e3d85eb196be2aee63
|
package/Detox-ios-framework.tbz
CHANGED
Binary file
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios-xcuitest.tbz
CHANGED
Binary file
|
@@ -0,0 +1,642 @@
|
|
1
|
+
package com.wix.detox.espresso.web;
|
2
|
+
|
3
|
+
import static androidx.test.espresso.web.model.Atoms.castOrDie;
|
4
|
+
import static androidx.test.espresso.web.webdriver.Locator.*;
|
5
|
+
import static java.util.Collections.emptyList;
|
6
|
+
import static java.util.Collections.singletonList;
|
7
|
+
import static java.util.Collections.singletonMap;
|
8
|
+
|
9
|
+
import androidx.annotation.VisibleForTesting;
|
10
|
+
import androidx.test.espresso.remote.annotation.RemoteMsgConstructor;
|
11
|
+
import androidx.test.espresso.remote.annotation.RemoteMsgField;
|
12
|
+
import androidx.test.espresso.web.model.Atom;
|
13
|
+
import androidx.test.espresso.web.model.ElementReference;
|
14
|
+
import androidx.test.espresso.web.model.Evaluation;
|
15
|
+
import androidx.test.espresso.web.model.SimpleAtom;
|
16
|
+
import androidx.test.espresso.web.model.TransformingAtom;
|
17
|
+
import androidx.test.espresso.web.model.WindowReference;
|
18
|
+
import androidx.test.espresso.web.webdriver.Locator;
|
19
|
+
|
20
|
+
import java.util.ArrayList;
|
21
|
+
import java.util.Arrays;
|
22
|
+
import java.util.HashMap;
|
23
|
+
import java.util.List;
|
24
|
+
import java.util.Map;
|
25
|
+
|
26
|
+
|
27
|
+
/**
|
28
|
+
* A collection of Javascript Atoms from the WebDriver project.
|
29
|
+
*/
|
30
|
+
public final class DetoxDriverAtoms {
|
31
|
+
|
32
|
+
static Locator forType(String type) {
|
33
|
+
if (CLASS_NAME.getType().equals(type)) {
|
34
|
+
return CLASS_NAME;
|
35
|
+
}
|
36
|
+
if (CSS_SELECTOR.getType().equals(type)) {
|
37
|
+
return CSS_SELECTOR;
|
38
|
+
}
|
39
|
+
if (ID.getType().equals(type)) {
|
40
|
+
return ID;
|
41
|
+
}
|
42
|
+
if (LINK_TEXT.getType().equals(type)) {
|
43
|
+
return LINK_TEXT;
|
44
|
+
}
|
45
|
+
if (NAME.getType().equals(type)) {
|
46
|
+
return NAME;
|
47
|
+
}
|
48
|
+
if (PARTIAL_LINK_TEXT.getType().equals(type)) {
|
49
|
+
return PARTIAL_LINK_TEXT;
|
50
|
+
}
|
51
|
+
if (TAG_NAME.getType().equals(type)) {
|
52
|
+
return TAG_NAME;
|
53
|
+
}
|
54
|
+
if (XPATH.getType().equals(type)) {
|
55
|
+
return XPATH;
|
56
|
+
}
|
57
|
+
throw new IllegalStateException("No Locator enum found for a given type: " + type);
|
58
|
+
}
|
59
|
+
|
60
|
+
private DetoxDriverAtoms() {
|
61
|
+
}
|
62
|
+
|
63
|
+
/**
|
64
|
+
* Simulates the javascript events to click on a particular element.
|
65
|
+
*/
|
66
|
+
public static Atom<Evaluation> webClick() {
|
67
|
+
return new WebClickSimpleAtom();
|
68
|
+
}
|
69
|
+
|
70
|
+
/**
|
71
|
+
* Clears content from an editable element.
|
72
|
+
*/
|
73
|
+
public static Atom<Evaluation> clearElement() {
|
74
|
+
return new ClearElementSimpleAtom();
|
75
|
+
}
|
76
|
+
|
77
|
+
/**
|
78
|
+
* Simulates javascript key events sent to a certain element.
|
79
|
+
*/
|
80
|
+
public static Atom<Evaluation> webKeys(final String text) {
|
81
|
+
return new WebKeysSimpleAtom(text);
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Finds an element using the provided locatorType strategy.
|
86
|
+
*/
|
87
|
+
public static Atom<ElementReference> findElement(final Locator locator, final String value) {
|
88
|
+
return new FindElementTransformingAtom(
|
89
|
+
new FindElementSimpleAtom(locator.getType(), value), castOrDie(ElementReference.class));
|
90
|
+
}
|
91
|
+
|
92
|
+
/**
|
93
|
+
* Finds the currently active element in the document.
|
94
|
+
*/
|
95
|
+
public static Atom<ElementReference> selectActiveElement() {
|
96
|
+
return new SelectActiveElementTransformingAtom(
|
97
|
+
new ActiveElementSimpleAtom(), castOrDie(ElementReference.class));
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Selects a subframe of the currently selected window by it's index.
|
102
|
+
*/
|
103
|
+
public static Atom<WindowReference> selectFrameByIndex(int index) {
|
104
|
+
return new SelectFrameByIndexTransformingAtom(
|
105
|
+
new FrameByIndexSimpleAtom(index), castOrDie(WindowReference.class));
|
106
|
+
}
|
107
|
+
|
108
|
+
/**
|
109
|
+
* Selects a subframe of the given window by it's index.
|
110
|
+
*/
|
111
|
+
public static Atom<WindowReference> selectFrameByIndex(int index, WindowReference root) {
|
112
|
+
return new SelectFrameByIndexTransformingAtom(
|
113
|
+
new FrameByIndexWithRootSimpleAtom(index, root),
|
114
|
+
castOrDie(WindowReference.class));
|
115
|
+
}
|
116
|
+
|
117
|
+
/**
|
118
|
+
* Selects a subframe of the given window by it's name or id.
|
119
|
+
*/
|
120
|
+
public static Atom<WindowReference> selectFrameByIdOrName(String idOrName, WindowReference root) {
|
121
|
+
return new SelectFrameByIdOrNameTransformingAtom(
|
122
|
+
new FrameByIdOrNameWithRootSimpleAtom(idOrName, root),
|
123
|
+
castOrDie(WindowReference.class));
|
124
|
+
}
|
125
|
+
|
126
|
+
/**
|
127
|
+
* Selects a subframe of the current window by it's name or id.
|
128
|
+
*/
|
129
|
+
public static Atom<WindowReference> selectFrameByIdOrName(String idOrName) {
|
130
|
+
return new SelectFrameByIdOrNameTransformingAtom(
|
131
|
+
new FrameByIdOrNameSimpleAtom(idOrName), castOrDie(WindowReference.class));
|
132
|
+
}
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Returns the visible text beneath a given DOM element.
|
136
|
+
*/
|
137
|
+
public static Atom<String> getText() {
|
138
|
+
return new GetTextTransformingAtom(new GetVisibleTextSimpleAtom(), castOrDie(String.class));
|
139
|
+
}
|
140
|
+
|
141
|
+
/**
|
142
|
+
* Returns {@code true} if the desired element is in view after scrolling.
|
143
|
+
*/
|
144
|
+
public static Atom<Boolean> webScrollIntoView() {
|
145
|
+
return new WebScrollIntoViewAtom(new WebScrollIntoViewSimpleAtom(), castOrDie(Boolean.class));
|
146
|
+
}
|
147
|
+
|
148
|
+
/**
|
149
|
+
* Finds multiple elements given a locator strategy.
|
150
|
+
*/
|
151
|
+
public static Atom<List<ElementReference>> findMultipleElementsDetox(
|
152
|
+
final Locator locator, final String value) {
|
153
|
+
|
154
|
+
SimpleAtom findElementsScriptSimpleAtom =
|
155
|
+
new FindElementsScriptSimpleAtom(locator.getType(), value);
|
156
|
+
TransformingAtom.Transformer<Evaluation, List<ElementReference>> elementReferenceListAtom =
|
157
|
+
new ElementReferenceListAtom(locator.getType(), value);
|
158
|
+
|
159
|
+
return new FindMultipleElementsTransformingAtom(
|
160
|
+
findElementsScriptSimpleAtom, elementReferenceListAtom);
|
161
|
+
}
|
162
|
+
|
163
|
+
private static Map<String, String> makeLocatorJSON(Locator locator, String value) {
|
164
|
+
Map<String, String> map = new HashMap<String, String>();
|
165
|
+
map.put(locator.getType(), value);
|
166
|
+
map.put("selector", getSelector(locator, value));
|
167
|
+
return map;
|
168
|
+
}
|
169
|
+
|
170
|
+
private static String getSelector(Locator type, String value) {
|
171
|
+
switch (type) {
|
172
|
+
case ID:
|
173
|
+
return "#" + value;
|
174
|
+
|
175
|
+
case CLASS_NAME:
|
176
|
+
return "." + value;
|
177
|
+
|
178
|
+
case LINK_TEXT:
|
179
|
+
return "a[href=\"" + value + "\"]";
|
180
|
+
|
181
|
+
case PARTIAL_LINK_TEXT:
|
182
|
+
return "a[href*=\"" + value + "\"]";
|
183
|
+
|
184
|
+
case CSS_SELECTOR:
|
185
|
+
return value;
|
186
|
+
|
187
|
+
case NAME:
|
188
|
+
return "[name=\"" + value + "\"]";
|
189
|
+
|
190
|
+
case TAG_NAME:
|
191
|
+
return value;
|
192
|
+
|
193
|
+
case XPATH:
|
194
|
+
throw new IllegalArgumentException("XPath should be handled separately");
|
195
|
+
|
196
|
+
default:
|
197
|
+
throw new IllegalArgumentException("Unknown Locator type: " + type);
|
198
|
+
}
|
199
|
+
}
|
200
|
+
|
201
|
+
@VisibleForTesting
|
202
|
+
static final class FindElementSimpleAtom extends SimpleAtom {
|
203
|
+
@RemoteMsgField(order = 0)
|
204
|
+
final String locatorType;
|
205
|
+
|
206
|
+
@RemoteMsgField(order = 1)
|
207
|
+
final String value;
|
208
|
+
|
209
|
+
@RemoteMsgConstructor
|
210
|
+
FindElementSimpleAtom(String locatorType, String value) {
|
211
|
+
super("", SimpleAtom.ElementReferencePlacement.LAST);
|
212
|
+
this.locatorType = locatorType;
|
213
|
+
this.value = value;
|
214
|
+
}
|
215
|
+
|
216
|
+
@Override
|
217
|
+
protected List<Object> getNonContextualArguments() {
|
218
|
+
final Map<String, String> locatorJson = makeLocatorJSON(forType(locatorType), value);
|
219
|
+
return singletonList(locatorJson);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
@VisibleForTesting
|
224
|
+
static final class FindElementTransformingAtom
|
225
|
+
extends TransformingAtom<Evaluation, ElementReference> {
|
226
|
+
@SuppressWarnings("unused") // called reflectively
|
227
|
+
@RemoteMsgField(order = 0)
|
228
|
+
private final Atom<Evaluation> findElementSimpleAtom;
|
229
|
+
|
230
|
+
@SuppressWarnings("unused") // called reflectively
|
231
|
+
@RemoteMsgField(order = 1)
|
232
|
+
private final TransformingAtom.Transformer<Evaluation, ElementReference> castOrDieAtom;
|
233
|
+
|
234
|
+
@RemoteMsgConstructor
|
235
|
+
private FindElementTransformingAtom(
|
236
|
+
Atom<Evaluation> findElementSimpleAtom,
|
237
|
+
TransformingAtom.Transformer<Evaluation, ElementReference> castOrDieAtom) {
|
238
|
+
super(findElementSimpleAtom, castOrDieAtom);
|
239
|
+
this.findElementSimpleAtom = findElementSimpleAtom;
|
240
|
+
this.castOrDieAtom = castOrDieAtom;
|
241
|
+
}
|
242
|
+
}
|
243
|
+
|
244
|
+
@VisibleForTesting
|
245
|
+
static final class ClearElementSimpleAtom extends SimpleAtom {
|
246
|
+
@RemoteMsgConstructor
|
247
|
+
private ClearElementSimpleAtom() {
|
248
|
+
super("");
|
249
|
+
}
|
250
|
+
|
251
|
+
@Override
|
252
|
+
public void handleNoElementReference() {
|
253
|
+
throw new RuntimeException("clearElement: Need an element to clear!");
|
254
|
+
}
|
255
|
+
}
|
256
|
+
|
257
|
+
@VisibleForTesting
|
258
|
+
static final class WebKeysSimpleAtom extends SimpleAtom {
|
259
|
+
@RemoteMsgField(order = 0)
|
260
|
+
private final String text;
|
261
|
+
|
262
|
+
@RemoteMsgConstructor
|
263
|
+
private WebKeysSimpleAtom(String text) {
|
264
|
+
super("");
|
265
|
+
this.text = text;
|
266
|
+
}
|
267
|
+
|
268
|
+
@Override
|
269
|
+
public void handleNoElementReference() {
|
270
|
+
throw new RuntimeException("webKeys: Need an element to type on!");
|
271
|
+
}
|
272
|
+
|
273
|
+
@Override
|
274
|
+
public List<Object> getNonContextualArguments() {
|
275
|
+
return singletonList(text);
|
276
|
+
}
|
277
|
+
}
|
278
|
+
|
279
|
+
@VisibleForTesting
|
280
|
+
static final class WebScrollIntoViewAtom extends TransformingAtom<Evaluation, Boolean> {
|
281
|
+
@SuppressWarnings("unused") // called reflectively
|
282
|
+
@RemoteMsgField(order = 0)
|
283
|
+
private final Atom<Evaluation> scrollIntoViewSimpleAtom;
|
284
|
+
|
285
|
+
@SuppressWarnings("unused") // called reflectively
|
286
|
+
@RemoteMsgField(order = 1)
|
287
|
+
private final TransformingAtom.Transformer<Evaluation, Boolean> castOrDieAtom;
|
288
|
+
|
289
|
+
@RemoteMsgConstructor
|
290
|
+
private WebScrollIntoViewAtom(
|
291
|
+
Atom<Evaluation> scrollIntoViewSimpleAtom,
|
292
|
+
TransformingAtom.Transformer<Evaluation, Boolean> castOrDieAtom) {
|
293
|
+
super(scrollIntoViewSimpleAtom, castOrDieAtom);
|
294
|
+
this.scrollIntoViewSimpleAtom = scrollIntoViewSimpleAtom;
|
295
|
+
this.castOrDieAtom = castOrDieAtom;
|
296
|
+
}
|
297
|
+
}
|
298
|
+
|
299
|
+
static final class WebScrollIntoViewSimpleAtom extends SimpleAtom {
|
300
|
+
@RemoteMsgConstructor
|
301
|
+
private WebScrollIntoViewSimpleAtom() {
|
302
|
+
super("");
|
303
|
+
}
|
304
|
+
|
305
|
+
@Override
|
306
|
+
public void handleNoElementReference() {
|
307
|
+
throw new RuntimeException("scrollIntoView: need an element to scroll to");
|
308
|
+
}
|
309
|
+
}
|
310
|
+
|
311
|
+
@VisibleForTesting
|
312
|
+
static final class WebClickSimpleAtom extends SimpleAtom {
|
313
|
+
@RemoteMsgConstructor
|
314
|
+
private WebClickSimpleAtom() {
|
315
|
+
super("");
|
316
|
+
}
|
317
|
+
|
318
|
+
@Override
|
319
|
+
public void handleNoElementReference() {
|
320
|
+
throw new RuntimeException("webClick: Need an element to click on!");
|
321
|
+
}
|
322
|
+
}
|
323
|
+
|
324
|
+
@VisibleForTesting
|
325
|
+
static final class GetTextTransformingAtom extends TransformingAtom<Evaluation, String> {
|
326
|
+
@SuppressWarnings("unused") // called reflectively
|
327
|
+
@RemoteMsgField(order = 0)
|
328
|
+
private final Atom<Evaluation> getTextSimpleAtom;
|
329
|
+
|
330
|
+
@SuppressWarnings("unused") // called reflectively
|
331
|
+
@RemoteMsgField(order = 1)
|
332
|
+
private final TransformingAtom.Transformer<Evaluation, String> castOrDieAtom;
|
333
|
+
|
334
|
+
@RemoteMsgConstructor
|
335
|
+
private GetTextTransformingAtom(
|
336
|
+
Atom<Evaluation> findElementSimpleAtom,
|
337
|
+
TransformingAtom.Transformer<Evaluation, String> castOrDieAtom) {
|
338
|
+
super(findElementSimpleAtom, castOrDieAtom);
|
339
|
+
this.getTextSimpleAtom = findElementSimpleAtom;
|
340
|
+
this.castOrDieAtom = castOrDieAtom;
|
341
|
+
}
|
342
|
+
}
|
343
|
+
|
344
|
+
@VisibleForTesting
|
345
|
+
static final class GetVisibleTextSimpleAtom extends SimpleAtom {
|
346
|
+
@RemoteMsgConstructor
|
347
|
+
private GetVisibleTextSimpleAtom() {
|
348
|
+
super("");
|
349
|
+
}
|
350
|
+
}
|
351
|
+
|
352
|
+
@VisibleForTesting
|
353
|
+
static final class ActiveElementSimpleAtom extends SimpleAtom {
|
354
|
+
@RemoteMsgConstructor
|
355
|
+
private ActiveElementSimpleAtom() {
|
356
|
+
super("");
|
357
|
+
}
|
358
|
+
}
|
359
|
+
|
360
|
+
@VisibleForTesting
|
361
|
+
static final class SelectActiveElementTransformingAtom
|
362
|
+
extends TransformingAtom<Evaluation, ElementReference> {
|
363
|
+
@SuppressWarnings("unused") // called reflectively
|
364
|
+
@RemoteMsgField(order = 0)
|
365
|
+
private final Atom<Evaluation> selectActiveElementSimpleAtom;
|
366
|
+
|
367
|
+
@SuppressWarnings("unused") // called reflectively
|
368
|
+
@RemoteMsgField(order = 1)
|
369
|
+
private final TransformingAtom.Transformer<Evaluation, ElementReference> castOrDieAtom;
|
370
|
+
|
371
|
+
@RemoteMsgConstructor
|
372
|
+
private SelectActiveElementTransformingAtom(
|
373
|
+
Atom<Evaluation> selectActiveElementSimpleAtom,
|
374
|
+
TransformingAtom.Transformer<Evaluation, ElementReference> castOrDieAtom) {
|
375
|
+
super(selectActiveElementSimpleAtom, castOrDieAtom);
|
376
|
+
this.selectActiveElementSimpleAtom = selectActiveElementSimpleAtom;
|
377
|
+
this.castOrDieAtom = castOrDieAtom;
|
378
|
+
}
|
379
|
+
}
|
380
|
+
|
381
|
+
@VisibleForTesting
|
382
|
+
static final class FrameByIndexSimpleAtom extends SimpleAtom {
|
383
|
+
@RemoteMsgField(order = 0)
|
384
|
+
private final int index;
|
385
|
+
|
386
|
+
@RemoteMsgConstructor
|
387
|
+
private FrameByIndexSimpleAtom(int index) {
|
388
|
+
super("");
|
389
|
+
this.index = index;
|
390
|
+
}
|
391
|
+
|
392
|
+
@Override
|
393
|
+
public List<Object> getNonContextualArguments() {
|
394
|
+
return singletonList(index);
|
395
|
+
}
|
396
|
+
}
|
397
|
+
|
398
|
+
@VisibleForTesting
|
399
|
+
static final class FrameByIndexWithRootSimpleAtom extends SimpleAtom {
|
400
|
+
@RemoteMsgField(order = 0)
|
401
|
+
private final int index;
|
402
|
+
|
403
|
+
@RemoteMsgField(order = 1)
|
404
|
+
private final WindowReference root;
|
405
|
+
|
406
|
+
@RemoteMsgConstructor
|
407
|
+
private FrameByIndexWithRootSimpleAtom(int index, WindowReference root) {
|
408
|
+
super("");
|
409
|
+
this.index = index;
|
410
|
+
this.root = root;
|
411
|
+
}
|
412
|
+
|
413
|
+
@Override
|
414
|
+
public List<Object> getNonContextualArguments() {
|
415
|
+
return Arrays.asList(index, root);
|
416
|
+
}
|
417
|
+
}
|
418
|
+
|
419
|
+
@VisibleForTesting
|
420
|
+
static final class SelectFrameByIndexTransformingAtom
|
421
|
+
extends TransformingAtom<Evaluation, WindowReference> {
|
422
|
+
@SuppressWarnings("unused") // called reflectively
|
423
|
+
@RemoteMsgField(order = 0)
|
424
|
+
private final Atom<Evaluation> frameByIndexSimpleAtom;
|
425
|
+
|
426
|
+
@SuppressWarnings("unused") // called reflectively
|
427
|
+
@RemoteMsgField(order = 1)
|
428
|
+
private final TransformingAtom.Transformer<Evaluation, WindowReference> castOrDieAtom;
|
429
|
+
|
430
|
+
@RemoteMsgConstructor
|
431
|
+
private SelectFrameByIndexTransformingAtom(
|
432
|
+
Atom<Evaluation> selectActiveElementSimpleAtom,
|
433
|
+
TransformingAtom.Transformer<Evaluation, WindowReference> castOrDieAtom) {
|
434
|
+
super(selectActiveElementSimpleAtom, castOrDieAtom);
|
435
|
+
this.frameByIndexSimpleAtom = selectActiveElementSimpleAtom;
|
436
|
+
this.castOrDieAtom = castOrDieAtom;
|
437
|
+
}
|
438
|
+
}
|
439
|
+
|
440
|
+
@VisibleForTesting
|
441
|
+
static final class FrameByIdOrNameSimpleAtom extends SimpleAtom {
|
442
|
+
@RemoteMsgField(order = 0)
|
443
|
+
private final String idOrName;
|
444
|
+
|
445
|
+
@RemoteMsgConstructor
|
446
|
+
private FrameByIdOrNameSimpleAtom(String idOrName) {
|
447
|
+
super("");
|
448
|
+
this.idOrName = idOrName;
|
449
|
+
}
|
450
|
+
|
451
|
+
@Override
|
452
|
+
public List<Object> getNonContextualArguments() {
|
453
|
+
return singletonList(idOrName);
|
454
|
+
}
|
455
|
+
}
|
456
|
+
|
457
|
+
@VisibleForTesting
|
458
|
+
static final class FrameByIdOrNameWithRootSimpleAtom extends SimpleAtom {
|
459
|
+
@SuppressWarnings("unused") // called reflectively
|
460
|
+
@RemoteMsgField(order = 0)
|
461
|
+
private final String idOrName;
|
462
|
+
|
463
|
+
@SuppressWarnings("unused") // called reflectively
|
464
|
+
@RemoteMsgField(order = 1)
|
465
|
+
private final WindowReference root;
|
466
|
+
|
467
|
+
@RemoteMsgConstructor
|
468
|
+
private FrameByIdOrNameWithRootSimpleAtom(String idOrName, WindowReference root) {
|
469
|
+
super("");
|
470
|
+
this.idOrName = idOrName;
|
471
|
+
this.root = root;
|
472
|
+
}
|
473
|
+
|
474
|
+
@Override
|
475
|
+
public List<Object> getNonContextualArguments() {
|
476
|
+
return Arrays.asList(idOrName, root);
|
477
|
+
}
|
478
|
+
}
|
479
|
+
|
480
|
+
@VisibleForTesting
|
481
|
+
static final class SelectFrameByIdOrNameTransformingAtom
|
482
|
+
extends TransformingAtom<Evaluation, WindowReference> {
|
483
|
+
@SuppressWarnings("unused") // called reflectively
|
484
|
+
@RemoteMsgField(order = 0)
|
485
|
+
private final Atom<Evaluation> frameByIndexOrNameSimpleAtom;
|
486
|
+
|
487
|
+
@SuppressWarnings("unused") // called reflectively
|
488
|
+
@RemoteMsgField(order = 1)
|
489
|
+
private final TransformingAtom.Transformer<Evaluation, WindowReference> castOrDieAtom;
|
490
|
+
|
491
|
+
@RemoteMsgConstructor
|
492
|
+
private SelectFrameByIdOrNameTransformingAtom(
|
493
|
+
Atom<Evaluation> selectActiveElementSimpleAtom,
|
494
|
+
TransformingAtom.Transformer<Evaluation, WindowReference> castOrDieAtom) {
|
495
|
+
super(selectActiveElementSimpleAtom, castOrDieAtom);
|
496
|
+
this.frameByIndexOrNameSimpleAtom = selectActiveElementSimpleAtom;
|
497
|
+
this.castOrDieAtom = castOrDieAtom;
|
498
|
+
}
|
499
|
+
}
|
500
|
+
|
501
|
+
// static String jsFunction =
|
502
|
+
// "const findElementsInWebView = function (args) {\n" +
|
503
|
+
// "console.log('findElementsInWebView' + JSON.stringify(args));" +
|
504
|
+
// " if (!args || typeof args !== 'object') {\n" +
|
505
|
+
// " throw new Error(\"Invalid arguments. Expected an object with selector type keys.\");\n" +
|
506
|
+
// " }\n" +
|
507
|
+
// "\n" +
|
508
|
+
// " // Check if a specific key is provided in the arguments and use the appropriate selector\n" +
|
509
|
+
// " if (args.className) {\n" +
|
510
|
+
// " return Array.from(document.getElementsByClassName(args.className));\n" +
|
511
|
+
// " } else if (args.id) {\n" +
|
512
|
+
// " const element = document.getElementById(args.id);\n" +
|
513
|
+
// " return element ? [element] : [];\n" +
|
514
|
+
// " } else if (args.tagName) {\n" +
|
515
|
+
// " return Array.from(document.getElementsByTagName(args.tagName));\n" +
|
516
|
+
// " } else if (args.xpath) {\n" +
|
517
|
+
// " const result = [];\n" +
|
518
|
+
// " const nodesSnapshot = document.evaluate(args.xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n" +
|
519
|
+
// " for (let i = 0; i < nodesSnapshot.snapshotLength; i++) {\n" +
|
520
|
+
// " result.push(nodesSnapshot.snapshotItem(i));\n" +
|
521
|
+
// " }\n" +
|
522
|
+
// " return result;\n" +
|
523
|
+
// " } else {\n" +
|
524
|
+
// " throw new Error(\"Unsupported selector type. Expected one of: className, id, tagName, xpath.\");\n" +
|
525
|
+
// " }\n" +
|
526
|
+
// "};" +
|
527
|
+
// "console.time('findElementsInWebView');" +
|
528
|
+
// "var result = findElementsInWebView(arguments[0]);" +
|
529
|
+
// "console.timeEnd('findElementsInWebView');" +
|
530
|
+
// "return result;";
|
531
|
+
|
532
|
+
static String jsFunction =
|
533
|
+
"console.log('getAllElements:' + arguments[0]);" +
|
534
|
+
"\tvar getAllElements = function(doc, selector) {\n" +
|
535
|
+
"\t\tvar elements = Array.from(doc.querySelectorAll(selector));\n" +
|
536
|
+
"\t\tvar frames = doc.querySelectorAll('iframe');\n" +
|
537
|
+
"\t\tfor (var i = 0; i < frames.length; i++) {\n" +
|
538
|
+
"\t\t\ttry {\n" +
|
539
|
+
"\t\t\t\tvar frameDoc = frames[i].contentDocument || frames[i].contentWindow.document;\n" +
|
540
|
+
"\t\t\t\tvar frameElements = getAllElements(frameDoc, selector);\n" +
|
541
|
+
"\t\t\t\telements = elements.concat(frameElements);\n" +
|
542
|
+
"\t\t\t} catch(e) {\n" +
|
543
|
+
"\t\t\t\t/* Probably issues accessing iframe documents (CORS restrictions) */\n" +
|
544
|
+
"\t\t\t}\n" +
|
545
|
+
"\t\t}\n" +
|
546
|
+
"\n" +
|
547
|
+
"\t\treturn elements;\n" +
|
548
|
+
"\t};\n" +
|
549
|
+
"console.time('findElementsInWebView');" +
|
550
|
+
"\tvar allElements = getAllElements(document, arguments[0].selector);\n" +
|
551
|
+
"console.timeEnd('findElementsInWebView');" +
|
552
|
+
"\treturn allElements;";
|
553
|
+
|
554
|
+
|
555
|
+
@VisibleForTesting
|
556
|
+
static final class FindElementsScriptSimpleAtom extends SimpleAtom {
|
557
|
+
@RemoteMsgField(order = 0)
|
558
|
+
final String locatorType;
|
559
|
+
|
560
|
+
@RemoteMsgField(order = 1)
|
561
|
+
final String value;
|
562
|
+
|
563
|
+
@RemoteMsgConstructor
|
564
|
+
private FindElementsScriptSimpleAtom(String locatorType, String value) {
|
565
|
+
super(jsFunction);
|
566
|
+
this.locatorType = locatorType;
|
567
|
+
this.value = value;
|
568
|
+
}
|
569
|
+
|
570
|
+
@Override
|
571
|
+
public List<Object> getNonContextualArguments() {
|
572
|
+
return singletonList(makeLocatorJSON(forType(locatorType), value));
|
573
|
+
}
|
574
|
+
}
|
575
|
+
|
576
|
+
@VisibleForTesting
|
577
|
+
static final class FindMultipleElementsTransformingAtom
|
578
|
+
extends TransformingAtom<Evaluation, List<ElementReference>> {
|
579
|
+
@SuppressWarnings("unused") // called reflectively
|
580
|
+
@RemoteMsgField(order = 0)
|
581
|
+
private final Atom<Evaluation> findElementsScriptSimpleAtom;
|
582
|
+
|
583
|
+
@SuppressWarnings("unused") // called reflectively
|
584
|
+
@RemoteMsgField(order = 1)
|
585
|
+
private final TransformingAtom.Transformer<Evaluation, List<ElementReference>>
|
586
|
+
elementReferenceListAtom;
|
587
|
+
|
588
|
+
@RemoteMsgConstructor
|
589
|
+
private FindMultipleElementsTransformingAtom(
|
590
|
+
Atom<Evaluation> findElementsScriptSimpleAtom,
|
591
|
+
TransformingAtom.Transformer<Evaluation, List<ElementReference>> elementReferenceListAtom) {
|
592
|
+
super(findElementsScriptSimpleAtom, elementReferenceListAtom);
|
593
|
+
this.findElementsScriptSimpleAtom = findElementsScriptSimpleAtom;
|
594
|
+
this.elementReferenceListAtom = elementReferenceListAtom;
|
595
|
+
}
|
596
|
+
}
|
597
|
+
|
598
|
+
static final class ElementReferenceListAtom
|
599
|
+
implements TransformingAtom.Transformer<Evaluation, List<ElementReference>> {
|
600
|
+
|
601
|
+
@RemoteMsgField(order = 0)
|
602
|
+
final String locatorType;
|
603
|
+
|
604
|
+
@RemoteMsgField(order = 1)
|
605
|
+
final String value;
|
606
|
+
|
607
|
+
@RemoteMsgConstructor
|
608
|
+
private ElementReferenceListAtom(String locatorType, String value) {
|
609
|
+
this.locatorType = locatorType;
|
610
|
+
this.value = value;
|
611
|
+
}
|
612
|
+
|
613
|
+
@Override
|
614
|
+
public List<ElementReference> apply(Evaluation e) {
|
615
|
+
Object rawValues = e.getValue();
|
616
|
+
if (null == rawValues) {
|
617
|
+
return emptyList();
|
618
|
+
}
|
619
|
+
if (rawValues instanceof Iterable) {
|
620
|
+
List<ElementReference> references = new ArrayList<>();
|
621
|
+
for (Object rawValue : ((Iterable) rawValues)) {
|
622
|
+
if (rawValue instanceof ElementReference) {
|
623
|
+
references.add((ElementReference) rawValue);
|
624
|
+
} else {
|
625
|
+
throw new RuntimeException(
|
626
|
+
String.format(
|
627
|
+
"Unexpected non-elementReference in findMultipleElements(%s, %s): "
|
628
|
+
+ "(%s) all: %s ",
|
629
|
+
forType(locatorType).name(), value, rawValue, e));
|
630
|
+
}
|
631
|
+
}
|
632
|
+
return references;
|
633
|
+
} else {
|
634
|
+
throw new RuntimeException(
|
635
|
+
String.format(
|
636
|
+
"Unexpected non-iterableType in findMultipleElements(%s, %s): "
|
637
|
+
+ "return evaluation: %s ",
|
638
|
+
forType(locatorType).name(), value, e));
|
639
|
+
}
|
640
|
+
}
|
641
|
+
}
|
642
|
+
}
|
@@ -1,13 +1,16 @@
|
|
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
|
+
|
4
8
|
import androidx.test.espresso.web.model.Atom;
|
5
9
|
import androidx.test.espresso.web.model.ElementReference;
|
6
10
|
import androidx.test.espresso.web.webdriver.Locator;
|
7
11
|
|
8
12
|
import java.util.List;
|
9
13
|
|
10
|
-
import static androidx.test.espresso.web.webdriver.DriverAtoms.findMultipleElements;
|
11
14
|
|
12
15
|
public class DetoxWebAtomMatcher {
|
13
16
|
|
@@ -16,19 +19,19 @@ public class DetoxWebAtomMatcher {
|
|
16
19
|
}
|
17
20
|
|
18
21
|
public static Atom<List<ElementReference>> matcherForId(String id) {
|
19
|
-
return
|
22
|
+
return findMultipleElementsDetox(Locator.ID, id);
|
20
23
|
}
|
21
24
|
|
22
25
|
public static Atom<List<ElementReference>> matcherForClassName(String className) {
|
23
|
-
return
|
26
|
+
return findMultipleElementsDetox(Locator.CLASS_NAME, className);
|
24
27
|
}
|
25
28
|
|
26
29
|
public static Atom<List<ElementReference>> matcherForCssSelector(String cssSelector) {
|
27
|
-
return
|
30
|
+
return findMultipleElementsDetox(Locator.CSS_SELECTOR, cssSelector);
|
28
31
|
}
|
29
32
|
|
30
33
|
public static Atom<List<ElementReference>> matcherForName(String name) {
|
31
|
-
return
|
34
|
+
return findMultipleElementsDetox(Locator.NAME, name);
|
32
35
|
}
|
33
36
|
|
34
37
|
public static Atom<List<ElementReference>> matcherForXPath(String xpath) {
|
@@ -46,4 +49,4 @@ public class DetoxWebAtomMatcher {
|
|
46
49
|
public static Atom<List<ElementReference>> matcherForTagName(String tag) {
|
47
50
|
return findMultipleElements(Locator.TAG_NAME, tag);
|
48
51
|
}
|
49
|
-
}
|
52
|
+
}
|
@@ -1,5 +1,7 @@
|
|
1
1
|
package com.wix.detox.espresso.web;
|
2
2
|
|
3
|
+
import android.util.Log;
|
4
|
+
|
3
5
|
import androidx.test.espresso.web.model.Atom;
|
4
6
|
import androidx.test.espresso.web.model.Atoms;
|
5
7
|
import androidx.test.espresso.web.model.ElementReference;
|
@@ -29,7 +31,9 @@ public class WebElement {
|
|
29
31
|
}
|
30
32
|
|
31
33
|
ElementReference get() {
|
34
|
+
long timestamp = System.currentTimeMillis();
|
32
35
|
List<ElementReference> elements = getWebViewInteraction().withTimeout(30, TimeUnit.SECONDS).perform(matcherAtom).get();
|
36
|
+
Log.d("WebElement", "Time taken to get element: " + (System.currentTimeMillis() - timestamp) + "ms");
|
33
37
|
|
34
38
|
if (elements == null || elements.size() == 0 || index >= elements.size()) {
|
35
39
|
throw new RuntimeException(String.format("element was not found at index: %d", index));
|
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.
|
4
|
+
"version": "20.27.7-smoke.0",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -116,5 +116,5 @@
|
|
116
116
|
"browserslist": [
|
117
117
|
"node 14"
|
118
118
|
],
|
119
|
-
"gitHead": "
|
119
|
+
"gitHead": "339b51c8b014686628fff6f695b3d79ccf555a12"
|
120
120
|
}
|
@@ -1 +0,0 @@
|
|
1
|
-
ed8055755410772bb4b04e209912264a
|
@@ -1 +0,0 @@
|
|
1
|
-
b8a7e192a47c0ba31fd4124af9a45c26fcb85f25
|
@@ -1 +0,0 @@
|
|
1
|
-
69ce4a9d22f85708fe320bab219a49f1e9f14de5230a3fb3f77a29cba8a4cadf
|
@@ -1 +0,0 @@
|
|
1
|
-
d39e3765fd3397f48c60d8e985c2335f72490b034cb684c6149a5b442a848bebedc396e6fe852f41429075eb2256163078c1f425379f3dda6c74e6c056934626
|
@@ -1 +0,0 @@
|
|
1
|
-
cf8dd3a0b09c20f6536c73bb9b643c19
|
@@ -1 +0,0 @@
|
|
1
|
-
087bb87ec12653d348901f95966ed16f46f870b2
|
@@ -1 +0,0 @@
|
|
1
|
-
77ee8830fdf301ef8a7895575a4f0f3b76db9614b61942979b73d3b5001fac57
|
@@ -1 +0,0 @@
|
|
1
|
-
3eb1ffc33ecae7c14b6ff36a525abacb4aa05f6d05083d2dc79bad26b63badecc5d22d45bf7dc97cc90804e4245db826e14c86d86fa49540be209708a6f854d1
|
@@ -1 +0,0 @@
|
|
1
|
-
677c6313b77ecca3283152fe3cb5178d
|
@@ -1 +0,0 @@
|
|
1
|
-
37e01b076ec27c02c8d839485afcd93eeb207a6a
|
@@ -1 +0,0 @@
|
|
1
|
-
937e332ef0ae5be7d6023cde1703d1f3d794e4576f10ce604fd0bd479cad4598
|
@@ -1 +0,0 @@
|
|
1
|
-
a78f01ffb28775259e201cb33a533ac51361d20308c92a850cb3fecc7d270ded2e529a97b980c717419e3f2167555d761393462cb05a78b733274394eb6467ec
|
@@ -1 +0,0 @@
|
|
1
|
-
f816c44298ef1e7ad846ca912016193d
|
@@ -1 +0,0 @@
|
|
1
|
-
4ce1719c63d147c18f0ed5bea8754063b07b2263
|
@@ -1 +0,0 @@
|
|
1
|
-
97abc1e3087f173b1ede28d948a1a6f05a5ec708a602ec89bbb10bea97e890ef
|
@@ -1 +0,0 @@
|
|
1
|
-
99b24c91ac32ff6148553845a6b56ba37c9f7e77717eb59c779e78deea5d8047769b19bc5f6ecae23f63963c8bdfcc69f1fe21038e07a31262e41a7eae4b7cac
|
@@ -1 +0,0 @@
|
|
1
|
-
768c2187e364924f92a9b6ccf3c7d0a2
|
@@ -1 +0,0 @@
|
|
1
|
-
7e17fc60050feb2ea5e7dc9a93bf8b2fba13486d
|
@@ -1 +0,0 @@
|
|
1
|
-
a64ce40bbbf3b827d598206f3829f34072b1d6bcd0115d930e7aabadf7477534
|
@@ -1 +0,0 @@
|
|
1
|
-
60d8f60ededcfdd91034b452971b511a40a99a5a4afb42ae6fa88261cf5d29b8493b824eb2e8f453653bf723668b417943177f02fb0dcc9d58501563e7c10b54
|
@@ -1 +0,0 @@
|
|
1
|
-
d734cbe76dacc5b8e6377537eac7277a
|
@@ -1 +0,0 @@
|
|
1
|
-
f0cd51ba37626811bb74d3f2c02e01e63c8806fc
|
@@ -1 +0,0 @@
|
|
1
|
-
613e6c3b82393253f42ddfaef259500c2fe2e6fdead2dd8581fd5bf26a4bccd3
|
@@ -1 +0,0 @@
|
|
1
|
-
a1cce202047d5da041dfce87deeeadec90037990fdac8cc04012d9cc29ad922ebc0fcc012a7cb24c74d296f7e2889e4e8fde922c03ebfc6d66b197bfe4f0190d
|