detox 20.12.1 → 20.13.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.12.1/detox-20.12.1-javadoc.jar → 20.13.0/detox-20.13.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.12.1/detox-20.12.1-sources.jar → 20.13.0/detox-20.13.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.12.1/detox-20.12.1.pom → 20.13.0/detox-20.13.0.pom} +1 -7
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.13.0/detox-20.13.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-ios-src.tbz +0 -0
- package/Detox-ios.tbz +0 -0
- package/android/detox/build.gradle +4 -3
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +2 -2
- package/android/detox/src/full/java/com/wix/detox/espresso/action/GetAttributesAction.kt +30 -31
- package/android/detox/src/full/java/com/wix/detox/espresso/common/MaterialSliderHelper.kt +21 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/common/{SliderHelper.kt → ReactSliderHelper.kt} +6 -5
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +2 -2
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/MaterialSliderHelperTest.kt +33 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/{SliderHelperTest.kt → ReactSliderHelperTest.kt} +3 -3
- package/internals.d.ts +10 -1
- package/local-cli/reset-lock-file.js +5 -9
- package/package.json +5 -6
- package/runners/jest/reporters/DetoxReporter.js +127 -9
- package/runners/jest/testEnvironment/index.js +5 -0
- package/src/DetoxWorker.js +5 -11
- package/src/artifacts/providers/index.js +3 -3
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +0 -17
- package/src/configuration/composeLoggerConfig.js +1 -0
- package/src/devices/allocation/DeviceAllocator.js +66 -20
- package/src/devices/allocation/DeviceList.js +44 -0
- package/src/devices/allocation/DeviceRegistry.js +189 -0
- package/src/devices/allocation/drivers/AllocationDriverBase.d.ts +15 -0
- package/src/devices/{common/drivers/android/tools → allocation/drivers/android}/FreeDeviceFinder.js +11 -10
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidAllocDriver.js +22 -17
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +97 -38
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +32 -45
- package/src/devices/allocation/drivers/android/emulator/FreeEmulatorFinder.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/FreePortFinder.js +37 -0
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +3 -3
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +104 -32
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceLauncher.js +40 -31
- package/src/devices/allocation/drivers/android/genycloud/GenyRegistry.js +121 -0
- package/src/devices/allocation/drivers/android/genycloud/services/GenyInstanceLifecycleService.js +24 -0
- package/src/devices/{common → allocation}/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/services/dto/GenyInstance.js +83 -0
- package/src/devices/allocation/drivers/android/genycloud/services/dto/GenyRecipe.js +25 -0
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +94 -51
- package/src/devices/allocation/drivers/ios/SimulatorLauncher.js +11 -7
- package/src/devices/allocation/drivers/ios/SimulatorQuery.js +24 -0
- package/src/devices/allocation/factories/android.js +29 -35
- package/src/devices/allocation/factories/ios.js +7 -5
- package/src/devices/common/drivers/DeviceCookie.d.ts +12 -0
- package/src/devices/common/drivers/android/cookies.d.ts +11 -0
- package/src/devices/common/drivers/android/emulator/exec/EmulatorExec.js +17 -5
- package/src/devices/common/drivers/android/exec/ADB.js +1 -0
- package/src/devices/common/drivers/ios/cookies.d.ts +9 -0
- package/src/devices/cookies/index.js +0 -6
- package/src/devices/runtime/drivers/android/genycloud/GenyCloudDriver.js +7 -6
- package/src/devices/runtime/factories/android.js +3 -11
- package/src/devices/runtime/factories/ios.js +3 -2
- package/src/{servicelocator → devices/servicelocator}/android/emulatorServiceLocator.js +1 -1
- package/src/devices/servicelocator/android/genycloudServiceLocator.js +17 -0
- package/src/devices/servicelocator/android/index.js +23 -0
- package/src/{validation → devices/validation}/EnvironmentValidatorBase.js +1 -0
- package/src/{validation → devices/validation}/android/GenycloudEnvValidator.js +2 -2
- package/src/{validation → devices/validation}/factories/index.js +1 -1
- package/src/{validation → devices/validation}/ios/IosSimulatorEnvValidator.js +2 -2
- package/src/environmentFactory.js +1 -11
- package/src/ipc/IPCClient.js +22 -1
- package/src/ipc/IPCServer.js +40 -1
- package/src/ipc/SessionState.js +1 -0
- package/src/logger/DetoxLogger.js +2 -2
- package/src/realms/DetoxContext.js +8 -0
- package/src/realms/DetoxInternalsFacade.js +1 -0
- package/src/realms/DetoxPrimaryContext.js +48 -42
- package/src/realms/DetoxSecondaryContext.js +27 -0
- package/src/realms/symbols.js +6 -0
- package/src/utils/PIDService.js +27 -0
- package/src/utils/environment.js +8 -15
- package/src/utils/errorUtils.js +3 -3
- package/tsconfig.json +5 -3
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar +0 -0
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.12.1/detox-20.12.1.pom.sha512 +0 -1
- package/src/devices/DeviceRegistry.js +0 -176
- package/src/devices/allocation/drivers/AllocationDriverBase.js +0 -30
- package/src/devices/allocation/drivers/android/attached/AttachedAndroidLauncher.js +0 -13
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +0 -72
- package/src/devices/allocation/drivers/android/genycloud/GenyDeviceRegistryFactory.js +0 -16
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +0 -65
- package/src/devices/common/drivers/DeviceAllocationHelper.js +0 -20
- package/src/devices/common/drivers/DeviceLauncher.js +0 -19
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceLifecycleService.js +0 -25
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceLookupService.js +0 -38
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +0 -14
- package/src/devices/common/drivers/android/genycloud/services/dto/GenyInstance.js +0 -66
- package/src/devices/common/drivers/android/genycloud/services/dto/GenyRecipe.js +0 -13
- package/src/devices/cookies/AndroidDeviceCookie.js +0 -13
- package/src/devices/cookies/AndroidEmulatorCookie.js +0 -6
- package/src/devices/cookies/AttachedAndroidDeviceCookie.js +0 -12
- package/src/devices/cookies/DeviceCookie.js +0 -4
- package/src/devices/cookies/GenycloudEmulatorCookie.js +0 -20
- package/src/devices/cookies/IosCookie.js +0 -6
- package/src/devices/cookies/IosSimulatorCookie.js +0 -10
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +0 -71
- package/src/devices/lifecycle/factories/GenyGlobalLifecycleHandlerFactory.js +0 -18
- package/src/servicelocator/android/genycloudServiceLocator.js +0 -21
- package/src/servicelocator/android/index.js +0 -25
- package/src/servicelocator/ios.js +0 -7
- /package/src/devices/{common → allocation}/drivers/android/genycloud/exec/GenyCloudExec.js +0 -0
- /package/src/devices/{common → allocation}/drivers/android/genycloud/services/GenyAuthService.js +0 -0
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
0709a8a30b2cc4c27244a2257ac28ed7
|
@@ -0,0 +1 @@
|
|
1
|
+
08f017a03aa160bead65af9b208ea95857ac9697
|
@@ -0,0 +1 @@
|
|
1
|
+
5cc49445c8f5440e5e5ed8d2d95e4827fb1ab4796d20e32ab30d7151da661ce7
|
@@ -0,0 +1 @@
|
|
1
|
+
7360ab285d19450619f38c7da9985fda6514d382f903e87a2af9d4e0204a0250851c412a045da6ce04cc932e9addf7c131fd5147889975be20910e2fdc64e88f
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
972fa81d6c5d9f0eb6edc63765bf01af
|
@@ -0,0 +1 @@
|
|
1
|
+
1ea26448826d4701a7dce9d2c0c24355853ad9d7
|
@@ -0,0 +1 @@
|
|
1
|
+
6b2f9a8186f2eef1075910eae28c189ac2030561520277e503e3a696f3c977e2
|
@@ -0,0 +1 @@
|
|
1
|
+
eae9264b4d57f78a80ecffae3c85e157a2cd1df1b2259c0edc93f5c22d305a004216c5e9e6b35a1415fab6ba14a4f6667acd2eac4d5c6ae5a7a410ee85ca2c7c
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
0ff20c1510b97ba80b15a438ce65bddc
|
@@ -0,0 +1 @@
|
|
1
|
+
449b07e6bb8435baef57e3d0839e68b5f7f85af5
|
@@ -0,0 +1 @@
|
|
1
|
+
c3347ddd7b4e4a94c60c55c079451ea219e050f7c69b8dbc7b59a453d2398e67
|
@@ -0,0 +1 @@
|
|
1
|
+
ebcf7f52b7e34a391174fc8850879e39a3e3f8f8ccfa0a417937680187461d5b41f7811933ca5ca088c554ae7a4e8d8cb2198375fdbb55680888aac561c71f64
|
@@ -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.13.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>
|
@@ -84,12 +84,6 @@
|
|
84
84
|
<version>1.2.0</version>
|
85
85
|
<scope>runtime</scope>
|
86
86
|
</dependency>
|
87
|
-
<dependency>
|
88
|
-
<groupId>com.google.android.material</groupId>
|
89
|
-
<artifactId>material</artifactId>
|
90
|
-
<version>1.2.1</version>
|
91
|
-
<scope>runtime</scope>
|
92
|
-
</dependency>
|
93
87
|
<dependency>
|
94
88
|
<groupId>org.apache.commons</groupId>
|
95
89
|
<artifactId>commons-lang3</artifactId>
|
@@ -0,0 +1 @@
|
|
1
|
+
293aa59dd07a84b7a1bd7c4dc2bffe16
|
@@ -0,0 +1 @@
|
|
1
|
+
144cef7278f92d8e7798cae134d8f93136492080
|
@@ -0,0 +1 @@
|
|
1
|
+
a1062bb5feb8cb7210de7f0e2c36d8a219f8d4065377c9ced13ae55d7eb13220
|
@@ -0,0 +1 @@
|
|
1
|
+
216ecb00454a1e03ef9ab2a197b616c4d326ec6ef47fd08b83b22d57c2c9d4dc37725a3c4d19600874074b40918387cebd1be11d558270af4ab7e797af40607f
|
@@ -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.13.0</latest>
|
7
|
+
<release>20.13.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.
|
9
|
+
<version>20.13.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20231002075250</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
253d464cc30a2d00e586eadca31d5952
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
1a402a8246b4532c9be982b61c2b4d3b3e6ab741
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
09104c2799b83cedb2f68628779529f7efb1e96b3e33c0ed8c814da6a5e19ef8
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
b1547a601cae891dc3f1a58b66c63e70670d9f3e512c50cb6d26d40568972b94cb2f28887c13ea8d04e2b75b57bba73f8ba4ad780b471009fed3cd4e42b469ae
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios.tbz
CHANGED
Binary file
|
@@ -126,9 +126,6 @@ dependencies {
|
|
126
126
|
|
127
127
|
// Third-party/extension deps.
|
128
128
|
dependencies {
|
129
|
-
implementation("com.google.android.material:material:$_materialMinVersion") {
|
130
|
-
because 'Material components are mentioned explicitly (e.g. Slider in get-attributes handler)'
|
131
|
-
}
|
132
129
|
implementation('org.apache.commons:commons-lang3:3.7') {
|
133
130
|
because 'Needed by invoke. Warning: Upgrading to newer versions is not seamless.'
|
134
131
|
}
|
@@ -150,6 +147,10 @@ dependencies {
|
|
150
147
|
testImplementation 'org.apache.commons:commons-io:1.3.2'
|
151
148
|
testImplementation 'org.mockito.kotlin:mockito-kotlin:4.0.0'
|
152
149
|
testImplementation 'org.robolectric:robolectric:4.4'
|
150
|
+
|
151
|
+
testImplementation("com.google.android.material:material:$_materialMinVersion") {
|
152
|
+
because 'Material components are mentioned explicitly (e.g. Slider in get-attributes handler)'
|
153
|
+
}
|
153
154
|
}
|
154
155
|
|
155
156
|
// Spek (https://spekframework.org/setup-android)
|
package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt
CHANGED
@@ -6,7 +6,7 @@ import androidx.test.espresso.UiController
|
|
6
6
|
import androidx.test.espresso.ViewAction
|
7
7
|
import androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom
|
8
8
|
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
|
9
|
-
import com.wix.detox.espresso.common.
|
9
|
+
import com.wix.detox.espresso.common.ReactSliderHelper
|
10
10
|
import org.hamcrest.Matcher
|
11
11
|
import org.hamcrest.Matchers
|
12
12
|
|
@@ -16,7 +16,7 @@ class AdjustSliderToPositionAction(private val targetPositionPct: Double) : View
|
|
16
16
|
Matchers.allOf( isDisplayed(), isAssignableFrom(AppCompatSeekBar::class.java) )
|
17
17
|
|
18
18
|
override fun perform(uiController: UiController?, view: View) {
|
19
|
-
val sliderHelper =
|
19
|
+
val sliderHelper = ReactSliderHelper.create(view)
|
20
20
|
sliderHelper.setProgressPct(targetPositionPct)
|
21
21
|
}
|
22
22
|
}
|
@@ -7,10 +7,10 @@ import android.widget.CheckBox
|
|
7
7
|
import android.widget.ProgressBar
|
8
8
|
import android.widget.TextView
|
9
9
|
import androidx.test.espresso.UiController
|
10
|
-
import com.google.android.material.slider.Slider
|
11
10
|
import com.wix.detox.espresso.ViewActionWithResult
|
12
11
|
import com.wix.detox.espresso.MultipleViewsAction
|
13
|
-
import com.wix.detox.espresso.common.
|
12
|
+
import com.wix.detox.espresso.common.ReactSliderHelper
|
13
|
+
import com.wix.detox.espresso.common.MaterialSliderHelper
|
14
14
|
import com.wix.detox.reactnative.ui.getAccessibilityLabel
|
15
15
|
import org.hamcrest.Matcher
|
16
16
|
import org.hamcrest.Matchers
|
@@ -18,23 +18,25 @@ import org.hamcrest.Matchers.allOf
|
|
18
18
|
import org.hamcrest.Matchers.notNullValue
|
19
19
|
import org.json.JSONObject
|
20
20
|
|
21
|
+
private interface AttributeExtractor {
|
22
|
+
fun extractAttributes(json: JSONObject, view: View)
|
23
|
+
}
|
24
|
+
|
21
25
|
class GetAttributesAction() : ViewActionWithResult<JSONObject?>, MultipleViewsAction {
|
22
|
-
private val
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
private val attributeExtractors = listOf(
|
27
|
+
CommonAttributes(),
|
28
|
+
TextViewAttributes(),
|
29
|
+
CheckBoxAttributes(),
|
30
|
+
ProgressBarAttributes(),
|
31
|
+
MaterialSliderAttributes()
|
32
|
+
)
|
27
33
|
private var result: JSONObject? = null
|
28
34
|
|
29
35
|
override fun perform(uiController: UiController?, view: View?) {
|
30
36
|
view!!
|
31
37
|
|
32
38
|
val json = JSONObject()
|
33
|
-
|
34
|
-
textViewAttributes.get(json, view)
|
35
|
-
checkBoxAttributes.get(json, view)
|
36
|
-
progressBarAttributes.get(json, view)
|
37
|
-
sliderAttributes.get(json, view)
|
39
|
+
attributeExtractors.forEach { it.extractAttributes(json, view) }
|
38
40
|
|
39
41
|
result = json
|
40
42
|
}
|
@@ -44,8 +46,8 @@ class GetAttributesAction() : ViewActionWithResult<JSONObject?>, MultipleViewsAc
|
|
44
46
|
override fun getConstraints(): Matcher<View> = allOf(notNullValue(), Matchers.isA(View::class.java))
|
45
47
|
}
|
46
48
|
|
47
|
-
private class CommonAttributes {
|
48
|
-
fun
|
49
|
+
private class CommonAttributes : AttributeExtractor {
|
50
|
+
override fun extractAttributes(json: JSONObject, view: View) {
|
49
51
|
getId(json, view)
|
50
52
|
getVisibility(json, view)
|
51
53
|
getAccessibilityLabel(json, view)
|
@@ -89,8 +91,8 @@ private class CommonAttributes {
|
|
89
91
|
}
|
90
92
|
}
|
91
93
|
|
92
|
-
private class TextViewAttributes {
|
93
|
-
fun
|
94
|
+
private class TextViewAttributes : AttributeExtractor {
|
95
|
+
override fun extractAttributes(json: JSONObject, view: View) {
|
94
96
|
if (view is TextView) {
|
95
97
|
getText(json, view)
|
96
98
|
getLength(json, view)
|
@@ -118,8 +120,8 @@ private class TextViewAttributes {
|
|
118
120
|
}
|
119
121
|
}
|
120
122
|
|
121
|
-
private class CheckBoxAttributes {
|
122
|
-
fun
|
123
|
+
private class CheckBoxAttributes : AttributeExtractor {
|
124
|
+
override fun extractAttributes(json: JSONObject, view: View) {
|
123
125
|
if (view is CheckBox) {
|
124
126
|
getCheckboxValue(json, view)
|
125
127
|
}
|
@@ -133,31 +135,28 @@ private class CheckBoxAttributes {
|
|
133
135
|
* Note: this applies also to [androidx.appcompat.widget.AppCompatSeekBar], which
|
134
136
|
* is anything RN-slider-ish.
|
135
137
|
*/
|
136
|
-
private class ProgressBarAttributes {
|
137
|
-
fun
|
138
|
+
private class ProgressBarAttributes : AttributeExtractor {
|
139
|
+
override fun extractAttributes(json: JSONObject, view: View) {
|
138
140
|
if (view is ProgressBar) {
|
139
|
-
|
140
|
-
|
141
|
+
ReactSliderHelper.maybeCreate(view)?.let {
|
142
|
+
getReactSliderValue(json, it)
|
141
143
|
} ?:
|
142
144
|
getProgressBarValue(json, view)
|
143
145
|
}
|
144
146
|
}
|
145
147
|
|
146
|
-
private fun
|
147
|
-
rootObject.put("value",
|
148
|
+
private fun getReactSliderValue(rootObject: JSONObject, reactSliderHelper: ReactSliderHelper) {
|
149
|
+
rootObject.put("value", reactSliderHelper.getCurrentProgressPct())
|
148
150
|
}
|
149
151
|
|
150
152
|
private fun getProgressBarValue(rootObject: JSONObject, view: ProgressBar) =
|
151
153
|
rootObject.put("value", view.progress)
|
152
154
|
}
|
153
155
|
|
154
|
-
private class
|
155
|
-
fun
|
156
|
-
|
157
|
-
|
156
|
+
private class MaterialSliderAttributes : AttributeExtractor {
|
157
|
+
override fun extractAttributes(json: JSONObject, view: View) {
|
158
|
+
MaterialSliderHelper(view).getValueIfSlider()?.let {
|
159
|
+
json.put("value", it)
|
158
160
|
}
|
159
161
|
}
|
160
|
-
|
161
|
-
private fun getSliderValue(rootObject: JSONObject, view: Slider) =
|
162
|
-
rootObject.put("value", view.value)
|
163
162
|
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
package com.wix.detox.espresso.common
|
2
|
+
|
3
|
+
import android.view.View
|
4
|
+
import com.wix.detox.espresso.action.common.ReflectUtils
|
5
|
+
import org.joor.Reflect
|
6
|
+
|
7
|
+
private const val CLASS_MATERIAL_SLIDER = "com.google.android.material.slider.Slider"
|
8
|
+
|
9
|
+
open class MaterialSliderHelper(protected val view: View) {
|
10
|
+
fun getValueIfSlider(): Float? {
|
11
|
+
if (!isSlider()) {
|
12
|
+
return null
|
13
|
+
}
|
14
|
+
|
15
|
+
return getValue()
|
16
|
+
}
|
17
|
+
|
18
|
+
private fun isSlider() = ReflectUtils.isAssignableFrom(view, CLASS_MATERIAL_SLIDER)
|
19
|
+
|
20
|
+
private fun getValue() = Reflect.on(view).call("getValue").get() as Float
|
21
|
+
}
|
@@ -11,8 +11,9 @@ import org.joor.Reflect
|
|
11
11
|
|
12
12
|
private const val CLASS_REACT_SLIDER_LEGACY = "com.facebook.react.views.slider.ReactSlider"
|
13
13
|
private const val CLASS_REACT_SLIDER_COMMUNITY = "com.reactnativecommunity.slider.ReactSlider"
|
14
|
+
private const val CLASS_REACT_SLIDER_COMMUNITY_MANAGER = "com.reactnativecommunity.slider.ReactSliderManager"
|
14
15
|
|
15
|
-
abstract class
|
16
|
+
abstract class ReactSliderHelper(protected val slider: AppCompatSeekBar) {
|
16
17
|
fun getCurrentProgressPct(): Double {
|
17
18
|
val nativeProgress = slider.progress.toDouble()
|
18
19
|
val nativeMax = slider.max
|
@@ -46,7 +47,7 @@ abstract class SliderHelper(protected val slider: AppCompatSeekBar) {
|
|
46
47
|
?: throw DetoxIllegalStateException("Cannot handle this type of a seek-bar view (Class ${view.javaClass.canonicalName}). " +
|
47
48
|
"Only React Native sliders are currently supported.")
|
48
49
|
|
49
|
-
fun maybeCreate(view: View):
|
50
|
+
fun maybeCreate(view: View): ReactSliderHelper? =
|
50
51
|
when {
|
51
52
|
ReflectUtils.isAssignableFrom(view, CLASS_REACT_SLIDER_LEGACY)
|
52
53
|
-> LegacySliderHelper(view as ReactSlider)
|
@@ -58,7 +59,7 @@ abstract class SliderHelper(protected val slider: AppCompatSeekBar) {
|
|
58
59
|
}
|
59
60
|
}
|
60
61
|
|
61
|
-
private class LegacySliderHelper(slider: ReactSlider):
|
62
|
+
private class LegacySliderHelper(slider: ReactSlider): ReactSliderHelper(slider) {
|
62
63
|
override fun setProgressJS(valueJS: Double) {
|
63
64
|
val reactSliderManager = com.facebook.react.views.slider.ReactSliderManager()
|
64
65
|
reactSliderManager.updateProperties(slider as ReactSlider, buildStyles("value", valueJS))
|
@@ -67,9 +68,9 @@ private class LegacySliderHelper(slider: ReactSlider): SliderHelper(slider) {
|
|
67
68
|
private fun buildStyles(vararg keysAndValues: Any) = ReactStylesDiffMap(JavaOnlyMap.of(*keysAndValues))
|
68
69
|
}
|
69
70
|
|
70
|
-
private class CommunitySliderHelper(slider: AppCompatSeekBar):
|
71
|
+
private class CommunitySliderHelper(slider: AppCompatSeekBar): ReactSliderHelper(slider) {
|
71
72
|
override fun setProgressJS(valueJS: Double) {
|
72
|
-
val reactSliderManager = Class.forName(
|
73
|
+
val reactSliderManager = Class.forName(CLASS_REACT_SLIDER_COMMUNITY_MANAGER).newInstance()
|
73
74
|
Reflect.on(reactSliderManager).call("setValue", slider, valueJS)
|
74
75
|
}
|
75
76
|
}
|
@@ -7,7 +7,7 @@ import androidx.appcompat.widget.AppCompatSeekBar
|
|
7
7
|
import androidx.test.espresso.matcher.BoundedMatcher
|
8
8
|
import androidx.test.espresso.matcher.ViewMatchers
|
9
9
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
10
|
-
import com.wix.detox.espresso.common.
|
10
|
+
import com.wix.detox.espresso.common.ReactSliderHelper
|
11
11
|
import org.hamcrest.*
|
12
12
|
import org.hamcrest.Matchers.*
|
13
13
|
import kotlin.math.abs
|
@@ -60,7 +60,7 @@ fun toHaveSliderPosition(expectedValuePct: Double, tolerance: Double): Matcher<V
|
|
60
60
|
}
|
61
61
|
|
62
62
|
override fun matchesSafely(view: AppCompatSeekBar): Boolean {
|
63
|
-
val sliderHelper =
|
63
|
+
val sliderHelper = ReactSliderHelper.create(view)
|
64
64
|
val progressPct = sliderHelper.getCurrentProgressPct()
|
65
65
|
return (abs(progressPct - expectedValuePct) <= tolerance)
|
66
66
|
}
|
package/android/detox/src/testFull/java/com/wix/detox/espresso/common/MaterialSliderHelperTest.kt
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
package com.wix.detox.espresso.common
|
2
|
+
|
3
|
+
import android.view.View
|
4
|
+
import com.google.android.material.slider.Slider
|
5
|
+
import org.assertj.core.api.Assertions.assertThat
|
6
|
+
import org.junit.Test
|
7
|
+
import org.junit.runner.RunWith
|
8
|
+
import org.mockito.kotlin.doReturn
|
9
|
+
import org.mockito.kotlin.mock
|
10
|
+
import org.robolectric.RobolectricTestRunner
|
11
|
+
|
12
|
+
@RunWith(RobolectricTestRunner::class)
|
13
|
+
class MaterialSliderHelperTest {
|
14
|
+
@Test
|
15
|
+
fun `should return value if view is a slider`() {
|
16
|
+
val slider: Slider = mock {
|
17
|
+
on { value } doReturn 0.2f
|
18
|
+
}
|
19
|
+
|
20
|
+
val uut = MaterialSliderHelper(slider)
|
21
|
+
|
22
|
+
assertThat(uut.getValueIfSlider()).isEqualTo(0.2f)
|
23
|
+
}
|
24
|
+
|
25
|
+
@Test
|
26
|
+
fun `should return null if view is not a slider`() {
|
27
|
+
val view: View = mock()
|
28
|
+
|
29
|
+
val uut = MaterialSliderHelper(view)
|
30
|
+
|
31
|
+
assertThat(uut.getValueIfSlider()).isNull()
|
32
|
+
}
|
33
|
+
}
|
@@ -15,14 +15,14 @@ import org.robolectric.RobolectricTestRunner
|
|
15
15
|
* to avoid having to install the community slider under node_modules just for this.
|
16
16
|
*/
|
17
17
|
@RunWith(RobolectricTestRunner::class)
|
18
|
-
class
|
18
|
+
class ReactSliderHelperTest {
|
19
19
|
lateinit var slider: ReactSlider
|
20
|
-
lateinit var uut:
|
20
|
+
lateinit var uut: ReactSliderHelper
|
21
21
|
|
22
22
|
@Before
|
23
23
|
fun setup() {
|
24
24
|
slider = mock()
|
25
|
-
uut =
|
25
|
+
uut = ReactSliderHelper.create(slider)
|
26
26
|
}
|
27
27
|
|
28
28
|
private fun givenNativeProgressTraits(current: Int, max: Int) {
|
package/internals.d.ts
CHANGED
@@ -113,7 +113,11 @@ declare global {
|
|
113
113
|
/** Test suite name */
|
114
114
|
name: string;
|
115
115
|
}): Promise<void>;
|
116
|
-
|
116
|
+
/**
|
117
|
+
* Workaround for Jest exiting abruptly in --bail mode.
|
118
|
+
* Makes sure that all workers and their test environments are properly torn down.
|
119
|
+
*/
|
120
|
+
unsafe_conductEarlyTeardown(): Promise<void>;
|
117
121
|
/**
|
118
122
|
* Reports to Detox CLI about passed and failed test files.
|
119
123
|
* The failed test files might be re-run again if
|
@@ -215,6 +219,11 @@ declare global {
|
|
215
219
|
* Randomly generated ID for the entire Detox test session, including retries.
|
216
220
|
*/
|
217
221
|
id: string;
|
222
|
+
/**
|
223
|
+
* Signalizes that the test session is being torn down.
|
224
|
+
* Experimental feature for Jest --bail mode.
|
225
|
+
*/
|
226
|
+
unsafe_earlyTeardown?: boolean;
|
218
227
|
/**
|
219
228
|
* Results of test file executions. Primarily used for Detox CLI retry mechanism.
|
220
229
|
*/
|
@@ -1,16 +1,12 @@
|
|
1
1
|
const { log } = require('../internals');
|
2
|
-
const DeviceRegistry = require('../src/devices/DeviceRegistry');
|
3
|
-
const { getDetoxLibraryRootPath } = require('../src/utils/environment');
|
4
|
-
|
2
|
+
const DeviceRegistry = require('../src/devices/allocation/DeviceRegistry');
|
5
3
|
|
6
4
|
module.exports.command = 'reset-lock-file';
|
7
|
-
module.exports.desc = 'Resets
|
5
|
+
module.exports.desc = 'Resets Detox lock file completely - all devices are marked as available after that.';
|
8
6
|
|
9
7
|
module.exports.handler = async function resetLockFile() {
|
10
|
-
|
11
|
-
|
12
|
-
DeviceRegistry.forAndroid().reset(),
|
13
|
-
]);
|
8
|
+
const registry = new DeviceRegistry();
|
9
|
+
await registry.reset();
|
14
10
|
|
15
|
-
log.info(`Cleaned lock
|
11
|
+
log.info(`Cleaned lock file at: ${registry.lockFilePath}`);
|
16
12
|
};
|
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.13.0",
|
5
5
|
"bin": {
|
6
6
|
"detox": "local-cli/cli.js"
|
7
7
|
},
|
@@ -137,9 +137,9 @@
|
|
137
137
|
"src/artifacts/log",
|
138
138
|
"src/artifacts/screenshot",
|
139
139
|
"src/artifacts/video",
|
140
|
-
"src/devices/allocation/drivers/AllocationDriverBase.js",
|
141
140
|
"src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js",
|
142
141
|
"src/devices/allocation/drivers/android/emulator/patchAvdSkinConfig.js",
|
142
|
+
"src/devices/allocation/.*AllocDriver.js",
|
143
143
|
"src/devices/allocation/drivers/ios",
|
144
144
|
"src/devices/allocation/factories",
|
145
145
|
"src/devices/allocation/factories/drivers",
|
@@ -154,10 +154,9 @@
|
|
154
154
|
"src/devices/runtime/drivers/ios",
|
155
155
|
"src/devices/runtime/factories",
|
156
156
|
"src/devices/runtime/factories/drivers",
|
157
|
+
"src/devices/validation/EnvironmentValidatorBase.js",
|
158
|
+
"src/devices/validation/factories",
|
157
159
|
"src/matchers/factories",
|
158
|
-
"src/validation/EnvironmentValidatorBase.js",
|
159
|
-
"src/validation/factories",
|
160
|
-
"src/validation/ios/IosSimulatorEnvValidator",
|
161
160
|
"src/utils/appdatapath.js",
|
162
161
|
"src/utils/debug.js",
|
163
162
|
"src/utils/environment.js",
|
@@ -206,5 +205,5 @@
|
|
206
205
|
"browserslist": [
|
207
206
|
"node 14"
|
208
207
|
],
|
209
|
-
"gitHead": "
|
208
|
+
"gitHead": "72e85a2fe078a2a721628255249410423fc5c1ac"
|
210
209
|
}
|