detox 20.0.0-breaking.new-global-lifecycle.0 → 20.0.1-breaking.new-global-lifecycle.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.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar → 20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar → 20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom → 20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom} +2 -2
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.1-breaking.new-global-lifecycle.0/detox-20.0.1-breaking.new-global-lifecycle.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/build.gradle +2 -2
- package/android/detox/build.gradle +2 -2
- package/android/detox/publish-pom.gradle +5 -1
- package/android/detox/publishing.gradle +9 -7
- package/android/detox/src/full/java/com/wix/detox/adapters/server/WebSocketClient.java +3 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +1 -3
- package/android/detox/src/full/java/com/wix/detox/espresso/UiAutomatorHelper.java +1 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +22 -0
- package/android/detox/src/{main → full}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +13 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +75 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +16 -23
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeLoadingMonitor.kt +54 -8
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/RN66Workaround.kt +13 -4
- package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +4 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/UiControllerSpy.kt +2 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +10 -0
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/utils/UiControllerUtils.kt +1 -1
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +15 -3
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +39 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/android/gradlew +181 -107
- package/internals.d.ts +3 -8
- package/local-cli/testCommand/TestRunnerCommand.js +2 -1
- package/package.json +4 -4
- package/src/DetoxWorker.js +5 -0
- package/src/artifacts/log/android/ADBLogcatRecording.js +11 -28
- package/src/configuration/composeAppsConfig.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +1 -0
- package/src/devices/common/drivers/android/exec/ADB.js +5 -0
- package/src/errors/DetoxConfigErrorComposer.js +1 -1
- package/src/ipc/IPCServer.js +7 -1
- package/src/ipc/state.js +10 -1
- package/src/realms/DetoxContext.js +1 -1
- package/src/realms/DetoxPrimaryContext.js +3 -2
- package/src/realms/DetoxSecondaryContext.js +2 -1
- package/src/utils/ChromeTracingExporter.js +6 -5
- package/src/utils/environment.js +30 -15
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom.sha512 +0 -1
- package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -36
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +0 -59
@@ -19,7 +19,7 @@ class DetoxContext {
|
|
19
19
|
constructor() {
|
20
20
|
this[symbols.globalSetup] = this[symbols.globalSetup].bind(this);
|
21
21
|
this[symbols.globalTeardown] = this[symbols.globalTeardown].bind(this);
|
22
|
-
this[symbols.reportFailedTests] = this[symbols.
|
22
|
+
this[symbols.reportFailedTests] = this[symbols.reportFailedTests].bind(this);
|
23
23
|
this[symbols.resolveConfig] = this[symbols.resolveConfig].bind(this);
|
24
24
|
this[symbols.setup] = this[symbols.setup].bind(this);
|
25
25
|
this[symbols.teardown] = this[symbols.teardown].bind(this);
|
@@ -120,8 +120,9 @@ class DetoxPrimaryContext extends DetoxContext {
|
|
120
120
|
* @param {Partial<DetoxInternals.DetoxConfigurationSetupOptions>} [opts]
|
121
121
|
*/
|
122
122
|
async [symbols.setup](opts) {
|
123
|
-
|
124
|
-
this[
|
123
|
+
const workerId = opts.workerId || 1;
|
124
|
+
this[$sessionState].workerId = workerId;
|
125
|
+
this[_ipcServer].onRegisterWorker({ workerId });
|
125
126
|
await super[symbols.setup](opts);
|
126
127
|
}
|
127
128
|
|
@@ -59,8 +59,9 @@ class DetoxSecondaryContext extends DetoxContext {
|
|
59
59
|
logger: this[$logger],
|
60
60
|
});
|
61
61
|
|
62
|
+
const workerId = opts.workerId || 1;
|
62
63
|
await this[_ipcClient].init();
|
63
|
-
await this[_ipcClient].registerWorker(
|
64
|
+
await this[_ipcClient].registerWorker(workerId);
|
64
65
|
await super[symbols.setup](opts);
|
65
66
|
}
|
66
67
|
|
@@ -26,15 +26,16 @@ class ChromeTracingExporter {
|
|
26
26
|
|
27
27
|
_parseEvent(event) {
|
28
28
|
const { name, ts, args, type } = event;
|
29
|
+
const tsInMicroseconds = ts * 1000;
|
29
30
|
switch (type) {
|
30
|
-
case 'start': return this._event(name, 'B',
|
31
|
-
case 'end': return this._event(name, 'E',
|
31
|
+
case 'start': return this._event(name, 'B', tsInMicroseconds, args);
|
32
|
+
case 'end': return this._event(name, 'E', tsInMicroseconds, args);
|
32
33
|
case 'init': return [
|
33
|
-
this._event('process_name', 'M',
|
34
|
-
this._event('thread_name', 'M',
|
34
|
+
this._event('process_name', 'M', tsInMicroseconds, { name: this._process.name }),
|
35
|
+
this._event('thread_name', 'M', tsInMicroseconds, { name: this._thread.name }),
|
35
36
|
];
|
36
37
|
default:
|
37
|
-
throw new DetoxRuntimeError(`Invalid type '${type}' in event: ${event}`);
|
38
|
+
throw new DetoxRuntimeError({ message: `Invalid type '${type}' in event: ${event}` });
|
38
39
|
}
|
39
40
|
}
|
40
41
|
|
package/src/utils/environment.js
CHANGED
@@ -78,7 +78,7 @@ function getAndroidEmulatorPath() {
|
|
78
78
|
return legacyPath;
|
79
79
|
}
|
80
80
|
|
81
|
-
|
81
|
+
throwSdkBinIntegrityError(sdkRoot, 'emulator/emulator');
|
82
82
|
}
|
83
83
|
|
84
84
|
async function getAaptPath() {
|
@@ -88,23 +88,33 @@ async function getAaptPath() {
|
|
88
88
|
}
|
89
89
|
|
90
90
|
const latestBuildTools = await getLatestBuildToolsPath(sdkRoot);
|
91
|
-
|
91
|
+
if (!latestBuildTools) {
|
92
|
+
throwSdkIntegrityError('Failed to find the "aapt" tool under the Android SDK: No build-tools are installed!');
|
93
|
+
}
|
94
|
+
|
95
|
+
const defaultPath = which('aapt', latestBuildTools);
|
92
96
|
if (defaultPath) {
|
93
97
|
return defaultPath;
|
94
98
|
}
|
95
99
|
|
96
|
-
|
100
|
+
throwSdkToolPathError(`${latestBuildTools}/aapt`);
|
97
101
|
}
|
98
102
|
|
99
103
|
async function getLatestBuildToolsPath(sdkRoot) {
|
100
|
-
if (!sdkRoot)
|
104
|
+
if (!sdkRoot) {
|
105
|
+
return '';
|
106
|
+
}
|
101
107
|
|
102
108
|
const buildToolsDir = path.join(sdkRoot, 'build-tools');
|
103
|
-
if (!fs.existsSync(buildToolsDir))
|
109
|
+
if (!fs.existsSync(buildToolsDir)) {
|
110
|
+
return '';
|
111
|
+
}
|
104
112
|
|
105
113
|
const buildToolsVersions = await fsext.getDirectories(buildToolsDir);
|
106
114
|
const latestBuildToolsVersion = _.last(buildToolsVersions);
|
107
|
-
if (!latestBuildToolsVersion)
|
115
|
+
if (!latestBuildToolsVersion) {
|
116
|
+
return '';
|
117
|
+
}
|
108
118
|
|
109
119
|
return path.join(buildToolsDir, latestBuildToolsVersion);
|
110
120
|
}
|
@@ -120,7 +130,7 @@ function getAdbPath() {
|
|
120
130
|
return defaultPath;
|
121
131
|
}
|
122
132
|
|
123
|
-
|
133
|
+
throwSdkBinIntegrityError(sdkRoot, 'platform-tools/adb');
|
124
134
|
}
|
125
135
|
|
126
136
|
function getGmsaasPath() {
|
@@ -142,15 +152,20 @@ function throwMissingAvdError(avdName, avdPath, avdIniPath) {
|
|
142
152
|
);
|
143
153
|
}
|
144
154
|
|
145
|
-
function
|
146
|
-
const executablePath = path.join(sdkRoot,
|
147
|
-
|
148
|
-
|
155
|
+
function throwSdkBinIntegrityError(sdkRoot, relativeBinPath) {
|
156
|
+
const executablePath = path.join(sdkRoot, relativeBinPath);
|
157
|
+
throwSdkToolPathError(executablePath);
|
158
|
+
}
|
149
159
|
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
160
|
+
function throwSdkToolPathError(sdkToolPath) {
|
161
|
+
const name = path.basename(sdkToolPath);
|
162
|
+
const dir = path.dirname(sdkToolPath);
|
163
|
+
|
164
|
+
throwSdkIntegrityError(`There was no "${name}" executable file in directory: ${dir}`);
|
165
|
+
}
|
166
|
+
|
167
|
+
function throwSdkIntegrityError(errMessage) {
|
168
|
+
throw new DetoxRuntimeError(`${errMessage}\nCheck the integrity of your Android SDK.`);
|
154
169
|
}
|
155
170
|
|
156
171
|
function throwMissingGmsaasError() {
|
@@ -1 +0,0 @@
|
|
1
|
-
4c6cf9ab6a5661e76e324d60e32135a5
|
@@ -1 +0,0 @@
|
|
1
|
-
18acb60a8d1035c30d5456c6ae34452ba601be74
|
@@ -1 +0,0 @@
|
|
1
|
-
a5944cadfbcdb604230d233ffc61937c00aeeb0cd7d119ca80dd980c63cce162
|
@@ -1 +0,0 @@
|
|
1
|
-
3b03acc4ca394d1cf0ad68035630f5f9acf9ef61bb82bc82d12dd0521e477a6b9a90408052929d5292c4a277719f097d2e5442f72c206dfc9fa3454b0065c7ad
|
@@ -1 +0,0 @@
|
|
1
|
-
5b522f2a74898254ef0d235c51538892
|
@@ -1 +0,0 @@
|
|
1
|
-
9700c95cf470ffa9203966e67eaa5f42a3f261e1
|
@@ -1 +0,0 @@
|
|
1
|
-
13b5779cfa22e39ee57276e87f52a514ef22ca63c93eeecc040a0fc019de1fa1
|
@@ -1 +0,0 @@
|
|
1
|
-
bbf983c662070c19d39533e5bbc5c3aee9d0b5ad4f89c2df86b4358767fcdfb18989cf379ed12257173d2d73c69e1c12a4ed2fd92a5bc2229177d0f8b38b19bf
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
763fee6cb2b551c8163caecafb821478
|
@@ -1 +0,0 @@
|
|
1
|
-
a3d2827035258ddbd41de27ce4e25df2f3a5a2fd
|
@@ -1 +0,0 @@
|
|
1
|
-
87990259e9864e07f8a1ccde34e69dfcadfba39167d7384062c272e81b307231
|
@@ -1 +0,0 @@
|
|
1
|
-
34165b1c6d6ea54d5c3420bd7f387dfa9fc81f8a43d50c404d06c9d24a6d6377dc84ba4f0b699dda5780658fb8796d197f368ef396cbf29240270e9fea78bddc
|
@@ -1 +0,0 @@
|
|
1
|
-
66679cd30052bba4a828537b8cd97014
|
@@ -1 +0,0 @@
|
|
1
|
-
909eb59596a19f81bcad544a5b7aee3ed899e0c2
|
@@ -1 +0,0 @@
|
|
1
|
-
ba8c95326c6df61428a56284280062a28c1aa747dcc8d5ec50f1756f869aba7e
|
@@ -1 +0,0 @@
|
|
1
|
-
e0f4d3ce73bed2981edc17b8845a2f25044cba806371c3b57eaf59f9d008bff3be112a1cb9876dbafd0ec96a01d240452bdd563ac99f3c03f47ad3416e3ae2d3
|
package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
package com.wix.detox.espresso.action
|
2
|
-
|
3
|
-
import android.view.View
|
4
|
-
import androidx.test.espresso.UiController
|
5
|
-
import androidx.test.espresso.ViewAction
|
6
|
-
import androidx.test.espresso.matcher.ViewMatchers
|
7
|
-
import com.facebook.react.bridge.JavaOnlyMap
|
8
|
-
import com.facebook.react.uimanager.ReactStylesDiffMap
|
9
|
-
import com.facebook.react.views.slider.ReactSlider
|
10
|
-
import com.facebook.react.views.slider.ReactSliderManager
|
11
|
-
import org.hamcrest.Matcher
|
12
|
-
import org.hamcrest.Matchers
|
13
|
-
|
14
|
-
class AdjustSliderToPositionAction(private val desiredPosition: Double, private val mManager: ReactSliderManager) : ViewAction {
|
15
|
-
override fun getConstraints(): Matcher<View?>? = Matchers.allOf(
|
16
|
-
ViewMatchers.isAssignableFrom(ReactSlider::class.java),
|
17
|
-
getIsDisplayed())
|
18
|
-
|
19
|
-
override fun getDescription() = "adjustSliderToPosition"
|
20
|
-
|
21
|
-
fun getIsDisplayed(): Matcher<View?> = ViewMatchers.isDisplayed()
|
22
|
-
|
23
|
-
private fun buildStyles(vararg keysAndValues: Any) = ReactStylesDiffMap(JavaOnlyMap.of(*keysAndValues))
|
24
|
-
|
25
|
-
private fun calculateProgressTarget(view: ReactSlider): Double {
|
26
|
-
val sliderProgress = view.toRealProgress(view.progress)
|
27
|
-
val sliderScrollFactor = view.max / view.progress.toDouble()
|
28
|
-
val sliderMaxValue = sliderProgress * sliderScrollFactor
|
29
|
-
return desiredPosition * sliderMaxValue
|
30
|
-
}
|
31
|
-
|
32
|
-
override fun perform(uiController: UiController?, view: View) {
|
33
|
-
val progressNewValue = calculateProgressTarget(view as ReactSlider)
|
34
|
-
mManager.updateProperties(view, buildStyles("value", progressNewValue))
|
35
|
-
}
|
36
|
-
}
|
@@ -1,59 +0,0 @@
|
|
1
|
-
package com.wix.detox.espresso.action
|
2
|
-
|
3
|
-
import android.view.View
|
4
|
-
import com.facebook.react.views.slider.ReactSlider
|
5
|
-
import com.facebook.react.views.slider.ReactSliderManager
|
6
|
-
import org.assertj.core.api.Assertions.assertThat
|
7
|
-
import org.hamcrest.Matcher
|
8
|
-
import org.junit.Before
|
9
|
-
import org.junit.Test
|
10
|
-
import org.mockito.kotlin.*
|
11
|
-
|
12
|
-
@Suppress("IllegalIdentifier")
|
13
|
-
class AdjustSliderToPositionActionTest {
|
14
|
-
val mockReactSliderManager: ReactSliderManager = mock()
|
15
|
-
var uut: AdjustSliderToPositionAction = spy(AdjustSliderToPositionAction(0.25, mockReactSliderManager))
|
16
|
-
private lateinit var mockReactSlider: ReactSlider
|
17
|
-
|
18
|
-
@Before
|
19
|
-
fun setup() {
|
20
|
-
mockReactSlider = mock {
|
21
|
-
on {progress}.thenReturn(250)
|
22
|
-
}
|
23
|
-
}
|
24
|
-
|
25
|
-
@Test
|
26
|
-
fun `should have correct description`() {
|
27
|
-
assertThat(uut.description).isEqualTo("adjustSliderToPosition")
|
28
|
-
}
|
29
|
-
|
30
|
-
@Test
|
31
|
-
fun `should have correct constraints`() {
|
32
|
-
val mockReactSlider: ReactSlider = mock()
|
33
|
-
val mockView: View = mock()
|
34
|
-
val mockIsDisplayed: Matcher<View?> = mock {
|
35
|
-
on {matches(any())}.thenReturn(true)
|
36
|
-
}
|
37
|
-
doReturn(mockIsDisplayed).whenever(uut).getIsDisplayed()
|
38
|
-
|
39
|
-
assertThat(uut.constraints).isNotNull
|
40
|
-
assertThat(uut.constraints!!.matches(null)).isFalse()
|
41
|
-
assertThat(uut.constraints!!.matches(1)).isFalse()
|
42
|
-
assertThat(uut.constraints!!.matches(mockReactSlider)).isTrue()
|
43
|
-
assertThat(uut.constraints!!.matches(mockView)).isFalse()
|
44
|
-
}
|
45
|
-
|
46
|
-
@Test
|
47
|
-
fun `should change progress of slider`() {
|
48
|
-
val mockReactSliderManager: ReactSliderManager = mock {
|
49
|
-
on{updateProperties(any(), any())}.thenAnswer{
|
50
|
-
doReturn(750).whenever(mockReactSlider).progress
|
51
|
-
}
|
52
|
-
}
|
53
|
-
uut = spy(AdjustSliderToPositionAction(0.75, mockReactSliderManager))
|
54
|
-
uut.perform(null, mockReactSlider)
|
55
|
-
|
56
|
-
verify(mockReactSliderManager, times(1)).updateProperties(any(), any())
|
57
|
-
assertThat(mockReactSlider.progress).isEqualTo(750)
|
58
|
-
}
|
59
|
-
}
|