detox 19.7.1 → 20.0.0-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/{19.7.1/detox-19.7.1-javadoc.jar → 20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-javadoc.jar} +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-javadoc.jar.md5 +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-javadoc.jar.sha1 +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-javadoc.jar.sha256 +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-javadoc.jar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.7.1/detox-19.7.1-sources.jar → 20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0-sources.jar} +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-sources.jar.md5 +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.sha1 +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.sha256 +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.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.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 +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.aar.sha1 +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.aar.sha256 +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.aar.sha512 +1 -0
- package/Detox-android/com/wix/detox/{19.7.1/detox-19.7.1.pom → 20.0.0-breaking.new-global-lifecycle.0/detox-20.0.0-breaking.new-global-lifecycle.0.pom} +1 -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 +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.sha1 +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.sha256 +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.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/src/full/java/com/wix/detox/Detox.java +2 -59
- package/android/detox/src/full/java/com/wix/detox/NotificationDataParser.kt +3 -3
- package/android/detox/src/full/java/com/wix/detox/espresso/DetoxAction.java +3 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/matcher/ViewMatchers.kt +23 -16
- package/android/detox/src/main/java/com/wix/detox/common/DetoxErrors.java +1 -0
- package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +36 -0
- package/android/detox/src/{full → main}/java/com/wix/detox/espresso/action/GetAttributesAction.kt +1 -13
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/AdjustSliderToPositionActionTest.kt +59 -0
- package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt +3 -15
- package/index.d.ts +208 -186
- package/index.js +1 -0
- package/internals.d.ts +129 -0
- package/internals.js +4 -0
- package/local-cli/build-framework-cache.js +2 -2
- package/local-cli/build.js +7 -8
- package/local-cli/build.test.js +46 -40
- package/local-cli/clean-framework-cache.js +3 -3
- package/local-cli/cli.js +0 -1
- package/local-cli/init.js +20 -55
- package/local-cli/templates/jest.js +9 -34
- package/local-cli/test.js +18 -282
- package/local-cli/test.test.js +332 -673
- package/local-cli/testCommand/TestRunnerCommand.js +156 -0
- package/local-cli/{utils/testCommandArgs.js → testCommand/builder.js} +10 -35
- package/local-cli/testCommand/middlewares.js +75 -0
- package/local-cli/{utils → testCommand}/warnings.js +0 -10
- package/local-cli/utils/jestInternals.js +13 -2
- package/local-cli/utils/yargsUtils.js +67 -0
- package/package.json +27 -21
- package/runners/deprecation.js +47 -0
- package/runners/jest/JestCircusEnvironment.js +3 -38
- package/runners/jest/adapter.d.ts +4 -10
- package/runners/jest/adapter.js +3 -6
- package/runners/jest/assignReporter.d.ts +4 -1
- package/runners/jest/assignReporter.js +3 -6
- package/runners/jest/deprecation.js +25 -0
- package/runners/jest/globalSetup.js +1 -0
- package/runners/jest/globalTeardown.js +1 -0
- package/runners/jest/index.js +21 -0
- package/runners/jest/reporter.js +1 -0
- package/runners/jest/reporters/DetoxReporter.js +5 -0
- package/runners/jest/specReporter.d.ts +4 -9
- package/runners/jest/specReporter.js +3 -10
- package/runners/jest/streamlineReporter.js +3 -22
- package/runners/jest/testEnvironment/index.js +155 -0
- package/runners/{jest-circus → jest/testEnvironment}/listeners/DetoxCoreListener.js +35 -17
- package/runners/{jest-circus → jest/testEnvironment}/listeners/DetoxInitErrorListener.js +1 -1
- package/runners/jest/testEnvironment/listeners/DetoxPlatformFilterListener.js +27 -0
- package/runners/jest/{SpecReporterImpl.js → testEnvironment/listeners/SpecReporter.js} +61 -7
- package/runners/jest/testEnvironment/listeners/WorkerAssignReporter.js +34 -0
- package/runners/jest/testEnvironment/listeners/index.js +13 -0
- package/runners/{jest-circus → jest/testEnvironment}/utils/assertExistingContext.js +2 -2
- package/runners/jest/testEnvironment/utils/assertJestCircus27.js +56 -0
- package/runners/jest/testEnvironment/utils/assertJestCircus27.test.js +23 -0
- package/runners/jest/{utils → testEnvironment/utils}/getFullTestName.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/hasTimedOut.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/index.js +0 -0
- package/runners/jest/{utils → testEnvironment/utils}/stdout.js +0 -0
- package/runners/jest-circus/environment/index.js +6 -0
- package/runners/jest-circus/index.js +1 -10
- package/runners/jest-circus/reporter.js +1 -0
- package/runners/migration.js +37 -0
- package/runners/mocha/DetoxMochaAdapter.js +3 -35
- package/runners/mocha/adapter.d.ts +4 -7
- package/runners/mocha/adapter.js +3 -5
- package/src/{Detox.js → DetoxWorker.js} +130 -168
- package/src/artifacts/ArtifactsManager.js +51 -2
- package/src/artifacts/log/android/ADBLogcatRecording.js +28 -11
- package/src/artifacts/providers/index.js +0 -4
- package/src/artifacts/utils/buildDefaultArtifactsRootDirpath.js +2 -4
- package/src/artifacts/utils/temporaryPath.js +2 -0
- package/src/client/AsyncWebSocket.js +1 -1
- package/src/client/actions/actions.js +2 -2
- package/src/configuration/collectCliConfig.js +2 -4
- package/src/configuration/composeAppsConfig.js +9 -67
- package/src/configuration/composeArtifactsConfig.js +6 -32
- package/src/configuration/composeBehaviorConfig.js +3 -13
- package/src/configuration/composeDeviceConfig.js +37 -62
- package/src/configuration/composeLoggerConfig.js +50 -0
- package/src/configuration/composeRunnerConfig.js +74 -14
- package/src/configuration/composeSessionConfig.js +1 -3
- package/src/configuration/index.js +24 -23
- package/src/configuration/utils/deviceAppTypes.js +0 -1
- package/src/devices/allocation/DeviceAllocator.js +3 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorAllocDriver.js +4 -3
- package/src/devices/allocation/drivers/android/emulator/EmulatorLauncher.js +2 -6
- package/src/devices/allocation/drivers/ios/SimulatorAllocDriver.js +1 -1
- package/src/devices/allocation/drivers/ios/SimulatorLauncher.js +3 -3
- package/src/devices/allocation/factories/index.js +0 -1
- package/src/devices/common/drivers/DeviceLauncher.js +2 -2
- package/src/devices/common/drivers/android/emulator/exec/EmulatorExec.js +1 -1
- package/src/devices/common/drivers/android/genycloud/services/GenyInstanceNaming.js +4 -9
- package/src/devices/common/drivers/ios/tools/AppleSimUtils.js +34 -9
- package/src/devices/lifecycle/GenyGlobalLifecycleHandler.js +1 -1
- package/src/devices/runtime/RuntimeDevice.js +69 -81
- package/src/devices/runtime/drivers/index.js +0 -1
- package/src/devices/runtime/drivers/ios/SimulatorDriver.js +3 -2
- package/src/devices/runtime/factories/ios.js +1 -8
- package/src/devices/runtime/utils/LaunchArgsEditor.js +4 -59
- package/src/devices/runtime/utils/Storage.js +4 -0
- package/src/environmentFactory.js +0 -8
- package/src/errors/DetoxConfigErrorComposer.js +76 -29
- package/src/errors/DetoxError.js +4 -0
- package/src/errors/DetoxRuntimeError.js +5 -5
- package/src/errors/index.js +2 -0
- package/src/ipc/IPCClient.js +117 -0
- package/src/ipc/IPCServer.js +81 -0
- package/src/ipc/state.js +67 -0
- package/src/logger/DetoxLogger.js +244 -0
- package/src/logger/DetoxTraceEventBuilder.js +21 -0
- package/src/logger/DetoxTracer.js +133 -0
- package/src/logger/TraceThreadDispatcher.js +52 -0
- package/src/{utils → logger}/customConsoleLogger.js +1 -1
- package/src/realms/DetoxConstants.js +13 -0
- package/src/realms/DetoxContext.js +170 -0
- package/src/realms/DetoxInternalsFacade.js +35 -0
- package/src/realms/DetoxPrimaryContext.js +228 -0
- package/src/realms/DetoxSecondaryContext.js +93 -0
- package/src/realms/index.js +10 -0
- package/src/realms/primary.js +3 -0
- package/src/realms/secondary.js +3 -0
- package/src/server/DetoxConnection.js +1 -1
- package/src/symbols.js +56 -0
- package/src/utils/Timer.js +14 -6
- package/{local-cli/utils/misc.js → src/utils/envUtils.js} +0 -9
- package/src/utils/logger.js +2 -162
- package/src/utils/shellUtils.js +18 -0
- package/src/utils/streamUtils.js +214 -0
- package/src/utils/trace.js +9 -44
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-javadoc.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-javadoc.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-javadoc.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-javadoc.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-sources.jar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-sources.jar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-sources.jar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1-sources.jar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.aar +0 -0
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.aar.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.aar.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.aar.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.aar.sha512 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.pom.md5 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.pom.sha1 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.pom.sha256 +0 -1
- package/Detox-android/com/wix/detox/19.7.1/detox-19.7.1.pom.sha512 +0 -1
- package/android/detox/src/full/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt +0 -22
- package/android/detox/src/full/java/com/wix/detox/espresso/common/SliderHelper.kt +0 -75
- package/android/detox/src/main/java/com/wix/detox/espresso/action/common/ReflectUtils.kt +0 -10
- package/android/detox/src/testFull/java/com/wix/detox/espresso/common/SliderHelperTest.kt +0 -39
- package/local-cli/templates/mocha.js +0 -32
- package/local-cli/utils/splitArgv.js +0 -107
- package/runners/integration.js +0 -16
- package/runners/jest/DetoxAdapterCircus.js +0 -60
- package/runners/jest/DetoxAdapterImpl.js +0 -81
- package/runners/jest/DetoxAdapterJasmine.js +0 -67
- package/runners/jest/DetoxStreamlineJestReporter.js +0 -98
- package/runners/jest/FailingTestsReporter.js +0 -16
- package/runners/jest/SpecReporterCircus.js +0 -51
- package/runners/jest/SpecReporterJasmine.js +0 -39
- package/runners/jest/WorkerAssignReporterCircus.js +0 -17
- package/runners/jest/WorkerAssignReporterImpl.js +0 -21
- package/runners/jest/WorkerAssignReporterJasmine.js +0 -15
- package/runners/jest/runnerInfo.js +0 -9
- package/runners/jest-circus/environment.js +0 -206
- package/runners/jest-circus/utils/assertJestCircus26.js +0 -39
- package/runners/jest-circus/utils/wrapErrorWithNoopLifecycle.js +0 -14
- package/src/DetoxConstants.js +0 -13
- package/src/DetoxExportWrapper.js +0 -140
- package/src/artifacts/timeline/TimelineArtifactPlugin.js +0 -90
- package/src/devices/allocation/drivers/NoneAllocDriver.js +0 -10
- package/src/devices/allocation/factories/none.js +0 -11
- package/src/index.js +0 -6
- package/src/utils/MissingDetox.js +0 -78
- package/src/utils/fakeTimestampsProvider.js +0 -9
- package/src/utils/getWorkerId.js +0 -5
- package/src/utils/lastFailedTests.js +0 -38
- package/src/utils/sh.js +0 -18
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
4c6cf9ab6a5661e76e324d60e32135a5
|
@@ -0,0 +1 @@
|
|
1
|
+
18acb60a8d1035c30d5456c6ae34452ba601be74
|
@@ -0,0 +1 @@
|
|
1
|
+
a5944cadfbcdb604230d233ffc61937c00aeeb0cd7d119ca80dd980c63cce162
|
@@ -0,0 +1 @@
|
|
1
|
+
3b03acc4ca394d1cf0ad68035630f5f9acf9ef61bb82bc82d12dd0521e477a6b9a90408052929d5292c4a277719f097d2e5442f72c206dfc9fa3454b0065c7ad
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
5b522f2a74898254ef0d235c51538892
|
@@ -0,0 +1 @@
|
|
1
|
+
9700c95cf470ffa9203966e67eaa5f42a3f261e1
|
@@ -0,0 +1 @@
|
|
1
|
+
13b5779cfa22e39ee57276e87f52a514ef22ca63c93eeecc040a0fc019de1fa1
|
@@ -0,0 +1 @@
|
|
1
|
+
bbf983c662070c19d39533e5bbc5c3aee9d0b5ad4f89c2df86b4358767fcdfb18989cf379ed12257173d2d73c69e1c12a4ed2fd92a5bc2229177d0f8b38b19bf
|
Binary file
|
@@ -0,0 +1 @@
|
|
1
|
+
763fee6cb2b551c8163caecafb821478
|
@@ -0,0 +1 @@
|
|
1
|
+
a3d2827035258ddbd41de27ce4e25df2f3a5a2fd
|
@@ -0,0 +1 @@
|
|
1
|
+
87990259e9864e07f8a1ccde34e69dfcadfba39167d7384062c272e81b307231
|
@@ -0,0 +1 @@
|
|
1
|
+
34165b1c6d6ea54d5c3420bd7f387dfa9fc81f8a43d50c404d06c9d24a6d6377dc84ba4f0b699dda5780658fb8796d197f368ef396cbf29240270e9fea78bddc
|
@@ -3,7 +3,7 @@
|
|
3
3
|
<modelVersion>4.0.0</modelVersion>
|
4
4
|
<groupId>com.wix</groupId>
|
5
5
|
<artifactId>detox</artifactId>
|
6
|
-
<version>
|
6
|
+
<version>20.0.0-breaking.new-global-lifecycle.0</version>
|
7
7
|
<packaging>aar</packaging>
|
8
8
|
<name>Detox</name>
|
9
9
|
<description>Gray box end-to-end testing and automation library for mobile apps</description>
|
@@ -0,0 +1 @@
|
|
1
|
+
66679cd30052bba4a828537b8cd97014
|
@@ -0,0 +1 @@
|
|
1
|
+
909eb59596a19f81bcad544a5b7aee3ed899e0c2
|
@@ -0,0 +1 @@
|
|
1
|
+
ba8c95326c6df61428a56284280062a28c1aa747dcc8d5ec50f1756f869aba7e
|
@@ -0,0 +1 @@
|
|
1
|
+
e0f4d3ce73bed2981edc17b8845a2f25044cba806371c3b57eaf59f9d008bff3be112a1cb9876dbafd0ec96a01d240452bdd563ac99f3c03f47ad3416e3ae2d3
|
@@ -3,11 +3,11 @@
|
|
3
3
|
<groupId>com.wix</groupId>
|
4
4
|
<artifactId>detox</artifactId>
|
5
5
|
<versioning>
|
6
|
-
<latest>
|
7
|
-
<release>
|
6
|
+
<latest>20.0.0-breaking.new-global-lifecycle.0</latest>
|
7
|
+
<release>20.0.0-breaking.new-global-lifecycle.0</release>
|
8
8
|
<versions>
|
9
|
-
<version>
|
9
|
+
<version>20.0.0-breaking.new-global-lifecycle.0</version>
|
10
10
|
</versions>
|
11
|
-
<lastUpdated>
|
11
|
+
<lastUpdated>20220719065707</lastUpdated>
|
12
12
|
</versioning>
|
13
13
|
</metadata>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
d6bdfc52b842956498f8c9915246ef54
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
7d7b975015b7c6dc6804b63b99522ffaca9d09ff
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
e3b6dce4491bb1703968fd4b82d89bfdf8c25014eac1fda6a64c196b9a79cea2
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3167b1a219d343785c974586d46d5a19dbe6985dd444d70f5bd364b747272c3da434f60f743c5a40c809a4f9db5e3665403471e5ed2756c50439c841993856cf
|
package/Detox-ios-src.tbz
CHANGED
Binary file
|
package/Detox-ios.tbz
CHANGED
Binary file
|
@@ -9,10 +9,7 @@ import android.os.Bundle;
|
|
9
9
|
import com.wix.detox.config.DetoxConfig;
|
10
10
|
import com.wix.detox.espresso.UiControllerSpy;
|
11
11
|
|
12
|
-
import java.util.concurrent.TimeUnit;
|
13
|
-
|
14
12
|
import androidx.annotation.NonNull;
|
15
|
-
import androidx.test.espresso.IdlingPolicies;
|
16
13
|
import androidx.test.platform.app.InstrumentationRegistry;
|
17
14
|
import androidx.test.rule.ActivityTestRule;
|
18
15
|
|
@@ -77,28 +74,6 @@ public final class Detox {
|
|
77
74
|
private static final LaunchIntentsFactory sIntentsFactory = new LaunchIntentsFactory();
|
78
75
|
private static ActivityTestRule sActivityTestRule;
|
79
76
|
|
80
|
-
/**
|
81
|
-
* Specification of values to use for Espresso's {@link IdlingPolicies} timeouts.
|
82
|
-
* <br/>Overrides Espresso's defaults as they tend to be too short (e.g. when running a heavy-load app
|
83
|
-
* on suboptimal CI machines).
|
84
|
-
*
|
85
|
-
* @deprecated Use {@link com.wix.detox.config.DetoxConfig}.
|
86
|
-
*/
|
87
|
-
@Deprecated
|
88
|
-
public static class DetoxIdlePolicyConfig {
|
89
|
-
/** Directly binds to {@link IdlingPolicies#setMasterPolicyTimeout(long, TimeUnit)}. Applied in seconds. */
|
90
|
-
public Integer masterTimeoutSec = 120;
|
91
|
-
/** Directly binds to {@link IdlingPolicies#setIdlingResourceTimeout(long, TimeUnit)}. Applied in seconds. */
|
92
|
-
public Integer idleResourceTimeoutSec = 60;
|
93
|
-
|
94
|
-
private com.wix.detox.config.DetoxIdlePolicyConfig toNewConfig() {
|
95
|
-
com.wix.detox.config.DetoxIdlePolicyConfig newConfig = new com.wix.detox.config.DetoxIdlePolicyConfig();
|
96
|
-
newConfig.masterTimeoutSec = masterTimeoutSec;
|
97
|
-
newConfig.idleResourceTimeoutSec = idleResourceTimeoutSec;
|
98
|
-
return newConfig;
|
99
|
-
}
|
100
|
-
}
|
101
|
-
|
102
77
|
private Detox() {
|
103
78
|
}
|
104
79
|
|
@@ -128,20 +103,6 @@ public final class Detox {
|
|
128
103
|
runTests(activityTestRule, getAppContext(), detoxConfig);
|
129
104
|
}
|
130
105
|
|
131
|
-
/**
|
132
|
-
* Same as the default {@link #runTests(ActivityTestRule)} method, but allows for the explicit specification of
|
133
|
-
* a custom idle-policy configuration. Note: review {@link DetoxIdlePolicyConfig} for defaults.
|
134
|
-
*
|
135
|
-
* @param idlePolicyConfig The custom idle-policy configuration to pass in; Will be applied into Espresso via
|
136
|
-
* the {@link IdlingPolicies} API.
|
137
|
-
*
|
138
|
-
* @deprecated Use {@link #runTests(ActivityTestRule, DetoxConfig)}
|
139
|
-
*/
|
140
|
-
@Deprecated
|
141
|
-
public static void runTests(ActivityTestRule activityTestRule, DetoxIdlePolicyConfig idlePolicyConfig) {
|
142
|
-
runTests(activityTestRule, getAppContext(), idlePolicyConfig);
|
143
|
-
}
|
144
|
-
|
145
106
|
/**
|
146
107
|
* <p>
|
147
108
|
* Use this method only if you have a React Native application and it
|
@@ -161,24 +122,6 @@ public final class Detox {
|
|
161
122
|
runTests(activityTestRule, context, new DetoxConfig());
|
162
123
|
}
|
163
124
|
|
164
|
-
/**
|
165
|
-
* Same as {@link #runTests(ActivityTestRule, Context)}, but allows for the explicit specification of
|
166
|
-
* a custom idle-policy configuration. Note: review {@link DetoxIdlePolicyConfig} for defaults.
|
167
|
-
*
|
168
|
-
*
|
169
|
-
* @param idlePolicyConfig The custom idle-policy configuration to pass in; Will be applied into Espresso via
|
170
|
-
* the {@link IdlingPolicies} API.
|
171
|
-
*
|
172
|
-
* @deprecated Use {@link #runTests(ActivityTestRule, Context, DetoxConfig)}
|
173
|
-
*/
|
174
|
-
@Deprecated
|
175
|
-
public static void runTests(ActivityTestRule activityTestRule, @NonNull final Context context, DetoxIdlePolicyConfig idlePolicyConfig) {
|
176
|
-
DetoxConfig config = new DetoxConfig();
|
177
|
-
config.idlePolicyConfig = idlePolicyConfig.toNewConfig();
|
178
|
-
|
179
|
-
runTests(activityTestRule, context, config);
|
180
|
-
}
|
181
|
-
|
182
125
|
/**
|
183
126
|
* Same as {@link #runTests(ActivityTestRule, Context)}, but allows for the explicit specification of
|
184
127
|
* various configurations. Note: review {@link DetoxConfig} for defaults.
|
@@ -214,7 +157,7 @@ public final class Detox {
|
|
214
157
|
}
|
215
158
|
|
216
159
|
public static void startActivityFromNotification(String dataFilePath) {
|
217
|
-
Bundle notificationData = new NotificationDataParser(dataFilePath).
|
160
|
+
Bundle notificationData = new NotificationDataParser(dataFilePath).toBundle();
|
218
161
|
Intent intent = sIntentsFactory.intentWithNotificationData(getAppContext(), notificationData, false);
|
219
162
|
launchActivitySync(intent);
|
220
163
|
}
|
@@ -225,7 +168,7 @@ public final class Detox {
|
|
225
168
|
if (sLaunchArgs.hasUrlOverride()) {
|
226
169
|
intent = sIntentsFactory.intentWithUrl(sLaunchArgs.getUrlOverride(), true);
|
227
170
|
} else if (sLaunchArgs.hasNotificationPath()) {
|
228
|
-
Bundle notificationData = new NotificationDataParser(sLaunchArgs.getNotificationPath()).
|
171
|
+
Bundle notificationData = new NotificationDataParser(sLaunchArgs.getNotificationPath()).toBundle();
|
229
172
|
intent = sIntentsFactory.intentWithNotificationData(getAppContext(), notificationData, true);
|
230
173
|
} else {
|
231
174
|
intent = sIntentsFactory.cleanIntent();
|
@@ -6,13 +6,13 @@ import com.wix.detox.common.TextFileReader
|
|
6
6
|
import org.json.JSONObject
|
7
7
|
|
8
8
|
internal class NotificationDataParser(private val notificationPath: String) {
|
9
|
-
fun
|
10
|
-
val rawData =
|
9
|
+
fun toBundle(): Bundle {
|
10
|
+
val rawData = readNotificationFromFile()
|
11
11
|
val json = JSONObject(rawData)
|
12
12
|
val payload = json.getJSONObject("payload")
|
13
13
|
return JsonConverter(payload).toBundle()
|
14
14
|
}
|
15
15
|
|
16
|
-
private fun
|
16
|
+
private fun readNotificationFromFile()
|
17
17
|
= TextFileReader(notificationPath).read()
|
18
18
|
}
|
@@ -2,6 +2,7 @@ package com.wix.detox.espresso;
|
|
2
2
|
|
3
3
|
import android.view.View;
|
4
4
|
|
5
|
+
import com.facebook.react.views.slider.ReactSliderManager;
|
5
6
|
import com.wix.detox.common.DetoxErrors.DetoxRuntimeException;
|
6
7
|
import com.wix.detox.common.DetoxErrors.StaleActionException;
|
7
8
|
import com.wix.detox.espresso.action.AdjustSliderToPositionAction;
|
@@ -150,7 +151,8 @@ public class DetoxAction {
|
|
150
151
|
}
|
151
152
|
|
152
153
|
public static ViewAction adjustSliderToPosition(final double newPosition) {
|
153
|
-
|
154
|
+
ReactSliderManager reactSliderManager = new ReactSliderManager();
|
155
|
+
return new AdjustSliderToPositionAction(newPosition, reactSliderManager);
|
154
156
|
}
|
155
157
|
|
156
158
|
public static ViewAction takeViewScreenshot() {
|
@@ -3,17 +3,15 @@
|
|
3
3
|
package com.wix.detox.espresso.matcher
|
4
4
|
|
5
5
|
import android.view.View
|
6
|
-
import androidx.appcompat.widget.AppCompatSeekBar
|
7
6
|
import androidx.test.espresso.matcher.BoundedMatcher
|
8
7
|
import androidx.test.espresso.matcher.ViewMatchers
|
9
8
|
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
|
10
|
-
import com.
|
9
|
+
import com.facebook.react.views.slider.ReactSlider
|
11
10
|
import org.hamcrest.BaseMatcher
|
12
11
|
import org.hamcrest.Description
|
13
12
|
import org.hamcrest.Matcher
|
14
13
|
import org.hamcrest.Matchers.allOf
|
15
14
|
import org.hamcrest.TypeSafeMatcher
|
16
|
-
import kotlin.math.abs
|
17
15
|
|
18
16
|
/*
|
19
17
|
* An extension of [androidx.test.espresso.matcher.ViewMatchers].
|
@@ -38,19 +36,6 @@ fun isOfClassName(className: String): Matcher<View> {
|
|
38
36
|
fun isMatchingAtIndex(index: Int, innerMatcher: Matcher<View>): Matcher<View> =
|
39
37
|
ViewAtIndexMatcher(index, innerMatcher)
|
40
38
|
|
41
|
-
fun toHaveSliderPosition(expectedValuePct: Double, tolerance: Double): Matcher<View?> =
|
42
|
-
object: BoundedMatcher<View?, AppCompatSeekBar>(AppCompatSeekBar::class.java) {
|
43
|
-
override fun describeTo(description: Description) {
|
44
|
-
description.appendText("sliderPositionPercent($expectedValuePct)")
|
45
|
-
}
|
46
|
-
|
47
|
-
override fun matchesSafely(view: AppCompatSeekBar): Boolean {
|
48
|
-
val sliderHelper = SliderHelper.create(view)
|
49
|
-
val progressPct = sliderHelper.getCurrentProgressPct()
|
50
|
-
return (abs(progressPct - expectedValuePct) <= tolerance)
|
51
|
-
}
|
52
|
-
}
|
53
|
-
|
54
39
|
/**
|
55
40
|
* Same as [androidx.test.espresso.matcher.ViewMatchers.isAssignableFrom], but accepts any class. Needed
|
56
41
|
* in order to avoid warning when passing 'any' class.
|
@@ -62,3 +47,25 @@ private class IsAssignableFromMatcher(private val clazz: Class<*>) : TypeSafeMat
|
|
62
47
|
description.appendText("is assignable from class: $clazz")
|
63
48
|
}
|
64
49
|
}
|
50
|
+
|
51
|
+
fun toHaveSliderPosition(expectedValue: Double, tolerance: Double): Matcher<View?> {
|
52
|
+
return object : BoundedMatcher<View?, ReactSlider>(ReactSlider::class.java) {
|
53
|
+
override fun describeTo(description: Description) {
|
54
|
+
description.appendText("expected: $expectedValue")
|
55
|
+
}
|
56
|
+
|
57
|
+
override fun matchesSafely(slider: ReactSlider?): Boolean {
|
58
|
+
val currentProgress = slider?.progress
|
59
|
+
|
60
|
+
if (currentProgress != null) {
|
61
|
+
val realProgress = slider.toRealProgress(currentProgress)
|
62
|
+
val currentPctFactor = slider.max / currentProgress.toDouble()
|
63
|
+
val realTotal = realProgress * currentPctFactor
|
64
|
+
val actualValue = realProgress / realTotal
|
65
|
+
return Math.abs(actualValue - expectedValue) <= tolerance
|
66
|
+
}
|
67
|
+
|
68
|
+
return false
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
package/android/detox/src/main/java/com/wix/detox/espresso/action/AdjustSliderToPositionAction.kt
ADDED
@@ -0,0 +1,36 @@
|
|
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
|
+
}
|
package/android/detox/src/{full → main}/java/com/wix/detox/espresso/action/GetAttributesAction.kt
RENAMED
@@ -9,7 +9,6 @@ import android.widget.TextView
|
|
9
9
|
import androidx.test.espresso.UiController
|
10
10
|
import com.google.android.material.slider.Slider
|
11
11
|
import com.wix.detox.espresso.ViewActionWithResult
|
12
|
-
import com.wix.detox.espresso.common.SliderHelper
|
13
12
|
import org.hamcrest.Matcher
|
14
13
|
import org.hamcrest.Matchers
|
15
14
|
import org.hamcrest.Matchers.allOf
|
@@ -128,24 +127,13 @@ private class CheckBoxAttributes {
|
|
128
127
|
rootObject.put("value", view.isChecked)
|
129
128
|
}
|
130
129
|
|
131
|
-
/**
|
132
|
-
* Note: this applies also to [androidx.appcompat.widget.AppCompatSeekBar], which
|
133
|
-
* is anything RN-slider-ish.
|
134
|
-
*/
|
135
130
|
private class ProgressBarAttributes {
|
136
131
|
fun get(json: JSONObject, view: View) {
|
137
132
|
if (view is ProgressBar) {
|
138
|
-
|
139
|
-
getRNSliderValue(json, it)
|
140
|
-
} ?:
|
141
|
-
getProgressBarValue(json, view)
|
133
|
+
getProgressBarValue(json, view)
|
142
134
|
}
|
143
135
|
}
|
144
136
|
|
145
|
-
private fun getRNSliderValue(rootObject: JSONObject, sliderHelper: SliderHelper) {
|
146
|
-
rootObject.put("value", sliderHelper.getCurrentProgressPct())
|
147
|
-
}
|
148
|
-
|
149
137
|
private fun getProgressBarValue(rootObject: JSONObject, view: ProgressBar) =
|
150
138
|
rootObject.put("value", view.progress)
|
151
139
|
}
|
@@ -0,0 +1,59 @@
|
|
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
|
+
}
|
package/android/detox/src/testFull/java/com/wix/detox/espresso/action/GetAttributesActionTest.kt
CHANGED
@@ -4,7 +4,6 @@ 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
|
8
7
|
import com.google.android.material.slider.Slider
|
9
8
|
import org.assertj.core.api.Assertions.assertThat
|
10
9
|
import org.json.JSONObject
|
@@ -180,7 +179,7 @@ class GetAttributesActionTest {
|
|
180
179
|
}
|
181
180
|
|
182
181
|
@Test
|
183
|
-
fun `should return
|
182
|
+
fun `should return ProgressBar (or SeekBar) "progress" via value attribute`() {
|
184
183
|
val progressBar: ProgressBar = mock {
|
185
184
|
on { progress } doReturn 42
|
186
185
|
}
|
@@ -190,18 +189,7 @@ class GetAttributesActionTest {
|
|
190
189
|
}
|
191
190
|
|
192
191
|
@Test
|
193
|
-
fun `should return
|
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`() {
|
192
|
+
fun `should return Slider state through value attribute`() {
|
205
193
|
val slider: Slider = mock {
|
206
194
|
on { value } doReturn 0.42f
|
207
195
|
}
|
@@ -237,7 +225,7 @@ class GetAttributesActionTest {
|
|
237
225
|
}
|
238
226
|
|
239
227
|
@Test
|
240
|
-
fun `should return text hint via
|
228
|
+
fun `should return text hint via "placeholder" attribute, if applicable`() {
|
241
229
|
val textViewWithHint: TextView = mock {
|
242
230
|
on { hint } doReturn "hint-text-mock"
|
243
231
|
}
|