detox 20.1.0-next-is-hittable-check.0 → 20.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/.eslintrc.js +2 -7
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar → 20.1.1/detox-20.1.1-javadoc.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar → 20.1.1/detox-20.1.1-sources.jar} +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1-sources.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar +0 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom → 20.1.1/detox-20.1.1.pom} +1 -1
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.md5 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.sha1 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.pom.sha256 +1 -0
- package/Detox-android/com/wix/detox/20.1.1/detox-20.1.1.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 +0 -1
- package/android/detox/src/full/java/com/wix/detox/TestEngineFacade.kt +3 -3
- package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt +12 -80
- package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt +16 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/idlingresources/DescriptiveIdlingResource.kt +8 -0
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/BusyResourcesInquirer.kt +48 -0
- package/android/detox/src/full/java/com/wix/detox/inquiry/DetoxBusyResource.kt +92 -0
- package/android/detox/src/full/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescription.kt → inquiry/DetoxBusyResourceDescription.kt} +6 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AnimatedModuleIdlingResource.java +18 -7
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResource.kt +3 -4
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/BridgeIdlingResource.java +12 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DetoxBaseIdlingResource.java +2 -0
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResource.java +14 -8
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResource.kt +2 -6
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIManagerModuleReflected.kt +1 -1
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/uimodule/UIModuleIdlingResource.kt +4 -6
- package/android/detox/src/testFull/java/com/wix/detox/adapters/server/QueryStatusActionHandlerSpec.kt +35 -94
- package/android/detox/src/testFull/java/com/wix/detox/espresso/registry/{IRStatusInquirerTest.kt → BusyResourcesInquirerTest.kt} +46 -7
- package/android/detox/src/testFull/java/com/wix/detox/{reactnative/idlingresources/IdlingResourceDescriptionSpec.kt → inquiry/DetoxBusyResourceDescriptionSpec.kt} +6 -6
- package/android/detox/src/testFull/java/com/wix/detox/inquiry/DetoxBusyResourceSpec.kt +134 -0
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/AsyncStorageIdlingResourceSpec.kt +4 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/NetworkIdlingResourcesTest.kt +5 -5
- package/android/detox/src/testFull/java/com/wix/detox/reactnative/idlingresources/timers/TimersIdlingResourceSpec.kt +4 -6
- package/index.d.ts +102 -18
- package/index.js +12 -1
- package/internals.d.ts +34 -9
- package/internals.js +10 -3
- package/local-cli/cli.js +6 -3
- package/local-cli/init.js +1 -1
- package/local-cli/test.js +6 -6
- package/local-cli/testCommand/TestRunnerCommand.js +97 -94
- package/local-cli/testCommand/TestRunnerError.js +17 -0
- 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/package.json +31 -16
- package/runners/deprecation.js +42 -44
- package/runners/jest/index.d.ts +60 -0
- package/runners/jest/index.js +3 -8
- package/runners/jest/reporters/DetoxReporter.js +21 -10
- package/runners/jest/testEnvironment/index.js +57 -41
- package/runners/jest/testEnvironment/listeners/DetoxCoreListener.js +62 -35
- package/runners/jest/testEnvironment/listeners/SpecReporter.js +12 -14
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +1 -5
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +17 -3
- package/src/DetoxWorker.js +96 -50
- package/src/android/core/NativeMatcher.js +14 -10
- package/src/android/espressoapi/EspressoDetox.js +1 -1
- package/src/android/espressoapi/web/WebElement.js +1 -1
- package/src/android/interactions/native.js +3 -2
- package/src/android/matchers/native.js +1 -2
- package/src/artifacts/ArtifactsManager.js +6 -6
- package/src/artifacts/templates/plugin/ArtifactPlugin.js +1 -1
- package/src/artifacts/templates/plugin/TwoSnapshotsPerTestPlugin.js +2 -1
- package/src/artifacts/templates/plugin/WholeTestRecorderPlugin.js +3 -2
- package/src/artifacts/utils/temporaryPath.js +32 -2
- package/src/client/AsyncWebSocket.js +3 -2
- package/src/client/actions/SyncStatusSchema.json +21 -0
- package/src/client/actions/formatters/SyncStatusFormatter.js +2 -0
- package/src/client/actions/formatters/sync-resources/BgThreadFormatter.js +5 -0
- package/src/configuration/collectCliConfig.js +2 -13
- package/src/configuration/composeLoggerConfig.js +1 -0
- package/src/configuration/composeRunnerConfig.js +5 -4
- package/src/devices/allocation/drivers/AllocationDriverBase.js +4 -2
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +3 -3
- package/src/devices/allocation/drivers/android/emulator/launchEmulatorProcess.js +3 -16
- package/src/devices/allocation/factories/base.js +1 -1
- package/src/devices/common/drivers/android/exec/ADB.js +4 -0
- package/src/devices/common/drivers/android/tools/AppInstallHelper.js +4 -4
- package/src/devices/common/drivers/android/tools/{FileXfer.js → FileTransfer.js} +2 -2
- package/src/devices/common/drivers/android/tools/TempFileTransfer.js +14 -0
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +1 -1
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +2 -0
- package/src/devices/runtime/RuntimeDevice.js +3 -3
- package/src/devices/runtime/drivers/android/AndroidDriver.js +7 -6
- package/src/devices/runtime/factories/android.js +6 -5
- package/src/devices/runtime/factories/base.js +3 -2
- package/src/errors/DetoxConfigErrorComposer.js +6 -1
- package/src/errors/DetoxError.js +5 -1
- package/src/ios/expectTwo.js +22 -13
- package/src/ipc/IPCClient.js +26 -17
- package/src/ipc/IPCServer.js +11 -3
- package/src/ipc/SessionState.js +11 -11
- package/src/logger/DetoxLogger.js +67 -47
- package/src/logger/index.js +1 -0
- package/src/logger/utils/BunyanLogger.js +54 -10
- package/src/logger/utils/CategoryThreadDispatcher.js +8 -29
- package/src/logger/utils/DetoxLogFinalizer.js +166 -0
- package/src/logger/utils/MessageStack.js +17 -6
- package/src/logger/utils/ThreadDispatcher.js +5 -25
- package/src/logger/utils/customConsoleLogger.js +22 -5
- package/src/logger/utils/getMainCategory.js +5 -0
- package/src/logger/utils/sanitizeBunyanContext.js +3 -1
- package/src/logger/utils/streams/BunyanTransformer.js +72 -0
- package/src/logger/utils/streams/ChromeTraceTransformer.js +132 -0
- package/src/logger/utils/streams/DetoxJSONLParser.js +31 -0
- package/src/logger/utils/streams/JSONLStringer.js +55 -0
- package/src/logger/utils/streams/index.js +7 -0
- package/src/logger/utils/streams/transformers.js +39 -0
- package/src/logger/utils/tracerLegacy.js +14 -25
- package/src/realms/DetoxContext.js +16 -9
- package/src/realms/DetoxInternalsFacade.js +1 -7
- package/src/realms/DetoxPrimaryContext.js +42 -87
- package/src/realms/DetoxSecondaryContext.js +9 -13
- package/src/{symbols.js → realms/symbols.js} +0 -0
- package/src/servicelocator/android/index.js +2 -2
- package/src/utils/ExclusiveLockfile.js +1 -0
- package/src/utils/argparse.js +11 -27
- package/src/utils/logger.js +1 -1
- package/src/utils/pathUtils.js +11 -0
- package/src/utils/shellUtils.js +17 -0
- package/src/utils/traceInvocationCall.js +21 -0
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar +0 -0
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/20.1.0-next-is-hittable-check.0/detox-20.1.0-next-is-hittable-check.0.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/registry/IRStatusInquirer.kt +0 -24
- package/android/detox/src/full/java/com/wix/detox/reactnative/idlingresources/DescriptiveIdlingResource.kt +0 -10
- package/local-cli/build.test.js +0 -104
- package/local-cli/run-server.test.js +0 -23
- package/local-cli/test.test.js +0 -569
- package/runners/jest/deprecation.js +0 -25
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +0 -23
- package/src/configuration/utils/warnings.js +0 -12
- package/src/devices/common/drivers/android/tools/TempFileXfer.js +0 -16
- package/src/logger/utils/streamUtils.js +0 -240
- package/src/realms/index.js +0 -10
- package/src/utils/trace.js +0 -3
package/.eslintrc.js
CHANGED
@@ -17,7 +17,7 @@ module.exports = {
|
|
17
17
|
node: true
|
18
18
|
},
|
19
19
|
globals: {
|
20
|
-
|
20
|
+
// TODO: remove use of fail() across the project because Jest Circus doesn't support it
|
21
21
|
'fail': true
|
22
22
|
},
|
23
23
|
rules: {
|
@@ -54,12 +54,7 @@ module.exports = {
|
|
54
54
|
}
|
55
55
|
],
|
56
56
|
'no-prototype-builtins': 'off',
|
57
|
-
'no-unused-vars':
|
58
|
-
'error',
|
59
|
-
{
|
60
|
-
'argsIgnorePattern': '^_'
|
61
|
-
}
|
62
|
-
],
|
57
|
+
'no-unused-vars': 'off',
|
63
58
|
'node/no-unpublished-require': 'warn',
|
64
59
|
'object-curly-spacing': [
|
65
60
|
'error',
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
3533d80394c8bfe48da303ca68dd1f89
|
@@ -0,0 +1 @@
|
|
1
|
+
4113dbb267c11ac42088bc269e86cde5bc6db556
|
@@ -0,0 +1 @@
|
|
1
|
+
13c9c7d4904c88e394d57285cad46a9ceeb93e89341c6cc8b2367fcf89f05a1c
|
@@ -0,0 +1 @@
|
|
1
|
+
1bba8a54331fb99a135bb5fa6230c06ac1eeee49a1c82457ab4a93d556dabecb82562fc4ed28890a2482aa23bb2abd29c5f1c7a67053161a2d45c6258493021d
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
4457ab21cced7cb4abc14a3a1bfd382e
|
@@ -0,0 +1 @@
|
|
1
|
+
06d2b66f9a4f83667da69bc232a41d9a9be65dae
|
@@ -0,0 +1 @@
|
|
1
|
+
8c600ab5f63651b72eb24f709a3cd1c4a854b7aeb698edf3df4ee4ba8b62faef
|
@@ -0,0 +1 @@
|
|
1
|
+
475b2e2805f4056469824ab7c0ba5ac1f149eea95d4a19f19e49d448151644db5d813d627f230a95d26f23e727c8c54205ab8da7e6c8e99f8284d6e4b11c8642
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
c7eb63b23e9fec3154e5402cc0f65283
|
@@ -0,0 +1 @@
|
|
1
|
+
16bed62cec4774262c71a7daad13efcdac3c7942
|
@@ -0,0 +1 @@
|
|
1
|
+
c12164b0a26a6db45c65d984af4c2a880e2bf5d516ceb582361576eff713e378
|
@@ -0,0 +1 @@
|
|
1
|
+
d50db96253552903c6acf2328ff2baa9788aac5846622bc01c4c9e6026738991f6eea1ea2723afe21ffdec692a3caeadb39b6ac5cfb31bf40c7d184e058701bb
|
@@ -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.1.
|
6
|
+
<version>20.1.1</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
|
+
206c05d36b87423370c11d774d657d2c
|
@@ -0,0 +1 @@
|
|
1
|
+
7d21c64abcb385dc4abad4710aa28a07bc0a0139
|
@@ -0,0 +1 @@
|
|
1
|
+
621bb24a95f5b035a6a3aa83f7a8539f65b8bef7dad040decef5baf855989303
|
@@ -0,0 +1 @@
|
|
1
|
+
8501704d10d93054cc9707fac37e85433003e6922dbc35e44011bf43660c402871c2fd830c6ad699e7ac455dbf780650ab34726c8548b9e495dcfbadb6b470a2
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<groupId>com.wix</groupId>
|
4
4
|
<artifactId>detox</artifactId>
|
5
5
|
<versioning>
|
6
|
-
<latest>20.1.
|
7
|
-
<release>20.1.
|
6
|
+
<latest>20.1.1</latest>
|
7
|
+
<release>20.1.1</release>
|
8
8
|
<versions>
|
9
|
-
<version>20.1.
|
9
|
+
<version>20.1.1</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20221228155305</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
34496b51530e21c8da62be3f7ae4ea68
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
c9ac4db5ef1c06124081c598f688aad051cf8ac1
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
800f040e828f15c49d2189d6c80f99c3433ceabb063f87413b60eaeb17e5a48d
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
696664270a4a6893fdb1193f79851a049a08294a5f16c0696ecc40999543eff16367c6bd1aebad62305820ecf447056a620fc65f45aa4aca6f33914cb78680b4
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios.tbz
CHANGED
Binary file
|
package/android/build.gradle
CHANGED
@@ -5,16 +5,16 @@ import android.util.Log
|
|
5
5
|
import androidx.test.espresso.Espresso
|
6
6
|
import com.wix.detox.common.DetoxLog.Companion.LOG_TAG
|
7
7
|
import com.wix.detox.espresso.UiAutomatorHelper
|
8
|
-
import com.wix.detox.espresso.registry.
|
8
|
+
import com.wix.detox.espresso.registry.BusyResourcesInquirer
|
9
9
|
import com.wix.detox.reactnative.ReactNativeExtension
|
10
10
|
|
11
11
|
class TestEngineFacade {
|
12
|
-
fun awaitIdle(): Unit? = Espresso.onIdle
|
12
|
+
fun awaitIdle(): Unit? = Espresso.onIdle {
|
13
13
|
Log.i(LOG_TAG, "Wait is over: App is now idle!")
|
14
14
|
null
|
15
15
|
}
|
16
16
|
fun syncIdle() = UiAutomatorHelper.espressoSync() // TODO Check whether this can be replaced with #awaitIdle()
|
17
|
-
fun
|
17
|
+
fun getAllBusyResources() = BusyResourcesInquirer.INSTANCE.getAllBusyResources()
|
18
18
|
|
19
19
|
// TODO Refactor RN related stuff away
|
20
20
|
fun reloadReactNative(appContext: Context) = ReactNativeExtension.reloadReactNative(appContext)
|
package/android/detox/src/full/java/com/wix/detox/adapters/server/QueryStatusActionHandler.kt
CHANGED
@@ -1,96 +1,28 @@
|
|
1
1
|
package com.wix.detox.adapters.server
|
2
2
|
|
3
|
-
import androidx.test.espresso.IdlingResource
|
4
3
|
import com.wix.detox.TestEngineFacade
|
5
|
-
import com.wix.detox.
|
4
|
+
import com.wix.detox.inquiry.DetoxBusyResource
|
6
5
|
|
7
6
|
class QueryStatusActionHandler(
|
8
7
|
private val outboundServerAdapter: OutboundServerAdapter,
|
9
8
|
private val testEngineFacade: TestEngineFacade
|
10
|
-
)
|
11
|
-
: DetoxActionHandler {
|
9
|
+
) : DetoxActionHandler {
|
12
10
|
|
13
11
|
override fun handle(params: String, messageId: Long) {
|
14
|
-
val
|
15
|
-
data
|
16
|
-
|
12
|
+
val busyResources = testEngineFacade.getAllBusyResources()
|
13
|
+
val data = mapOf<String, Any?>(
|
14
|
+
"status" to formatStatus(busyResources)
|
15
|
+
)
|
17
16
|
outboundServerAdapter.sendMessage("currentStatusResult", data, messageId)
|
18
17
|
}
|
19
18
|
|
20
|
-
private fun formatStatus(busyResources: List<
|
19
|
+
private fun formatStatus(busyResources: List<DetoxBusyResource>): Map<String, Any> =
|
21
20
|
if (busyResources.isEmpty()) {
|
22
|
-
|
23
|
-
}
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
status["busy_resources"] = busyResources.map{ formatResource(it) }
|
28
|
-
|
29
|
-
return status
|
30
|
-
}
|
31
|
-
|
32
|
-
private fun formatResource(resource: IdlingResource): Map<String, Any> {
|
33
|
-
if (resource is DescriptiveIdlingResource) {
|
34
|
-
return resource.getDescription().json()
|
35
|
-
}
|
36
|
-
|
37
|
-
if (resource.javaClass.name.contains("LooperIdlingResource")) {
|
38
|
-
return formatLooperResourceFromName(resource.name)
|
39
|
-
}
|
40
|
-
|
41
|
-
return mapOf<String, Any>(
|
42
|
-
"name" to "unknown",
|
43
|
-
"description" to mapOf<String, Any>(
|
44
|
-
"identifier" to resource.name
|
21
|
+
mapOf("app_status" to "idle")
|
22
|
+
} else {
|
23
|
+
mapOf(
|
24
|
+
"app_status" to "busy",
|
25
|
+
"busy_resources" to busyResources.map { it.getDescription().json() }
|
45
26
|
)
|
46
|
-
)
|
47
|
-
}
|
48
|
-
|
49
|
-
private fun formatLooperResourceFromName(resourceName: String): Map<String, Any> {
|
50
|
-
return when {
|
51
|
-
isJSCodeExecution(resourceName) -> {
|
52
|
-
formatLooperResource(
|
53
|
-
"\"${resourceName}\" (JS Thread)",
|
54
|
-
"JavaScript code"
|
55
|
-
)
|
56
|
-
}
|
57
|
-
isNativeCodeExecution(resourceName) -> {
|
58
|
-
formatLooperResource(
|
59
|
-
"\"${resourceName}\" (Native Modules Thread)",
|
60
|
-
"native module calls"
|
61
|
-
)
|
62
|
-
}
|
63
|
-
else -> {
|
64
|
-
formatLooperResource(
|
65
|
-
"\"${resourceName}\""
|
66
|
-
)
|
67
|
-
}
|
68
27
|
}
|
69
|
-
}
|
70
|
-
|
71
|
-
/**
|
72
|
-
* @see URL https://reactnative.dev/docs/profiling
|
73
|
-
*/
|
74
|
-
private fun isJSCodeExecution(looperName: String): Boolean {
|
75
|
-
return looperName.contains("mqt_js")
|
76
|
-
}
|
77
|
-
|
78
|
-
private fun formatLooperResource(thread: String, executionType: String? = null): Map<String, Any> {
|
79
|
-
return mapOf<String, Any>(
|
80
|
-
"name" to "looper",
|
81
|
-
"description" to
|
82
|
-
mutableMapOf<String, Any>(
|
83
|
-
"thread" to thread
|
84
|
-
).apply {
|
85
|
-
if (executionType != null) put("execution_type", executionType)
|
86
|
-
}
|
87
|
-
)
|
88
|
-
}
|
89
|
-
|
90
|
-
/**
|
91
|
-
* @see URL https://reactnative.dev/docs/profiling
|
92
|
-
*/
|
93
|
-
private fun isNativeCodeExecution(looperName: String): Boolean {
|
94
|
-
return looperName.contains("mqt_native")
|
95
|
-
}
|
96
28
|
}
|
package/android/detox/src/full/java/com/wix/detox/espresso/common/UiControllerImplReflected.kt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
package com.wix.detox.espresso.common
|
2
|
+
|
3
|
+
import com.wix.detox.espresso.action.common.utils.getUiController
|
4
|
+
import org.joor.Reflect
|
5
|
+
|
6
|
+
private const val FIELD_ASYNC_IDLE = "asyncIdle"
|
7
|
+
private const val FIELD_COMPAT_IDLE = "compatIdle"
|
8
|
+
private const val METHOD_IS_IDLE_NOW = "isIdleNow"
|
9
|
+
|
10
|
+
class UiControllerImplReflected {
|
11
|
+
fun isAsyncIdleNow(): Boolean =
|
12
|
+
Reflect.on(getUiController()).field(FIELD_ASYNC_IDLE).call(METHOD_IS_IDLE_NOW).get()
|
13
|
+
|
14
|
+
fun isCompatIdleNow(): Boolean =
|
15
|
+
Reflect.on(getUiController()).field(FIELD_COMPAT_IDLE).call(METHOD_IS_IDLE_NOW).get()
|
16
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
package com.wix.detox.espresso.registry
|
2
|
+
|
3
|
+
import androidx.test.espresso.Espresso
|
4
|
+
import androidx.test.espresso.base.IdlingResourceRegistry
|
5
|
+
import com.wix.detox.common.UIThread
|
6
|
+
import com.wix.detox.espresso.common.UiControllerImplReflected
|
7
|
+
import com.wix.detox.inquiry.DetoxBusyResource
|
8
|
+
import com.wix.detox.inquiry.DetoxBusyResource.BusyAsyncTasks
|
9
|
+
import com.wix.detox.inquiry.DetoxBusyResource.BusyIdlingResource
|
10
|
+
import org.joor.Reflect
|
11
|
+
import java.util.concurrent.Callable
|
12
|
+
|
13
|
+
// TODO Better to split inquiry to two separate classes running under the single `UIThread.postFirstSync()` we have here.
|
14
|
+
class BusyResourcesInquirer(
|
15
|
+
private val registry: IdlingResourceRegistry,
|
16
|
+
private val uiControllerImplReflected: UiControllerImplReflected
|
17
|
+
) {
|
18
|
+
fun getAllBusyResources(): List<DetoxBusyResource> {
|
19
|
+
return UIThread.postFirstSync(Callable<List<DetoxBusyResource>> {
|
20
|
+
mutableListOf<DetoxBusyResource>().apply {
|
21
|
+
addAll(getBusyIdlingResources())
|
22
|
+
addAll(getAsyncTasksResource()?.let { listOf(it) } ?: emptyList())
|
23
|
+
}
|
24
|
+
})
|
25
|
+
}
|
26
|
+
|
27
|
+
private fun getBusyIdlingResources(): List<BusyIdlingResource> =
|
28
|
+
registry.resources
|
29
|
+
.filter { !it.isIdleNow }
|
30
|
+
.map { BusyIdlingResource(it) }
|
31
|
+
|
32
|
+
private fun getAsyncTasksResource(): BusyAsyncTasks? {
|
33
|
+
// Mind the implicit optimization:
|
34
|
+
// Don't inspect both resources if not necessary (async-tasks is not idle).
|
35
|
+
if (uiControllerImplReflected.isAsyncIdleNow() &&
|
36
|
+
uiControllerImplReflected.isCompatIdleNow()) {
|
37
|
+
return null
|
38
|
+
}
|
39
|
+
return BusyAsyncTasks
|
40
|
+
}
|
41
|
+
|
42
|
+
companion object {
|
43
|
+
val INSTANCE = BusyResourcesInquirer(getRegistryDefault(), UiControllerImplReflected())
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
private fun getRegistryDefault() =
|
48
|
+
Reflect.on(Espresso::class.java).get<IdlingResourceRegistry>("baseRegistry")
|
@@ -0,0 +1,92 @@
|
|
1
|
+
package com.wix.detox.inquiry
|
2
|
+
|
3
|
+
import androidx.test.espresso.IdlingResource
|
4
|
+
import com.wix.detox.espresso.idlingresources.DescriptiveIdlingResource
|
5
|
+
|
6
|
+
sealed class DetoxBusyResource {
|
7
|
+
abstract fun getDescription(): DetoxBusyResourceDescription
|
8
|
+
|
9
|
+
class BusyIdlingResource(val resource: IdlingResource): DetoxBusyResource() {
|
10
|
+
override fun getDescription() =
|
11
|
+
when {
|
12
|
+
(resource is DescriptiveIdlingResource) ->
|
13
|
+
getIRDescription(resource)
|
14
|
+
|
15
|
+
(resource.javaClass.name.contains("LooperIdlingResource")) ->
|
16
|
+
getLooperResourceDescriptionByName(resource.name)
|
17
|
+
|
18
|
+
else ->
|
19
|
+
getUnspecifiedResourceDescription(resource)
|
20
|
+
}
|
21
|
+
|
22
|
+
private fun getIRDescription(resource: DescriptiveIdlingResource) =
|
23
|
+
DetoxBusyResourceDescription.Builder()
|
24
|
+
.name(resource.getDebugName())
|
25
|
+
.apply {
|
26
|
+
resource.getBusyHint()?.let {
|
27
|
+
it.forEach { hint -> addDescription(hint.key, hint.value) }
|
28
|
+
}
|
29
|
+
}
|
30
|
+
.build()
|
31
|
+
|
32
|
+
private fun getLooperResourceDescriptionByName(resourceName: String) =
|
33
|
+
when {
|
34
|
+
isJSCodeExecution(resourceName) -> {
|
35
|
+
getLooperResourceDesc(
|
36
|
+
thread = "\"${resourceName}\" (JS Thread)",
|
37
|
+
executionType = "JavaScript code"
|
38
|
+
)
|
39
|
+
}
|
40
|
+
isNativeCodeExecution(resourceName) -> {
|
41
|
+
getLooperResourceDesc(
|
42
|
+
thread = "\"${resourceName}\" (Native Modules Thread)",
|
43
|
+
executionType = "native module calls"
|
44
|
+
)
|
45
|
+
}
|
46
|
+
else -> {
|
47
|
+
getLooperResourceDesc(
|
48
|
+
thread = "\"${resourceName}\""
|
49
|
+
)
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
private fun getUnspecifiedResourceDescription(resource: IdlingResource) =
|
54
|
+
DetoxBusyResourceDescription.Builder()
|
55
|
+
.name("unknown")
|
56
|
+
.addDescription("identifier", resource.name)
|
57
|
+
.build()
|
58
|
+
|
59
|
+
/**
|
60
|
+
* @see URL https://reactnative.dev/docs/profiling
|
61
|
+
*/
|
62
|
+
private fun isJSCodeExecution(looperName: String): Boolean {
|
63
|
+
return looperName.contains("mqt_js")
|
64
|
+
}
|
65
|
+
|
66
|
+
private fun getLooperResourceDesc(thread: String, executionType: String? = null) =
|
67
|
+
DetoxBusyResourceDescription.Builder()
|
68
|
+
.name("looper")
|
69
|
+
.addDescription("thread", thread)
|
70
|
+
.apply {
|
71
|
+
executionType?.let { addDescription("execution_type", executionType) }
|
72
|
+
}
|
73
|
+
.build()
|
74
|
+
|
75
|
+
/**
|
76
|
+
* @see URL https://reactnative.dev/docs/profiling
|
77
|
+
*/
|
78
|
+
private fun isNativeCodeExecution(looperName: String): Boolean {
|
79
|
+
return looperName.contains("mqt_native")
|
80
|
+
}
|
81
|
+
|
82
|
+
}
|
83
|
+
|
84
|
+
object BusyAsyncTasks: DetoxBusyResource() {
|
85
|
+
override fun getDescription() =
|
86
|
+
DetoxBusyResourceDescription.Builder()
|
87
|
+
.name("bg")
|
88
|
+
.addDescription("reason", "native async-tasks")
|
89
|
+
.build()
|
90
|
+
|
91
|
+
}
|
92
|
+
}
|
@@ -1,17 +1,17 @@
|
|
1
|
-
package com.wix.detox.
|
1
|
+
package com.wix.detox.inquiry
|
2
2
|
|
3
|
-
class
|
3
|
+
class DetoxBusyResourceDescription private constructor(
|
4
4
|
private val name: String,
|
5
5
|
private val description: Map<String, Any>) {
|
6
6
|
|
7
|
-
fun json() =
|
7
|
+
fun json(): Map<String, Any> =
|
8
8
|
mutableMapOf<String, Any>("name" to name)
|
9
9
|
.apply {
|
10
10
|
if (description.isNotEmpty()) put("description", description)
|
11
|
-
}
|
11
|
+
}
|
12
12
|
|
13
13
|
override fun equals(other: Any?) =
|
14
|
-
(other is
|
14
|
+
(other is DetoxBusyResourceDescription && other.json() == this.json())
|
15
15
|
|
16
16
|
override fun hashCode(): Int =
|
17
17
|
(31 * name.hashCode() + description.hashCode())
|
@@ -21,6 +21,6 @@ class IdlingResourceDescription private constructor(
|
|
21
21
|
var description: MutableMap<String, Any> = mutableMapOf()) {
|
22
22
|
fun name(value: String) = apply { name = value }
|
23
23
|
fun addDescription(key: String, value: Any) = apply { description[key] = value }
|
24
|
-
fun build() =
|
24
|
+
fun build() = DetoxBusyResourceDescription(name, description)
|
25
25
|
}
|
26
26
|
}
|
@@ -3,13 +3,17 @@ package com.wix.detox.reactnative.idlingresources;
|
|
3
3
|
import android.util.Log;
|
4
4
|
import android.view.Choreographer;
|
5
5
|
|
6
|
+
import com.wix.detox.espresso.idlingresources.DescriptiveIdlingResource;
|
6
7
|
import com.wix.detox.reactnative.ReactNativeInfo;
|
7
8
|
|
8
|
-
import org.jetbrains.annotations.NotNull;
|
9
9
|
import org.joor.Reflect;
|
10
10
|
import org.joor.ReflectException;
|
11
11
|
|
12
|
+
import java.util.HashMap;
|
13
|
+
import java.util.Map;
|
14
|
+
|
12
15
|
import androidx.annotation.NonNull;
|
16
|
+
import androidx.annotation.Nullable;
|
13
17
|
|
14
18
|
/**
|
15
19
|
* Created by simonracz on 25/08/2017.
|
@@ -51,6 +55,10 @@ public class AnimatedModuleIdlingResource implements DescriptiveIdlingResource,
|
|
51
55
|
|
52
56
|
private final static String METHOD_HAS_ACTIVE_ANIMATIONS = "hasActiveAnimations";
|
53
57
|
|
58
|
+
private final static Map<String, Object> busyHint = new HashMap<String, Object>() {{
|
59
|
+
put("reason", "Animations running on screen");
|
60
|
+
}};
|
61
|
+
|
54
62
|
private ResourceCallback callback = null;
|
55
63
|
private Object reactContext = null;
|
56
64
|
|
@@ -63,13 +71,16 @@ public class AnimatedModuleIdlingResource implements DescriptiveIdlingResource,
|
|
63
71
|
return AnimatedModuleIdlingResource.class.getName();
|
64
72
|
}
|
65
73
|
|
66
|
-
@
|
74
|
+
@NonNull
|
75
|
+
@Override
|
76
|
+
public String getDebugName() {
|
77
|
+
return "ui";
|
78
|
+
}
|
79
|
+
|
80
|
+
@Nullable
|
67
81
|
@Override
|
68
|
-
public
|
69
|
-
return
|
70
|
-
.name("ui")
|
71
|
-
.addDescription("reason", "Animations running on screen")
|
72
|
-
.build();
|
82
|
+
public Map<String, Object> getBusyHint() {
|
83
|
+
return busyHint;
|
73
84
|
}
|
74
85
|
|
75
86
|
@Override
|
@@ -4,6 +4,7 @@ import android.util.Log
|
|
4
4
|
import androidx.test.espresso.IdlingResource
|
5
5
|
import com.facebook.react.bridge.NativeModule
|
6
6
|
import com.facebook.react.bridge.ReactContext
|
7
|
+
import com.wix.detox.espresso.idlingresources.DescriptiveIdlingResource
|
7
8
|
import com.wix.detox.reactnative.helpers.RNHelpers
|
8
9
|
import org.joor.Reflect
|
9
10
|
import java.util.concurrent.Executor
|
@@ -50,10 +51,8 @@ open class AsyncStorageIdlingResource
|
|
50
51
|
}
|
51
52
|
|
52
53
|
override fun getName(): String = javaClass.name
|
53
|
-
|
54
|
-
override fun
|
55
|
-
return IdlingResourceDescription.Builder().name("io").build()
|
56
|
-
}
|
54
|
+
override fun getDebugName() = "io"
|
55
|
+
override fun getBusyHint(): Map<String, Any>? = null
|
57
56
|
|
58
57
|
override fun isIdleNow(): Boolean =
|
59
58
|
checkIdle().also { idle ->
|
@@ -5,12 +5,12 @@ import android.util.Log;
|
|
5
5
|
import com.facebook.react.bridge.NotThreadSafeBridgeIdleDebugListener;
|
6
6
|
import com.facebook.react.bridge.ReactContext;
|
7
7
|
|
8
|
-
import org.jetbrains.annotations.NotNull;
|
9
|
-
|
10
|
-
import java.util.HashMap;
|
11
8
|
import java.util.Map;
|
12
9
|
import java.util.concurrent.atomic.AtomicBoolean;
|
13
10
|
|
11
|
+
import androidx.annotation.NonNull;
|
12
|
+
import androidx.annotation.Nullable;
|
13
|
+
|
14
14
|
/**
|
15
15
|
* Created by simonracz on 01/06/2017.
|
16
16
|
*/
|
@@ -42,10 +42,16 @@ public class BridgeIdlingResource extends DetoxBaseIdlingResource implements Not
|
|
42
42
|
return BridgeIdlingResource.class.getName();
|
43
43
|
}
|
44
44
|
|
45
|
-
@
|
45
|
+
@NonNull
|
46
|
+
@Override
|
47
|
+
public String getDebugName() {
|
48
|
+
return "bridge";
|
49
|
+
}
|
50
|
+
|
51
|
+
@Nullable
|
46
52
|
@Override
|
47
|
-
public
|
48
|
-
return
|
53
|
+
public Map<String, Object> getBusyHint() {
|
54
|
+
return null;
|
49
55
|
}
|
50
56
|
|
51
57
|
@Override
|
@@ -1,5 +1,7 @@
|
|
1
1
|
package com.wix.detox.reactnative.idlingresources;
|
2
2
|
|
3
|
+
import com.wix.detox.espresso.idlingresources.DescriptiveIdlingResource;
|
4
|
+
|
3
5
|
import java.util.concurrent.atomic.AtomicBoolean;
|
4
6
|
|
5
7
|
public abstract class DetoxBaseIdlingResource implements DescriptiveIdlingResource {
|
@@ -5,16 +5,17 @@ import android.view.Choreographer;
|
|
5
5
|
|
6
6
|
import com.facebook.react.bridge.ReactContext;
|
7
7
|
|
8
|
-
import org.jetbrains.annotations.NotNull;
|
9
|
-
|
10
8
|
import java.util.ArrayList;
|
9
|
+
import java.util.HashMap;
|
11
10
|
import java.util.HashSet;
|
12
11
|
import java.util.List;
|
12
|
+
import java.util.Map;
|
13
13
|
import java.util.Set;
|
14
14
|
import java.util.regex.Pattern;
|
15
15
|
import java.util.regex.PatternSyntaxException;
|
16
16
|
|
17
17
|
import androidx.annotation.NonNull;
|
18
|
+
import androidx.annotation.Nullable;
|
18
19
|
import okhttp3.Call;
|
19
20
|
import okhttp3.Dispatcher;
|
20
21
|
|
@@ -67,13 +68,18 @@ public class NetworkIdlingResource extends DetoxBaseIdlingResource implements Ch
|
|
67
68
|
return NetworkIdlingResource.class.getName();
|
68
69
|
}
|
69
70
|
|
70
|
-
@
|
71
|
+
@NonNull
|
72
|
+
@Override
|
73
|
+
public String getDebugName() {
|
74
|
+
return "network";
|
75
|
+
}
|
76
|
+
|
77
|
+
@Nullable
|
71
78
|
@Override
|
72
|
-
public synchronized
|
73
|
-
return new
|
74
|
-
|
75
|
-
|
76
|
-
.build();
|
79
|
+
public synchronized Map<String, Object> getBusyHint() {
|
80
|
+
return new HashMap<String, Object>() {{
|
81
|
+
put("urls", new ArrayList<>(busyResources));
|
82
|
+
}};
|
77
83
|
}
|
78
84
|
|
79
85
|
@Override
|