detox 20.0.0-breaking.new-global-lifecycle.0 → 20.0.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.0/detox-20.0.0-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.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.0/detox-20.0.0-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.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.0/detox-20.0.0.pom} +2 -8
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.0.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.0.0/detox-20.0.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/README.md +1 -1
- package/android/build.gradle +13 -8
- package/android/detox/build.gradle +14 -10
- package/android/detox/proguard-rules-app.pro +6 -0
- package/android/detox/proguard-rules.pro +3 -0
- package/android/detox/publish-pom.gradle +5 -1
- package/android/detox/publishing.gradle +35 -33
- package/android/detox/src/full/java/com/wix/detox/DetoxCrashHandler.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/LaunchArgs.java +9 -0
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +1 -1
- 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/ReactNativeExtension.kt +15 -2
- package/android/detox/src/full/java/com/wix/detox/reactnative/ReactNativeIdlingResources.kt +43 -38
- 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/IdlingResourceDescription.kt +19 -13
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +33 -30
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategy.kt +7 -27
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/IdleInterrogationStrategy.kt +1 -11
- 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/common/TextFileReader.kt +1 -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/DetoxMultiTapSpec.kt +4 -3
- 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/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +61 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DelegatedIdleInterrogationStrategySpec.kt +3 -11
- package/android/gradle/wrapper/gradle-wrapper.properties +2 -1
- package/android/gradlew +181 -107
- package/index.d.ts +198 -57
- package/internals.d.ts +220 -51
- package/local-cli/build.js +2 -2
- package/local-cli/build.test.js +14 -14
- package/local-cli/cli.js +8 -6
- package/local-cli/init.js +61 -21
- package/local-cli/rebuild-framework-cache.js +1 -1
- package/local-cli/reset-lock-file.js +16 -0
- package/local-cli/templates/jest.js +13 -10
- package/local-cli/test.js +14 -8
- package/local-cli/test.test.js +148 -61
- package/local-cli/testCommand/TestRunnerCommand.js +78 -71
- package/local-cli/testCommand/builder.js +0 -1
- package/local-cli/testCommand/middlewares.js +4 -13
- package/local-cli/testCommand/warnings.js +0 -3
- package/local-cli/utils/jestInternals.js +4 -1
- package/package.json +22 -15
- package/runners/deprecation.js +42 -44
- package/runners/jest/globalSetup.js +1 -1
- package/runners/jest/globalTeardown.js +1 -1
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/index.test.js +13 -0
- package/runners/jest/reporters/DetoxReporter.js +33 -2
- package/runners/jest/testEnvironment/index.js +119 -69
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +94 -51
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +14 -16
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +2 -6
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -1
- package/src/DetoxWorker.js +107 -59
- package/src/android/core/NativeElement.js +56 -20
- package/src/android/core/NativeExpect.js +28 -9
- package/src/android/interactions/native.js +25 -18
- package/src/artifacts/ArtifactsManager.js +14 -47
- package/src/artifacts/instruments/ios/SimulatorInstrumentsRecording.js +3 -3
- package/src/artifacts/log/android/ADBLogcatRecording.js +11 -28
- package/src/artifacts/log/ios/SimulatorLogRecording.js +1 -1
- package/src/artifacts/screenshot/SimulatorScreenshotPlugin.js +1 -1
- package/src/artifacts/templates/artifact/Artifact.js +1 -1
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/timeline/TimelineContextTypes.js +7 -0
- package/src/artifacts/utils/temporaryPath.js +18 -7
- package/src/artifacts/video/SimulatorRecordVideoPlugin.js +1 -1
- package/src/client/AsyncWebSocket.js +8 -17
- package/src/client/Client.js +19 -2
- package/src/client/actions/formatters/sync-resources/NetworkFormatter.js +1 -1
- package/src/configuration/collectCliConfig.js +1 -12
- package/src/configuration/composeAppsConfig.js +5 -1
- package/src/configuration/composeDeviceConfig.js +1 -1
- package/src/configuration/composeLoggerConfig.js +19 -10
- package/src/configuration/composeRunnerConfig.js +62 -9
- package/src/configuration/index.js +14 -9
- package/src/configuration/loadExternalConfig.js +1 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/AVDValidator.js +5 -5
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocationHelper.js +1 -1
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -2
- package/src/devices/allocation/drivers/android/emulator/EmulatorVersionResolver.js +4 -6
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +1 -1
- package/src/devices/allocation/drivers/android/genycloud/GenyAllocDriver.js +1 -0
- package/src/devices/allocation/drivers/android/genycloud/GenyInstanceAllocationHelper.js +1 -1
- package/src/devices/common/drivers/android/exec/ADB.js +5 -0
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +3 -3
- package/src/devices/common/drivers/android/genycloud/services/GenyRecipesService.js +1 -1
- package/src/devices/common/drivers/android/tools/EmulatorTelnet.js +1 -1
- package/src/devices/common/drivers/android/tools/FreeDeviceFinder.js +1 -1
- package/src/devices/common/drivers/android/tools/MonitoredInstrumentation.js +1 -1
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +29 -3
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +13 -15
- package/src/devices/runtime/RuntimeDevice.js +19 -12
- package/src/devices/runtime/drivers/DeviceDriverBase.js +1 -1
- package/src/devices/runtime/drivers/android/AndroidDriver.js +10 -2
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +1 -1
- package/src/errors/DetoxConfigErrorComposer.js +18 -3
- package/src/ios/expectTwo.js +153 -67
- package/src/ipc/IPCClient.js +12 -12
- package/src/ipc/IPCServer.js +34 -17
- package/src/ipc/{state.js → SessionState.js} +26 -31
- package/src/logger/DetoxLogger.js +261 -157
- package/src/logger/index.js +5 -0
- package/src/logger/utils/BunyanLogger.js +76 -0
- package/src/logger/utils/CategoryThreadDispatcher.js +36 -0
- package/src/logger/utils/DetoxLogFinalizer.js +140 -0
- package/src/logger/utils/MessageStack.js +24 -0
- package/src/logger/utils/ThreadDispatcher.js +61 -0
- package/src/logger/{customConsoleLogger.js → utils/customConsoleLogger.js} +5 -4
- package/src/logger/utils/sanitizeBunyanContext.js +30 -0
- package/src/{utils → logger/utils}/streamUtils.js +51 -17
- package/src/logger/utils/tracerLegacy.js +37 -0
- package/src/realms/DetoxContext.js +78 -65
- package/src/realms/DetoxInternalsFacade.js +8 -12
- package/src/realms/DetoxPrimaryContext.js +106 -73
- package/src/realms/DetoxSecondaryContext.js +29 -31
- package/src/server/DetoxConnection.js +18 -23
- package/src/server/DetoxServer.js +7 -10
- package/src/server/DetoxSession.js +6 -6
- package/src/server/DetoxSessionManager.js +1 -1
- package/src/server/handlers/RegisteredConnectionHandler.js +1 -2
- package/src/symbols.js +16 -22
- package/src/utils/Timer.js +55 -38
- package/src/utils/argparse.js +11 -0
- package/src/utils/childProcess/exec.js +1 -1
- package/src/utils/childProcess/spawn.js +1 -1
- package/src/utils/environment.js +30 -15
- package/src/utils/errorUtils.js +24 -3
- package/src/utils/invocationTraceDescriptions.js +43 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/traceInvocationCall.js +21 -0
- package/src/utils/traceMethods.js +15 -0
- 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/full/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategy.kt +0 -84
- 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
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/DefaultIdleInterrogationStrategySpec.kt +0 -115
- package/runners/jest/deprecation.js +0 -25
- package/src/configuration/utils/warnings.js +0 -12
- package/src/logger/DetoxTraceEventBuilder.js +0 -21
- package/src/logger/DetoxTracer.js +0 -133
- package/src/logger/TraceThreadDispatcher.js +0 -52
- package/src/utils/ChromeTracingExporter.js +0 -53
- package/src/utils/trace.js +0 -19
@@ -11,6 +11,7 @@ import org.assertj.core.api.Assertions.assertThat
|
|
11
11
|
import org.mockito.kotlin.*
|
12
12
|
import org.spekframework.spek2.Spek
|
13
13
|
import org.spekframework.spek2.style.specification.describe
|
14
|
+
import java.lang.NullPointerException
|
14
15
|
import kotlin.test.assertFailsWith
|
15
16
|
|
16
17
|
object DetoxMultiTapSpec: Spek({
|
@@ -136,17 +137,17 @@ object DetoxMultiTapSpec: Spek({
|
|
136
137
|
}
|
137
138
|
|
138
139
|
it("should throw if no UI-controller provided") {
|
139
|
-
assertFailsWith(
|
140
|
+
assertFailsWith(NullPointerException::class) {
|
140
141
|
uut(1).sendTap(null, coordinates, precision, -1, -1)
|
141
142
|
}
|
142
143
|
}
|
143
144
|
|
144
145
|
it("should throw if no coordinates / precision are provided") {
|
145
|
-
assertFailsWith(
|
146
|
+
assertFailsWith(NullPointerException::class) {
|
146
147
|
uut(1).sendTap(uiController, null, precision, -1, -1)
|
147
148
|
}
|
148
149
|
|
149
|
-
assertFailsWith(
|
150
|
+
assertFailsWith(NullPointerException::class) {
|
150
151
|
uut(1).sendTap(uiController, coordinates, null, -1, -1)
|
151
152
|
}
|
152
153
|
}
|
package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt
CHANGED
@@ -4,6 +4,7 @@ import android.view.View
|
|
4
4
|
import android.widget.CheckBox
|
5
5
|
import android.widget.ProgressBar
|
6
6
|
import android.widget.TextView
|
7
|
+
import com.facebook.react.views.slider.ReactSlider
|
7
8
|
import com.google.android.material.slider.Slider
|
8
9
|
import org.assertj.core.api.Assertions.assertThat
|
9
10
|
import org.json.JSONObject
|
@@ -179,7 +180,7 @@ class GetAttributesActionTest {
|
|
179
180
|
}
|
180
181
|
|
181
182
|
@Test
|
182
|
-
fun `should return ProgressBar
|
183
|
+
fun `should return raw ProgressBar or SeekBar 'progress' via value attribute`() {
|
183
184
|
val progressBar: ProgressBar = mock {
|
184
185
|
on { progress } doReturn 42
|
185
186
|
}
|
@@ -189,7 +190,18 @@ class GetAttributesActionTest {
|
|
189
190
|
}
|
190
191
|
|
191
192
|
@Test
|
192
|
-
fun `should return Slider
|
193
|
+
fun `should return RN-Slider via value attribute`() {
|
194
|
+
val progressBar: ReactSlider = mock {
|
195
|
+
on { max } doReturn 100
|
196
|
+
on { progress } doReturn 50
|
197
|
+
}
|
198
|
+
|
199
|
+
val resultJson = perform(progressBar)
|
200
|
+
assertThat(resultJson.opt("value")).isEqualTo(0.5)
|
201
|
+
}
|
202
|
+
|
203
|
+
@Test
|
204
|
+
fun `should return material-Slider state through value attribute`() {
|
193
205
|
val slider: Slider = mock {
|
194
206
|
on { value } doReturn 0.42f
|
195
207
|
}
|
@@ -225,7 +237,7 @@ class GetAttributesActionTest {
|
|
225
237
|
}
|
226
238
|
|
227
239
|
@Test
|
228
|
-
fun `should return text hint via
|
240
|
+
fun `should return text hint via 'placeholder' attribute, if applicable`() {
|
229
241
|
val textViewWithHint: TextView = mock {
|
230
242
|
on { hint } doReturn "hint-text-mock"
|
231
243
|
}
|
@@ -0,0 +1,39 @@
|
|
1
|
+
package com.wix.detox.espresso.common
|
2
|
+
|
3
|
+
import com.facebook.react.views.slider.ReactSlider
|
4
|
+
import org.assertj.core.api.Assertions.assertThat
|
5
|
+
import org.junit.Before
|
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.mockito.kotlin.whenever
|
11
|
+
import org.robolectric.RobolectricTestRunner
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Note: This only tests against the react *legacy* (non-community) slider in order
|
15
|
+
* to avoid having to install the community slider under node_modules just for this.
|
16
|
+
*/
|
17
|
+
@RunWith(RobolectricTestRunner::class)
|
18
|
+
class SliderHelperTest {
|
19
|
+
lateinit var slider: ReactSlider
|
20
|
+
lateinit var uut: SliderHelper
|
21
|
+
|
22
|
+
@Before
|
23
|
+
fun setup() {
|
24
|
+
slider = mock()
|
25
|
+
uut = SliderHelper.create(slider)
|
26
|
+
}
|
27
|
+
|
28
|
+
private fun givenNativeProgressTraits(current: Int, max: Int) {
|
29
|
+
whenever(slider.progress).doReturn(current)
|
30
|
+
whenever(slider.max).doReturn(max)
|
31
|
+
}
|
32
|
+
|
33
|
+
@Test
|
34
|
+
fun `should properly calculate current progress, in percentage`() {
|
35
|
+
givenNativeProgressTraits(current = 20, max = 100)
|
36
|
+
|
37
|
+
assertThat(uut.getCurrentProgressPct()).isEqualTo(0.2)
|
38
|
+
}
|
39
|
+
}
|
@@ -0,0 +1,61 @@
|
|
1
|
+
package com.wix.detox.reactnative.idlingresources
|
2
|
+
|
3
|
+
import com.wix.detox.UTHelpers.yieldToOtherThreads
|
4
|
+
import org.assertj.core.api.Assertions.assertThat
|
5
|
+
|
6
|
+
import okhttp3.Dispatcher
|
7
|
+
import org.junit.Before
|
8
|
+
import org.junit.Test
|
9
|
+
import org.junit.runner.RunWith
|
10
|
+
import org.robolectric.RobolectricTestRunner
|
11
|
+
import java.util.concurrent.Executors
|
12
|
+
|
13
|
+
@RunWith(RobolectricTestRunner::class)
|
14
|
+
class NetworkIdlingResourcesTest {
|
15
|
+
lateinit var dispatcher: Dispatcher
|
16
|
+
lateinit var uut: NetworkIdlingResource
|
17
|
+
|
18
|
+
@Before
|
19
|
+
fun setup() {
|
20
|
+
dispatcher = Dispatcher()
|
21
|
+
uut = NetworkIdlingResource(dispatcher)
|
22
|
+
}
|
23
|
+
|
24
|
+
// Note: Ideally, we should test that the list of busy resources is protected,
|
25
|
+
// rather than testing thread-safety as a whole.
|
26
|
+
@Test
|
27
|
+
fun `should return the description in a thread-safe way`() {
|
28
|
+
val localExecutor = Executors.newSingleThreadExecutor()
|
29
|
+
var description: IdlingResourceDescription? = null
|
30
|
+
|
31
|
+
synchronized(uut) {
|
32
|
+
localExecutor.submit {
|
33
|
+
description = uut.getDescription()
|
34
|
+
}
|
35
|
+
|
36
|
+
yieldToOtherThreads(localExecutor)
|
37
|
+
assertThat(description).isNull()
|
38
|
+
}
|
39
|
+
yieldToOtherThreads(localExecutor)
|
40
|
+
assertThat(description).isNotNull()
|
41
|
+
}
|
42
|
+
|
43
|
+
// Note: Ideally, we should test that the list of busy resources is protected,
|
44
|
+
// rather than testing thread-safety as a whole.
|
45
|
+
@Test
|
46
|
+
fun `should check for idle in a thread-safe way`() {
|
47
|
+
val localExecutor = Executors.newSingleThreadExecutor()
|
48
|
+
var idle = false
|
49
|
+
|
50
|
+
synchronized(uut) {
|
51
|
+
localExecutor.submit {
|
52
|
+
idle = uut.isIdleNow
|
53
|
+
}
|
54
|
+
|
55
|
+
yieldToOtherThreads(localExecutor)
|
56
|
+
assertThat(idle).isFalse
|
57
|
+
}
|
58
|
+
yieldToOtherThreads(localExecutor)
|
59
|
+
assertThat(idle).isTrue
|
60
|
+
}
|
61
|
+
}
|
@@ -5,22 +5,14 @@ import org.assertj.core.api.Assertions.assertThat
|
|
5
5
|
import org.mockito.kotlin.*
|
6
6
|
import org.spekframework.spek2.Spek
|
7
7
|
import org.spekframework.spek2.style.specification.describe
|
8
|
+
import com.facebook.react.modules.core.TimingModule
|
8
9
|
|
9
10
|
private const val BUSY_INTERVAL_MS = 1500L
|
10
11
|
|
11
|
-
abstract class TimingModuleStub: NativeModule {
|
12
|
-
abstract fun hasActiveTimersInRange(rangeMs: Long): Boolean
|
13
|
-
|
14
|
-
override fun onCatalystInstanceDestroy() {}
|
15
|
-
override fun getName(): String = "TimersNativeModuleStub"
|
16
|
-
override fun canOverrideExistingModule() = false
|
17
|
-
override fun initialize() {}
|
18
|
-
}
|
19
|
-
|
20
12
|
object DelegatedIdleInterrogationStrategySpec : Spek({
|
21
|
-
describe("
|
13
|
+
describe("Timers idle-interrogation strategy") {
|
22
14
|
|
23
|
-
lateinit var timingModule:
|
15
|
+
lateinit var timingModule: TimingModule
|
24
16
|
|
25
17
|
beforeEachTest {
|
26
18
|
timingModule = mock()
|
@@ -3,4 +3,5 @@ distributionBase=GRADLE_USER_HOME
|
|
3
3
|
distributionPath=wrapper/dists
|
4
4
|
zipStoreBase=GRADLE_USER_HOME
|
5
5
|
zipStorePath=wrapper/dists
|
6
|
-
distributionUrl=https\://services.gradle.org/distributions/gradle-
|
6
|
+
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
|
7
|
+
|
package/android/gradlew
CHANGED
@@ -1,74 +1,129 @@
|
|
1
1
|
#!/usr/bin/env bash
|
2
2
|
|
3
|
+
#
|
4
|
+
# Copyright © 2015-2021 the original authors.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# Unless required by applicable law or agreed to in writing, software
|
13
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
14
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15
|
+
# See the License for the specific language governing permissions and
|
16
|
+
# limitations under the License.
|
17
|
+
#
|
18
|
+
|
3
19
|
##############################################################################
|
4
|
-
|
5
|
-
|
6
|
-
|
20
|
+
#
|
21
|
+
# Gradle start up script for POSIX generated by Gradle.
|
22
|
+
#
|
23
|
+
# Important for running:
|
24
|
+
#
|
25
|
+
# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
|
26
|
+
# noncompliant, but you have some other compliant shell such as ksh or
|
27
|
+
# bash, then to run this script, type that shell name before the whole
|
28
|
+
# command line, like:
|
29
|
+
#
|
30
|
+
# ksh Gradle
|
31
|
+
#
|
32
|
+
# Busybox and similar reduced shells will NOT work, because this script
|
33
|
+
# requires all of these POSIX shell features:
|
34
|
+
# * functions;
|
35
|
+
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
|
36
|
+
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
|
37
|
+
# * compound commands having a testable exit status, especially «case»;
|
38
|
+
# * various built-in commands including «command», «set», and «ulimit».
|
39
|
+
#
|
40
|
+
# Important for patching:
|
41
|
+
#
|
42
|
+
# (2) This script targets any POSIX shell, so it avoids extensions provided
|
43
|
+
# by Bash, Ksh, etc; in particular arrays are avoided.
|
44
|
+
#
|
45
|
+
# The "traditional" practice of packing multiple parameters into a
|
46
|
+
# space-separated string is a well documented source of bugs and security
|
47
|
+
# problems, so this is (mostly) avoided, by progressively accumulating
|
48
|
+
# options in "$@", and eventually passing that to Java.
|
49
|
+
#
|
50
|
+
# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
|
51
|
+
# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
|
52
|
+
# see the in-line comments for details.
|
53
|
+
#
|
54
|
+
# There are tweaks for specific operating systems such as AIX, CygWin,
|
55
|
+
# Darwin, MinGW, and NonStop.
|
56
|
+
#
|
57
|
+
# (3) This script is generated from the Groovy template
|
58
|
+
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
59
|
+
# within the Gradle project.
|
60
|
+
#
|
61
|
+
# You can find Gradle at https://github.com/gradle/gradle/.
|
62
|
+
#
|
7
63
|
##############################################################################
|
8
64
|
|
9
|
-
#
|
10
|
-
|
65
|
+
# Attempt to set APP_HOME
|
66
|
+
|
67
|
+
# Resolve links: $0 may be a link
|
68
|
+
app_path=$0
|
69
|
+
|
70
|
+
# Need this for daisy-chained symlinks.
|
71
|
+
while
|
72
|
+
APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
|
73
|
+
[ -h "$app_path" ]
|
74
|
+
do
|
75
|
+
ls=$( ls -ld "$app_path" )
|
76
|
+
link=${ls#*' -> '}
|
77
|
+
case $link in #(
|
78
|
+
/*) app_path=$link ;; #(
|
79
|
+
*) app_path=$APP_HOME$link ;;
|
80
|
+
esac
|
81
|
+
done
|
82
|
+
|
83
|
+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
11
84
|
|
12
85
|
APP_NAME="Gradle"
|
13
|
-
APP_BASE_NAME
|
86
|
+
APP_BASE_NAME=${0##*/}
|
87
|
+
|
88
|
+
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
89
|
+
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
14
90
|
|
15
91
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
16
|
-
MAX_FD=
|
92
|
+
MAX_FD=maximum
|
17
93
|
|
18
|
-
warn (
|
94
|
+
warn () {
|
19
95
|
echo "$*"
|
20
|
-
}
|
96
|
+
} >&2
|
21
97
|
|
22
|
-
die (
|
98
|
+
die () {
|
23
99
|
echo
|
24
100
|
echo "$*"
|
25
101
|
echo
|
26
102
|
exit 1
|
27
|
-
}
|
103
|
+
} >&2
|
28
104
|
|
29
105
|
# OS specific support (must be 'true' or 'false').
|
30
106
|
cygwin=false
|
31
107
|
msys=false
|
32
108
|
darwin=false
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
;;
|
40
|
-
MINGW* )
|
41
|
-
msys=true
|
42
|
-
;;
|
109
|
+
nonstop=false
|
110
|
+
case "$( uname )" in #(
|
111
|
+
CYGWIN* ) cygwin=true ;; #(
|
112
|
+
Darwin* ) darwin=true ;; #(
|
113
|
+
MSYS* | MINGW* ) msys=true ;; #(
|
114
|
+
NONSTOP* ) nonstop=true ;;
|
43
115
|
esac
|
44
116
|
|
45
|
-
# Attempt to set APP_HOME
|
46
|
-
# Resolve links: $0 may be a link
|
47
|
-
PRG="$0"
|
48
|
-
# Need this for relative symlinks.
|
49
|
-
while [ -h "$PRG" ] ; do
|
50
|
-
ls=`ls -ld "$PRG"`
|
51
|
-
link=`expr "$ls" : '.*-> \(.*\)$'`
|
52
|
-
if expr "$link" : '/.*' > /dev/null; then
|
53
|
-
PRG="$link"
|
54
|
-
else
|
55
|
-
PRG=`dirname "$PRG"`"/$link"
|
56
|
-
fi
|
57
|
-
done
|
58
|
-
SAVED="`pwd`"
|
59
|
-
cd "`dirname \"$PRG\"`/" >/dev/null
|
60
|
-
APP_HOME="`pwd -P`"
|
61
|
-
cd "$SAVED" >/dev/null
|
62
|
-
|
63
117
|
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
64
118
|
|
119
|
+
|
65
120
|
# Determine the Java command to use to start the JVM.
|
66
121
|
if [ -n "$JAVA_HOME" ] ; then
|
67
122
|
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
68
123
|
# IBM's JDK on AIX uses strange locations for the executables
|
69
|
-
JAVACMD
|
124
|
+
JAVACMD=$JAVA_HOME/jre/sh/java
|
70
125
|
else
|
71
|
-
JAVACMD
|
126
|
+
JAVACMD=$JAVA_HOME/bin/java
|
72
127
|
fi
|
73
128
|
if [ ! -x "$JAVACMD" ] ; then
|
74
129
|
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
@@ -77,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the
|
|
77
132
|
location of your Java installation."
|
78
133
|
fi
|
79
134
|
else
|
80
|
-
JAVACMD=
|
135
|
+
JAVACMD=java
|
81
136
|
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
82
137
|
|
83
138
|
Please set the JAVA_HOME variable in your environment to match the
|
@@ -85,76 +140,95 @@ location of your Java installation."
|
|
85
140
|
fi
|
86
141
|
|
87
142
|
# Increase the maximum file descriptors if we can.
|
88
|
-
if
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
fi
|
143
|
+
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
144
|
+
case $MAX_FD in #(
|
145
|
+
max*)
|
146
|
+
MAX_FD=$( ulimit -H -n ) ||
|
147
|
+
warn "Could not query maximum file descriptor limit"
|
148
|
+
esac
|
149
|
+
case $MAX_FD in #(
|
150
|
+
'' | soft) :;; #(
|
151
|
+
*)
|
152
|
+
ulimit -n "$MAX_FD" ||
|
153
|
+
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
154
|
+
esac
|
101
155
|
fi
|
102
156
|
|
103
|
-
#
|
104
|
-
|
105
|
-
|
106
|
-
|
157
|
+
# Collect all arguments for the java command, stacking in reverse order:
|
158
|
+
# * args from the command line
|
159
|
+
# * the main class name
|
160
|
+
# * -classpath
|
161
|
+
# * -D...appname settings
|
162
|
+
# * --module-path (only if needed)
|
163
|
+
# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
|
164
|
+
|
165
|
+
# For Cygwin or MSYS, switch paths to Windows format before running java
|
166
|
+
if "$cygwin" || "$msys" ; then
|
167
|
+
APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
|
168
|
+
CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
|
169
|
+
|
170
|
+
JAVACMD=$( cygpath --unix "$JAVACMD" )
|
107
171
|
|
108
|
-
# For Cygwin, switch paths to Windows format before running java
|
109
|
-
if $cygwin ; then
|
110
|
-
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
111
|
-
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
112
|
-
JAVACMD=`cygpath --unix "$JAVACMD"`
|
113
|
-
|
114
|
-
# We build the pattern for arguments to be converted via cygpath
|
115
|
-
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
116
|
-
SEP=""
|
117
|
-
for dir in $ROOTDIRSRAW ; do
|
118
|
-
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
119
|
-
SEP="|"
|
120
|
-
done
|
121
|
-
OURCYGPATTERN="(^($ROOTDIRS))"
|
122
|
-
# Add a user-defined pattern to the cygpath arguments
|
123
|
-
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
124
|
-
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
125
|
-
fi
|
126
172
|
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
173
|
+
for arg do
|
174
|
+
if
|
175
|
+
case $arg in #(
|
176
|
+
-*) false ;; # don't mess with options #(
|
177
|
+
/?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
|
178
|
+
[ -e "$t" ] ;; #(
|
179
|
+
*) false ;;
|
180
|
+
esac
|
181
|
+
then
|
182
|
+
arg=$( cygpath --path --ignore --mixed "$arg" )
|
136
183
|
fi
|
137
|
-
|
184
|
+
# Roll the args list around exactly as many times as the number of
|
185
|
+
# args, so each arg winds up back in the position where it started, but
|
186
|
+
# possibly modified.
|
187
|
+
#
|
188
|
+
# NB: a `for` loop captures its iteration list before it begins, so
|
189
|
+
# changing the positional parameters here affects neither the number of
|
190
|
+
# iterations, nor the values presented in `arg`.
|
191
|
+
shift # remove old arg
|
192
|
+
set -- "$@" "$arg" # push replacement arg
|
138
193
|
done
|
139
|
-
case $i in
|
140
|
-
(0) set -- ;;
|
141
|
-
(1) set -- "$args0" ;;
|
142
|
-
(2) set -- "$args0" "$args1" ;;
|
143
|
-
(3) set -- "$args0" "$args1" "$args2" ;;
|
144
|
-
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
145
|
-
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
146
|
-
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
147
|
-
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
148
|
-
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
149
|
-
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
150
|
-
esac
|
151
194
|
fi
|
152
195
|
|
153
|
-
#
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
196
|
+
# Collect all arguments for the java command;
|
197
|
+
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
198
|
+
# shell script including quotes and variable substitutions, so put them in
|
199
|
+
# double quotes to make sure that they get re-expanded; and
|
200
|
+
# * put everything else in single quotes, so that it's not re-expanded.
|
201
|
+
|
202
|
+
set -- \
|
203
|
+
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
204
|
+
-classpath "$CLASSPATH" \
|
205
|
+
org.gradle.wrapper.GradleWrapperMain \
|
206
|
+
"$@"
|
207
|
+
|
208
|
+
# Use "xargs" to parse quoted args.
|
209
|
+
#
|
210
|
+
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
211
|
+
#
|
212
|
+
# In Bash we could simply go:
|
213
|
+
#
|
214
|
+
# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
|
215
|
+
# set -- "${ARGS[@]}" "$@"
|
216
|
+
#
|
217
|
+
# but POSIX shell has neither arrays nor command substitution, so instead we
|
218
|
+
# post-process each arg (as a line of input to sed) to backslash-escape any
|
219
|
+
# character that might be a shell metacharacter, then use eval to reverse
|
220
|
+
# that process (while maintaining the separation between arguments), and wrap
|
221
|
+
# the whole thing up as a single "set" statement.
|
222
|
+
#
|
223
|
+
# This will of course break if any of these variables contains a newline or
|
224
|
+
# an unmatched quote.
|
225
|
+
#
|
226
|
+
|
227
|
+
eval "set -- $(
|
228
|
+
printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
|
229
|
+
xargs -n1 |
|
230
|
+
sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
|
231
|
+
tr '\n' ' '
|
232
|
+
)" '"$@"'
|
233
|
+
|
234
|
+
exec "$JAVACMD" "$@"
|